On this page:
2.1 Historical Context

2 The Philosophy of RackUnit

RackUnit is designed to allow tests to evolve in step with the evolution of the program under testing. RackUnit scales from the unstructured checks suitable for simple programs to the complex structure necessary for large projects.


(equal? (length null) 0)
(equal? (length '(a)) 1)

RackUnit directly supports this style of testing. A check on its own is a valid test. So the above examples may be written in RackUnit as:

(check-equal? (length null) 0)

Simple programs now get all the benefits of RackUnit with very little overhead.




Notice that all the previous tests written in the simple style are still valid. Introducing grouping is a local change only. This is a key feature of RackUnit’s support for the evolution of the program.


  "The name"
  ... test expressions ...)

Most programs will stick with this style. However, programmers writing very complex programs may wish to maintain separate groups of tests for different parts of the program, or run their tests in different ways to the normal RackUnit manner (for example, test results may be logged for the purpose of improving software quality, or they may be displayed on a website to indicate service quality). For these programmers it is necessary to delay the execution of tests so they can be processed in the programmer’s chosen manner. To do this, the programmer simply wraps a test-suite around their tests:

  "Suite name"
  (check ...)
  (test-begin ...)
  (test-case ...))


2.1 Historical Context

Most testing frameworks, including earlier versions of RackUnit, support only the final form of testing. This is likely due to the influence of the SUnit testing framework, which is the ancestor of RackUnit and the most widely used frameworks in Java, .Net, Python, and Ruby, and many other languages. That this is insufficient for all users is apparent if one considers the proliferation of “simpler” testing frameworks in Scheme such as SRFI-78, or the practice of beginner programmers. Unfortunately these simpler methods are inadequate for testing larger systems. To the best of my knowledge RackUnit is the only testing framework that makes a conscious effort to support the testing style of all levels of programmer.