Universal Test Harness

Rubytest is a universal test harness for Ruby developers. You can think of Rubytest as a testing meta-framework. It defines a straight-forward specification that anyone can use to easily create their own testing DSLs. This can be used for testing end applcations directly or it can be used as a backend to build other test frameworks. In addition, since Rubytest controls the backend, multiple frameworks can be used in a single test suite all of which can run through a uniform interface in a single pass.

Rubytest's clean specification makes it almost trivial to implement new test suites and frameworks. The universal access point for testing is the $TEST_SUITE global array. A test suite or framework need only add compliant test objects to this array. Rubytest will iterate through these objects. If a test object responds to #call, it is run as a test procedure. If it responds to #each it is iterated over as a testcase with each entry handled in the same manner. All test objects must respond to #to_s so their description can be used in test reports.

Ruby Test handles assertions via BRASS compliance. Any raised exception that responds to #assertion? in the affirmative is taken to be a failed assertion rather than simply an error. A test framework may raise a NotImplementedError to have a test recorded as todo, i.e. a pending exception to remind the developer of tests that still need to be written. The exception can also set a priority level to indicate the urgency of the test. Priorities of -1 or lower are generally not brought to the attention of testers unless explicitly configured to do so.

That is the crux of Ruby Test specification. Ruby Test supports some additional features that can makes its usage even more convenient. See the Wiki for further details.