TestResult
A result of a single TestCase run.
屬性 (Properties)
annotations
Added in: v1.52The list of annotations applicable to the current test. Includes:
- annotations defined on the test or suite via test() and test.describe();
- annotations implicitly added by methods test.skip(), test.fixme() and test.fail();
- annotations appended to testInfo.annotations during the test execution.
Annotations are available during test execution through testInfo.annotations.
Learn more about test annotations.
使用方式
testResult.annotations
型別 (Type)
attachments
Added in: v1.10The list of files or buffers attached during the test execution through testInfo.attachments.
使用方式
testResult.attachments
型別 (Type)
- Array<Object>
-
name
stringAttachment name.
-
contentType
stringContent type of this attachment to properly present in the report, for example
'application/json'
or'image/png'
. -
path
string (optional)Optional path on the filesystem to the attached file.
-
body
Buffer (optional)Optional attachment body used instead of a file.
-
duration
Added in: v1.10Running time in milliseconds.
使用方式
testResult.duration
型別 (Type)
error
Added in: v1.10First error thrown during test execution, if any. This is equal to the first element in testResult.errors.
使用方式
testResult.error
型別 (Type)
errors
Added in: v1.10Errors thrown during the test execution.
使用方式
testResult.errors
型別 (Type)
parallelIndex
Added in: v1.30The 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
型別 (Type)
retry
Added in: v1.10When test is retried multiple times, each retry attempt is given a sequential number.
Learn more about test retries.
使用方式
testResult.retry
型別 (Type)
startTime
Added in: v1.10Start time of this particular test run.
使用方式
testResult.startTime
型別 (Type)
status
Added in: v1.10The status of this test result. See also testCase.expectedStatus.
使用方式
testResult.status
型別 (Type)
- "passed" | "failed" | "timedOut" | "skipped" | "interrupted"
stderr
Added in: v1.10Anything written to the standard error during the test run.
使用方式
testResult.stderr
型別 (Type)
stdout
Added in: v1.10Anything written to the standard output during the test run.
使用方式
testResult.stdout
型別 (Type)
steps
Added in: v1.10List of steps inside this test run.
使用方式
testResult.steps
型別 (Type)
workerIndex
Added in: v1.10Index 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
.
Learn more about parallelism and sharding with Playwright Test.
使用方式
testResult.workerIndex
型別 (Type)