Skip to main content

TestResult

单次 TestCase 运行的结果。

A result of a single TestCase run.


属性

Properties

attachments

Added in: v1.10 testResult.attachments

通过 testInfo.attachments 执行测试期间附加的文件或缓冲区列表。

The list of files or buffers attached during the test execution through testInfo.attachments.

用法

Usage

testResult.attachments

类型

Type

附件名称。

Attachment name.

要在报告中正确显示的此附件的内容类型,例如 'application/json''image/png'

Content type of this attachment to properly present in the report, for example 'application/json' or 'image/png'.

文件系统上附加文件的可选路径。

Optional path on the filesystem to the attached file.

使用可选附件正文代替文件。

Optional attachment body used instead of a file.


duration

Added in: v1.10 testResult.duration

运行时间以毫秒为单位。

Running time in milliseconds.

用法

Usage

testResult.duration

类型

Type


error

Added in: v1.10 testResult.error

测试执行期间抛出的第一个错误(如果有)。这等于 testResult.errors 中的第一个元素。

First error thrown during test execution, if any. This is equal to the first element in testResult.errors.

用法

Usage

testResult.error

类型

Type


errors

Added in: v1.10 testResult.errors

测试执行期间抛出的错误。

Errors thrown during the test execution.

用法

Usage

testResult.errors

类型

Type


parallelIndex

Added in: v1.30 testResult.parallelIndex

0workers - 1 之间的工作线程的索引。保证同时运行的 worker 有不同的 parallelIndex

The index of the worker between 0 and workers - 1. It is guaranteed that workers running at the same time have a different parallelIndex.

用法

Usage

testResult.parallelIndex

类型

Type


retry

Added in: v1.10 testResult.retry

当测试重试多次时,每次重试都会给出一个序列号。

When test is retries multiple times, each retry attempt is given a sequential number.

了解有关 测试重试 的更多信息。

Learn more about test retries.

用法

Usage

testResult.retry

类型

Type


startTime

Added in: v1.10 testResult.startTime

此特定测试运行的开始时间。

Start time of this particular test run.

用法

Usage

testResult.startTime

类型

Type

  • [日期]

    [Date]


status

Added in: v1.10 testResult.status

此测试结果的状态。另见 testCase.expectedStatus

The status of this test result. See also testCase.expectedStatus.

用法

Usage

testResult.status

类型

Type

  • "passed"|"failed"|"timedOut"|"skipped"|"interrupted"

stderr

Added in: v1.10 testResult.stderr

在测试运行期间写入标准错误的任何内容。

Anything written to the standard error during the test run.

用法

Usage

testResult.stderr

类型

Type


stdout

Added in: v1.10 testResult.stdout

在测试运行期间写入标准输出的任何内容。

Anything written to the standard output during the test run.

用法

Usage

testResult.stdout

类型

Type


steps

Added in: v1.10 testResult.steps

此测试运行中的步骤列表。

List of steps inside this test run.

用法

Usage

testResult.steps

类型

Type


workerIndex

Added in: v1.10 testResult.workerIndex

运行测试的工作线程的索引。如果测试不是运行一次,例如当用户中断测试时,唯一的结果将是 workerIndex 等于 -1

Index of the worker where the test was run. If the test was not run a single time, for example when the user interrupted testing, the only result will have a workerIndex equal to -1.

通过 Playwright 测试了解有关 并行性和分片 的更多信息。

Learn more about parallelism and sharding with Playwright Test.

用法

Usage

testResult.workerIndex

类型

Type