Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & Test Observability

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 parameter

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/e2e/1-getting-started/todo.cy.js", "cypress/e2e/2-advanced-examples/actions.cy.js"]
    ...
  }
  ...
}
//browserstack.json
{
  ...
  "run_settings": {
    ...
    "specs": ["cypress/integration/1-getting-started/todo.cy.js", "cypress/integration/2-advanced-examples/actions.cy.js"]
    ...
  }
  ...
}

Using the CLI

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

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

For example:

# Run a single spec instead of everything
browserstack-cypress run --sync --spec "cypress/e2e/2-advanced-examples/actions.cy.js"

# Run all tests matching the regex / glob
browserstack-cypress run --sync --spec "cypress/e2e/2-advanced-examples/**/*"

# Run multiple spec files
browserstack-cypress run --sync --spec "cypress/e2e/1-getting-started/todo.cy.js,cypress/e2e/2-advanced-examples/actions.cy.js"
# Run a single spec instead of everything
browserstack-cypress run --sync --spec "cypress/integration/2-advanced-examples/actions.cy.js"

# Run all tests matching the regex / glob
browserstack-cypress run --sync --spec "cypress/integration/2-advanced-examples/**/*"

# Run multiple spec files
browserstack-cypress run --sync --spec "cypress/integration/1-getting-started/todo.cy.js,cypress/integration/2-advanced-examples/actions.cy.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
Download Copy