Mint

Mint and Captain work together to run your tests and provide you with test result data directly in Mint.

Here, we'll walk through everything needed to integrate Captain with Mint:

  1. Installing the Captain CLI
  2. Integrating Captain with your test framework
  3. Retry failed tests from Mint

Installing Captain

Add a task that uses the rwx/install-captain leaf to install the Captain CLI.

# .mint/ci.yml

tasks:
  - key: captain
    call: rwx/install-captain 1.0.2

Integrating Captain with your test framework

Captain integrates with many test frameworks. [Find instructions for your specific test framework here.][captain-test-frameworks]

This example integrates with [Ruby's RSpec][ruby-rspec] but can be used as a baseline for integrating with a different framework.

# .captain/config.yaml

test-suites:
  captain-examples-rspec:
    command: bundle exec rspec --format json --out rspec-results.json --format progress
    results:
      path: rspec-results.json
    output:
      print-summary: true
      reporters:
        rwx-v1-json: captain-results.json
# .mint/ci.yml

tasks:
  # ... tasks that clone your repo, setup Ruby, etc. here
  - key: captain
    call: rwx/install-captain 1.0.2

  - key: rspec
    use: captain # you'll likely also depend on your code, your Ruby dependencies, etc.
    run: captain run captain-examples-rspec
    outputs:
      test-results:
        - path: captain-results.json

Partitioning

Captain's partitioning feature works with Mint parallel tasks:

Start by updating your Captain configuration to enable partitioning as follows:

# .captain/config.yaml

test-suites:
  captain-examples-rspec:
    # existing config...
    partition:
      command: bundle exec rspec --format json --out tmp/rspec.json --format progress {{ testFiles }}
      globs:
        - spec/**/*_spec.rb

And then use the parallel expressions to instruct Captain to run individual partitions.

# .mint/ci.yml

tasks:
  # ... tasks that clone your repo, setup Ruby, etc. here
  - key: captain
    call: rwx/install-captain 1.0.2

  - key: rspec
    use: captain # you'll likely also depend on your code, your Ruby dependencies, etc.
    parallel: 2
    run: captain run captain-examples-rspec --partition-index ${{ parallel.index }} --partition-total ${{ paralllel.total }}
    outputs:
      test-results:
        - path: test-results.json

Viewing test results

Mint will display your test results directly in the UI:

test results in Mint

Captain will also automatically output a Mint link linking to your test results inside of Captain, and the results in Captain will link back to Mint.

Retrying failed tests

If you configure Captain with a retry command, Captain will add a retry action to Mint allowing you to retry only the tests that failed.