captain partition

Partition your test suite leveraging test file timings.


captain partition [suite-id] [flags]


Feeding partition into captain run:

  captain partition example-suite-id \
  --index  \
  --total  \
captain run example-suite-id $test_files

Running an individual partition:

bundle exec rspec $(captain partition your-project-rspec spec/**/*_spec.rb --index 0 --total 2)

General Options


Displays help for partition command.


Required. The identifier of the test suite. This value should be unique to your Captain organization. It can also be set with the environment variable CAPTAIN_SUITE_ID.

When neither --suite-id nor the environment variable CAPTAIN_SUITE_ID are specified, then the first positional argument will be treated as the suite ID. For example, if you run captain partition example-suite-id then example-suite-id will be used for the suite ID.

Partition Options

--delimiter <STRING>

Default: " " (space). The delimiter used to separate partitioned files in the output.

It can also be set with the environment variable CAPTAIN_DELIMITER.

--index <INTEGER>

Required. 0-indexed index of a particular partition.


--sha <COMMIT_SHA>

Sometimes Required. The git commit sha hash of the commit being built

If using a supported CI provider, this will be set automatically.

Otherwise, you may use this flag or set the environment variable CAPTAIN_SHA.

--total <INTEGER>

Required. The total number of partitions.

This can also be set with the environment variable CAPTAIN_PARTITION_TOTAL.