Links

cucumber

This page outlines how the Launchable CLI interfaces with cucumber.
This is a reference page. See Getting started, Sending data to Launchable, and Subsetting your test runs for more comprehensive usage guidelines.

Recording test results

First, use the junit report plugin to create test reports:
bundle exec cucumber -f junit -o reports
After running tests, point the CLI to your test report files to collect test results and train the model:
launchable record tests --build <BUILD NAME> cucumber ./reports/**/*.xml
If you receive a warning messages such as Cannot find test file Test-feature-example.xml, set the project's root directory path with the --base option:
launchable record tests --build <BUILD NAME> --base /example/project cucumber /example/project/reports/**/*.xml
You might need to take extra steps to make sure that launchable record tests always runs even if the build fails. See Always record tests.

JSON option

If you want to use JSON format, you can use a --json option.
bundle exec cucumber -f json -o reports
launchable record tests --build <BUILD NAME> cucumber --json ./reports/**/*.json

Subsetting your test runs

The high level flow for subsetting is:
  1. 1.
    Get the full list of tests/test paths and pass that to launchable subset with an optimization target for the subset
  2. 2.
    launchable subset will get a subset from the Launchable platform and output that list to a text file
  3. 3.
    Pass the text file into your test runner to run only those tests
To retrieve a subset of tests, first list all the tests you would normally run (with features/**/*.feature) and pass that to launchable subset:
launchable subset \
--build <BUILD NAME> \
--confidence <TARGET> \
cucumber features/**/*.feature > launchable-subset.txt
  • The --build should use the same <BUILD NAME> value that you used before in launchable record build.
  • The --confidence option should be a percentage; we suggest 90% to start. You can also use --time or --target; see Subsetting your test runs for more info.
This creates a file called launchable-subset.txt that you can pass into your command to run tests:
bundle exec cucumber $(cat launchable-subset.txt)
Last modified 9d ago