Running groups of feature files

A test suite is a Gosu class that identifies a set of feature files to run at the same time. Test suites can be run either from Studio or from a command prompt. Test suites make it easier to run related feature files automatically as a part of continuous integration.

Behavior Testing Framework includes one example suite in the configuration/gtest folder, the PCBehaviorCucumberSuite test suite.

Narrowing the scope of a test suite

Every test suite must identify a single parent directory. By default, the test suite executes all feature files in that directory and its subdirectories.

You can narrow the scope of a test suite by using tags. In Behavior Testing Framework, a tag is a string added to a feature file that identifies a category to which the feature file belongs. Tags always start with an "@". For example, @supervisor, @personal_auto, and @renewal are all valid tags.

When you define the test suite, you can include one or more tags to the suite definition. For each tag, you can specify that either a feature file must have the tag to be included in the suite, or that a feature file must not have the tag to be incuded in the suite. This narrows the scope of the test suite to only the feature files in the given directory (and its subdirectories) that have all of the specified tags. For example:

  • A test suite with @supervisor includes all feature files with the @supervisor tag. (Whether they have other tags or not is irrelevant.)
  • A test suite with @supervisor and @personal_auto includes all feature files with both the @supervisor tag and the @personal_auto tag. (Whether they have other tags or not is irrelevant.)
  • A test suite with @supervisor and not @personal_auto includes all feature files with the @supervisor tag and without the @personal_auto tag. (Whether they have other tags or not is irrelevant.)

In both feature files and test suites, tags can be listed in any order.

Tags are case-sensitive. For example, @PA_submission and @pa_submission are considered to be different tags.

A single feature file can belong to any number of test suites. For example, suppose you have a feature file with the following tags: @supervisor @personal_auto. You then create two test suites: one for all @supervisor tests, and one for all @personal_auto tests. The initial feature file will be included in both test suites.

Test suite reports

When you run a test suite, by default, Behavior Testing Framework generates two reports that identify test outcomes:

  • An HTML report named index.html in build/test-results/<testSuiteName>/CucumberHTMLReport.
  • A JUnit report named CucumberResults.xml in build/test-results/<testSuiteName>.

You can modify the name and location of the report in the test suite definition.