Skip to main content

TestRun

Controls which tests will run and their expected status. A TestRun is available during reporter.preprocess(). Setup and teardown projects cannot be changed.


Methods

exclude

Added in: v1.62 testRun.exclude

Excludes a test or suite from the run. Excluded tests do not appear in the report and their bodies are not executed.

Usage

testRun.exclude(test);

Arguments

  • test TestCase | Suite#

    Test or suite to exclude. The root suite cannot be excluded.


fail

Added in: v1.62 testRun.fail

Marks a test or every test in a suite as "should fail". Playwright runs the tests and ensures they are actually failing, useful for documenting broken functionality until it is fixed.

Usage

testRun.fail(test);
testRun.fail(test, reason);

Arguments

  • test TestCase | Suite#

    Test or suite to mark as expected-to-fail.

  • reason string (optional)#

    Optional explanation surfaced as the annotation description.


fixme

Added in: v1.62 testRun.fixme

Marks a test or every test in a suite as fixme. The test bodies are not executed and the tests are reported as skipped, with the intention to fix them.

Usage

testRun.fixme(test);
testRun.fixme(test, reason);

Arguments

  • test TestCase | Suite#

    Test or suite to mark as fixme.

  • reason string (optional)#

    Optional explanation surfaced as the annotation description.


skip

Added in: v1.62 testRun.skip

Skips a test or every test in a suite. The test bodies are not executed and the tests are reported as skipped.

Usage

testRun.skip(test);
testRun.skip(test, reason);

Arguments

  • test TestCase | Suite#

    Test or suite to skip.

  • reason string (optional)#

    Optional explanation surfaced as the annotation description.


skipSharding

Added in: v1.62 testRun.skipSharding

Disables Playwright's built-in shard filter for this run, leaving sharding to the reporter. Reporters typically implement their own sharding by calling testRun.exclude() on out-of-shard tests.

Usage

testRun.skipSharding();