Test Selection Rules

The Test Selection feature enables your team to run a subset of the tests based on changes made to the source files.

In order to start using this feature, your repository should have a testery.yml file defined. This file should include a section as described below.

When running tests from the UI, be sure to select the "Use testery.yml" option.

testery.yml syntax for defining test selection rules

test_selection:
  suites:
    - default:
      rules:
        - employeeRule:
          when:
            - src_changes:
                - "src/employees/*"
          then:
            - include_tags:
                - "employees"
                - "smoke"   
        - itemRule:
          when:
            - src_changes:
                - "src/items/*"
          then:
            - include_tags:
                - "items"

Currently, Testery supports 1 suite of rules, named "default". Within the suite, you'll need a list of "rules". Each rule has a "when" and a "then".

When Conditions

When conditions are used to trigger a set of tests to be selected.

  • src_changes - This trigger will apply a glob expression to the list of files changed in the code branch.

Then Conditions

Then conditions refine the tests that will be selected

  • include_tags: If your testing framework supports tags, then this can be used to specify the tags that will be included in the test run

  • exclude_tags: If your testing framework supports tags, then this can be used to specify the tags that will be excluded in the test run

  • test_filters: A glob expression that can be applied to choose the tests to run

Last updated

Was this helpful?