TestResult
单次TestCase运行的结果。
🌐 A result of a single TestCase run.
属性
🌐 Properties
annotations
Added in: v1.52适用于当前测试的注解列表。包括:
🌐 The list of annotations applicable to the current test. Includes:
- 通过 test() 和 test.describe() 在测试或套件上定义的注解;
- 由方法 test.skip()、test.fixme() 和 test.fail() 隐式添加的注释;
- 在测试执行过程中附加到 testInfo.annotations 的注释。
在测试执行期间,可以通过 testInfo.annotations 获取注释。
🌐 Annotations are available during test execution through testInfo.annotations.
了解有关 测试注释 的更多信息。
🌐 Learn more about test annotations.
用法
testResult.annotations
类型
- [数组]<[对象]>
attachments
Added in: v1.10在测试执行期间通过testInfo.attachments附加的文件或缓冲区列表。
🌐 The list of files or buffers attached during the test execution through testInfo.attachments.
用法
testResult.attachments
类型
- [数组]<[对象]>
duration
Added in: v1.10运行时间以毫秒为单位。
🌐 Running time in milliseconds.
用法
testResult.duration
类型
error
Added in: v1.10测试执行期间抛出的第一个错误(如果有的话)。这等于 testResult.errors 中的第一个元素。
🌐 First error thrown during test execution, if any. This is equal to the first element in testResult.errors.
用法
testResult.error
类型
errors
Added in: v1.10测试执行期间抛出的错误。
🌐 Errors thrown during the test execution.
用法
testResult.errors
类型
- [数组]<[测试错误]>
parallelIndex
Added in: v1.30介于 0 和 workers - 1 之间的工作进程索引。保证同时运行的工作进程具有不同的 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.
用法
testResult.parallelIndex
类型
retry
Added in: v1.10当测试重试多次时,每次重试都会被赋予一个序列号。
🌐 When test is retried multiple times, each retry attempt is given a sequential number.
了解有关 测试重试 的更多信息。
🌐 Learn more about test retries.
用法
testResult.retry
类型
startTime
Added in: v1.10此特定测试运行的开始时间。
🌐 Start time of this particular test run.
用法
testResult.startTime
类型
status
Added in: v1.10此测试结果的状态。另请参见 testCase.expectedStatus。
🌐 The status of this test result. See also testCase.expectedStatus.
用法
testResult.status
类型
- "通过" | "未通过" | "超时" | "跳过" | "中断"
stderr
Added in: v1.10在测试运行期间写入标准错误的任何内容。
🌐 Anything written to the standard error during the test run.
用法
testResult.stderr
类型
- [数组]<[字符串] | [缓冲区]>
stdout
Added in: v1.10在测试运行期间写入标准输出的任何内容。
🌐 Anything written to the standard output during the test run.
用法
testResult.stdout
类型
- [数组]<[字符串] | [缓冲区]>
steps
Added in: v1.10此测试运行中的步骤列表。
🌐 List of steps inside this test run.
用法
testResult.steps
类型
- [数组]<[测试步骤]>
workerIndex
Added in: v1.10测试运行的工作节点索引。如果测试一次都未运行,例如用户中断了测试,则唯一的结果中 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.
用法
testResult.workerIndex
类型