Run Strategy
January 22, 2023 ยท View on GitHub
Selection Parameters
When you don't specify any parameter then all the tests in cypress/integration/features will run. However, if tests marked with @skip will be skipped. If you have marked some tests @only then all the remaining tests will be skipped.
Parameters
--spec
Filtering the tests at file level.
Run all files
npx cytorus run
Run particular file
npx cytorus run --spec "cypress/integration/features/google.feature"
Run files with matching pattern
npx cytorus run --spec "cypress/integration/features/google*.feature"
Run all .feature files in current folder
npx cytorus run --spec "cypress/integration/features/*.feature"
Run all .feature files in current and nested folder
npx cytorus run --spec "cypress/integration/features/**/*.feature"
--tags
To select tests based on the tags at feature, scenario, or examples level
npx cytorus run --tags "@all but not @wip"
You can mix it with --spec to apply on selected files.
--only
To run the tests from their position in a feature file. It'll run the given tests, even if they're marked as @skip
npx cytorus run --only "1,3,4.2" --spec "cypress/integration/features/google.feature"
You can't combine it with --tags or --skip filters.
--only vs @only
@only is not a filter. It is an annotation. Tests marked with @only are counted in test result if they fall in your selection.
Whereas --only is a filter. Suppose, you select 3 scenarios using --only where 1 tag out of 3 has @only then only 1 test will run. And rest 2 tags will be skipped.
--skip
This is opposite to --only. It is helpful when you want to run all the tests of current selection but want to skip a few.
npx cytorus run --skip "1,3,4.2" --spec "cypress/integration/features/google.feature"
You can't combine it with --tags or --only filters.
--skip vs @skip
@skip is not a filter. It is an annotation. Tests marked with @skip are counted in test result if they fall in your selection.
Whereas --skip is a filter. It filters out the selected tests.
@only: Use this to run particular tests from a feature file. This tag has the most priority. Suppose, you run tests for @some where all the selec
--story
Select the scenarios across feature files where some steps belong to given story.
npx cytorus run --story "ABCD-1342"
Remember that if any selected scenario is marked as @only, or @skip then eligible tests will run and rest will be skipped. You can notice this in result.
This is effective only if there are some steps belonging to specified story
Scenario: some scenario
Given some condition
When I perform an action
Then I se the enable to test further
#> story: ABCD-1342
When I perform story specific action
Then this ends here
Route (--from, --on, --till-next)
Select the scenarios across feature files where some steps pass through specified route.
npx cytorus run --from "product page"
Scenario: some scenario
Given some condition
When I perform an action
Then I se the enable to test further
#> route: product page
When I perform story specific action
Then this ends here
You should write the handler method in such a way that it enables all the condition to start the tests from particular route.
step("product page", ()=> {
...
});
Remember that if any selected scenario is marked as @only, or @skip then eligible tests will run and rest will be skipped. You can notice this in result.
- --from: All the previous steps in the selected scenario will be skipped
- --on: All the previous steps in the selected scenario will be skipped. And all the steps which are executing when URL gets changed, will be skipped too.
- --till-next: All the previous steps in the selected scenario will be skipped. Steps after one url change will be executing. This is helpful when you have to test further integration.
If you're passing through and marked the same route multiple times in a single scenario then first marked route would be considered.
Route (--via, --not-via)
Select the scenarios across feature files where some steps pass through specified route or don't pass through specified route.
npx cytorus run --via "product page"
npx cytorus run --not-via "product page"
> Next : Project configuration to create test strategy and more