TestResult
Source URL: https://playwright.dev/docs/api/class-testresult
TestResult | Playwright
Section titled “TestResult | Playwright”A result of a single TestCase run.
Properties
Section titled “Properties”annotations
Section titled “annotations”Added in: v1.52 testResult.annotations
The 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.
Usage
testResult.annotationsType
Annotation type, for example 'skip' or 'fail'.
* `description` [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string") _(optional)_Optional description.
* `location` [Location](https://playwright.dev/docs/api/class-location "Location") _(optional)_Optional location in the source where the annotation is added.
attachments
Section titled “attachments”Added in: v1.10 testResult.attachments
The list of files or buffers attached during the test execution through testInfo.attachments.
Usage
testResult.attachmentsType
Attachment name.
* `contentType` [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string")Content type of this attachment to properly present in the report, for example 'application/json' or 'image/png'.
* `path` [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string") _(optional)_Optional path on the filesystem to the attached file.
* `body` [Buffer](https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer") _(optional)_Optional attachment body used instead of a file.
duration
Section titled “duration”Added in: v1.10 testResult.duration
Running time in milliseconds.
Usage
testResult.durationType
Added in: v1.10 testResult.error
First error thrown during test execution, if any. This is equal to the first element in testResult.errors.
Usage
testResult.errorType
Added in: v1.10 testResult.errors
Errors thrown during the test execution.
Usage
testResult.errorsType
parallelIndex
Section titled “parallelIndex”Added in: v1.30 testResult.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.parallelIndexType
Added in: v1.10 testResult.retry
When test is retried multiple times, each retry attempt is given a sequential number.
Learn more about test retries.
Usage
testResult.retryType
startTime
Section titled “startTime”Added in: v1.10 testResult.startTime
Start time of this particular test run.
Usage
testResult.startTimeType
Added in: v1.10 testResult.status
The status of this test result. See also testCase.expectedStatus.
Usage
testResult.statusType
- “passed” | “failed” | “timedOut” | “skipped” | “interrupted”
Added in: v1.10 testResult.stderr
Anything written to the standard error during the test run.
Usage
testResult.stderrType
Added in: v1.10 testResult.stdout
Anything written to the standard output during the test run.
Usage
testResult.stdoutType
Added in: v1.10 testResult.steps
List of steps inside this test run.
Usage
testResult.stepsType
workerIndex
Section titled “workerIndex”Added in: v1.10 testResult.workerIndex
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.
Learn more about parallelism and sharding with Playwright Test.
Usage
testResult.workerIndexType