Prints a list of the components that have changed since the last commit and for which tests need to be run. Uses the dependencies within component-based Ruby/Rails applications (#cbra) to also print all transitively affected components.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install cobratest
cobratest [OPTION] [application path]
Test runner employing the structure of Component-based Ruby/Rails apps to optimize what needs to run.
-h, -H, --help Display this help message.
-r, --results DEFAULT Display the directories of the components in need of running tests
-t, --test-runner RUNNER Choose a test runner
-v, --verbose Verbose output of all parts of the calculation
-s, --since BRANCH Specify BRANCH target to calculate against
There are sample #cbra folder structures in
spec/examples. Here is an example run when changing a file in component
$ bin/cobratest ./cobratest/spec/examples/letters/A
This output can be used to run the necessary tests like so:
bin/cobratest ./cobratest/spec/examples/letters/A | xargs -n1 /bin/bash
You can choose a different test runner like so:
$ bin/cobratest --test-runner 'myrunner --option 1' ./cobratest/spec/examples/letters/A
./cobratest/spec/examples/letters/B/myrunner --option 1
./cobratest/spec/examples/letters/C/myrunner --option 1
./cobratest/spec/examples/letters/A/myrunner --option 1
In verbose mode one can check the correctness of cobratest's calculation:
$ bin/cobratest -v ./cobra/cobratest/spec/examples/letters/A
Changes since last commit
Directly affected components
Transitively affected components
Test scripts to run
- make algorithm work for structures where a gem is in a sub folder of another gem (only the inner gem should be directly affected)
- allow for other test runners to be specified
Released under the MIT license. See LICENSE file for details.