8.11. Run A Test Suite

./script/solar run-tests test-specification [--only] [--stop-on-fail] [--verbose]

This command runs a suite of test cases for a given test specification. The different kinds of specifications are outlined below.

Normally, the tests will run all the way through unless there is some sort of dramatic error. At the end, the command will report on how many tests were failed, marked as todo, skipped, and passed. However, sometimes you want to stop testing at the first failure; to do so, pass the --stop-on-fail option.

Test output is in Test Anything format, and as such is somewhat verbose to begin with. As a diagnostic and debugging aid, you can pass --verbose to see a lot more output, including the actual and expected values of failed assertions.

8.11.1. Run All Methods

./script/solar run-tests Test_Class

When you issue run-tests Test_Class, the command will run all Test_Class::test*() methods, and then it will recursively descend into the Test_Class subdirectory and run all test classes and methods therein.

If you don't want recursive descent into subdirectories, pass the --only option.

8.11.2. Run Some Methods

./script/solar run-tests Test_Class::testPrefix

Sometimes you want to run only some of the methods in a test suite. You can do so by passing the test class name and the test method name like so: run-tests Test_Class::testPrefix.

In fact, the ::testPrefix part of the specification is a wildcard; it will make the command run only methods that begin with testPrefix.

For example, let's say you have test methods named testFoo, testFoo9, and testFooBar (along with other non-foo test methods). If you issue run-tests Test_Class::testFoo, the command will run all three of the testFoo* methods, but none of the others.

The command will still recursively descend into subdirectores, and run the same set of test methods in in the sub-test classes. If you don't want recursive descent, pass the --only option.