Skip to main content

sets

Overview

You can use sets to bind a set of tests to specific browsers and run them all at once with the command testplane --set <set-name>.

This can be convenient for running tests by platforms: desktop, touch-phone, etc. You may also have a common set corresponding to common tests that you will always run in all browsers.

A set of tests is specified as an array of paths to them or to folders containing them on the file system. You can also specify paths to ignore when searching for tests to speed up the Testplane test reading process.

If there are no sets in the config, or you do not specify them when running Testplane (see the “Usage” section), then all tests from the testplane folder will be run in all browsers specified in the browsers section of the Testplane config.

Setup

The sets section has the following format:

testplane.config.ts
import type { ConfigInput } from "testplane";

export default {
browsers: {
/* ... */
},
sets: {
"<set-id>": {
files: ["path-1", "some/folder/**/*.some-ext"],
ignoreFiles: ["ignorePath-1", "some/ignore/folder/**/"],
browsers: ["browser-1", "browser-2"],
},
},
} satisfies ConfigInput;

Where <set-id> is the name of the set used for its identification.

Sets Section Reference

ParameterTypeDefaultDescription
filesstring | string[]N/A

List of paths to files or folders with tests. In the case of a single path, the parameter can be specified as a string. You can also use patterns.

ignoreFilesstring | string[][ ]

List of paths or patterns to ignore when searching for test files. This parameter allows speeding up the Testplane test reading process.

browsersstring[]all browsers

List of browsers in which the tests will be run. You can specify only the browsers listed in the browsers section of the Testplane config. Default: all browsers from the browsers section.

Setup Example

testplane.config.ts
import type { ConfigInput } from "testplane";

export default {
browsers: {
chrome: {
/*...*/
},
firefox: {
/*...*/
},
iphone: {
/*...*/
},
},
sets: {
common: {
files: "tests/common/*.testplane.ts",
},
desktop: {
files: ["tests/desktop/*.testplane.ts", "tests/common/*.testplane.ts"],
ignoreFiles: ["**/screens/**"],
browsers: ["chrome", "firefox"],
},
},
} satisfies ConfigInput;

In this example, the common set contains all tests in the common directory and will run in all browsers. The desktop set contains all tests in the common and desktop directories but will only run in chrome and firefox.

Usage

Use the CLI option --set to specify a set when running tests.

Example of how to run tests for the desktop platform with the configuration provided above:

testplane --set desktop

If there are no sets in the config, or they exist but the --set option was not specified, and no paths were passed to testplane via CLI, then all tests from the testplane folder will be run in all browsers.