Skip to main content

Using Knapsack Pro with CircleCI

Collect metadata​

You may want to collect metadata in CircleCI.

RSpec​

To collect JUnit reports of your RSpec runs, you would:

.circleci/config.yml
- run:
name: RSpec with Knapsack Pro
command: |
mkdir -p /tmp/test-results
bundle exec rake "knapsack_pro:queue:rspec[--format documentation --format RspecJunitFormatter --out /tmp/test-results/rspec.xml]"

- store_test_results:
path: /tmp/test-results

- store_artifacts:
path: /tmp/test-results
destination: test-results

You can find a complete CircleCI configuration in RSpec testing parallel jobs with CircleCI and JUnit XML report.

Cucumber​

Please provide a directory path in the --out option, where JUnit XML reports are generated. The directory path tmp/test-reports/ must end with / as shown in the following example:

.circleci/config.yml
- run:
name: Cucumber with Knapsack Pro
command: |
mkdir -p /tmp/test-results
bundle exec rake "knapsack_pro:queue:cucumber[--format junit --out tmp/test-reports/]"

- store_test_results:
path: /tmp/test-results

- store_artifacts:
path: /tmp/test-results
destination: test-results

The XML report is generated for each batch of tests fetched from the Queue API, so multiple reports are created on each CI node.

Rerun only failed tests​

Use Retry only Failures instead of CircleCI rerun failed tests.