1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
# How To
## Run all tests
To make it easy to run all your tests, you can add a `run_test.rb` script
to your `test` directory. A simple example might look like:
base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
lib_dir = File.join(base_dir, "lib")
test_dir = File.join(base_dir, "test")
$LOAD_PATH.unshift(lib_dir)
require 'test/unit'
exit Test::Unit::AutoRunner.run(true, test_dir)
Then it's easy to run tests via the command line with,
$ ruby test/run_test.rb
## Change test runner via the command line
The output format can be changed via the command line with
the `--runner` option. Simply tack it to the end:
ruby test/run_test.rb --runner tap
## Configure test-unit per-project
Test::Unit reads `test-unit.yml` or `.test-unit.yml` in the current working
directory as Test::Unit's configuration file. It can contain the following
settings:
* color scheme definitions
* test runner to be used
* test runner options
* test collector to be used
Except color scheme definitions, all of them can be specified by command
line option.
Here are sample color scheme definitions:
color_schemes:
inverted:
success:
name: red
bold: true
failure:
name: green
bold: true
other_scheme:
...
Here are the syntax of color scheme definitions:
color_schemes:
SCHEME_NAME:
EVENT_NAME:
name: COLOR_NAME
intensity: BOOLEAN
bold: BOOLEAN
italic: BOOLEAN
underline: BOOLEAN
...
...
| Definition | Description |
|-------------|------------------------------|
| SCHEME_NAME | the name of the color scheme |
| EVENT_NAME | success, failure, pending, omission, notification, error |
| COLOR_NAME | black, red, green, yellow, blue, magenta, cyan, white |
| BOOLEAN | true or false |
You can use the above 'inverted' color scheme with the following configuration:
runner: console
console_options:
color_scheme: inverted
color_schemes:
inverted:
success:
name: red
bold: true
failure:
name: green
bold: true
|