This is the file that describes the commands that compose your test suite. There are two kinds of commands.

Single commands

Every key you define in this yml file will be considered as a command that some worker should run. For example, lets say you want to run a Minitest suite in a Ruby on Rails project. This is usually achieved with something like: bin/rake test

To create this “job” in testributor.yml you need the following:

minitest:
  command: "bin/rake test"

This will create a job named “minitest” with the command that runs the Minitest suite.

Iterator

Single commands are a good way to run small suites that might not benefit from parallelisation. Large code base projects usually have larger test suites that take long to complete. These suites will run faster when broken into many jobs that will run in multiple workers. The easiest way to split the suite is one job per file. For example, in Minitest you could run each file the following commands:

bin/rake test test/models/user_test.rb
bin/rake test test/models/post_test.rb
...

You can achieve this in testributor.yml with the following code:

each:
  pattern: 'test/.*_test.rb$'
  command: 'bin/rake test %{file}'

To split or not to split

Splitting a suite into many jobs sometimes comes with an overhead. For example the “test” rake task calls some other rake tasks behind the scenes which prepare the database etc. Running these rake tasks before each file when no other action is taken between the various files, might not make sense and add a lot of extra time.

In a project we replaced the rake task with the following command and this resulted in a huge performance improvement:

bin/rails runner -e test '$LOAD_PATH.push("#{Rails.root}/test"); require "%{file}".gsub(/^test\//,"")'

Learning how your testing framework works can be very rewarding, so keep that in mind when tweaking your commands.