Skip to main content

Specify spec files to run

Learn how to specify a subset of tests that you want to run

You can specify the set of specs that you want to run on BrowserStack in two ways:

  1. Mentioning the spec files details in browserstack.json
  2. Using the CLI param

Using browserstack.json

You can use the specs key in run_settings option to specify the spec files that you want to run on BrowserStack.

Key Accepted values
specs An array of patterns (file paths or regexes) that match the spec files that you want to run

For example:

browserstack.json
{
  ...
  "run_settings": {
    ...
    "specs": ["cypress/integration/login/**/*", "cypress/integration/examples/actions.spec.js"]
    ...
  }
  ...
}

Using the CLI

You can use the following args while running the tests using the run command:

Arg Shorthand Accepted values
--specs -s Comma separated patterns (an exact path or a regex) for your spec files

For example:

Command Line
# Run a single spec instead of everything
browserstack-cypress run --sync --specs "cypress/integration/examples/actions.spec.js"

# Run all tests matching the regex / glob
browserstack-cypress run --sync --specs "cypress/integration/login/**/*"

# Run multiple spec files
browserstack-cypress run --sync --specs "cypress/integration/examples/actions.spec.js,cypress/integration/examples/files.spec.js"

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert