Testing Your Programs - Halpin, Terry; Rugaber, Spencer (Taylor & Francis Group, 2015)
This appendix describes the lb unit unit-testing framework. An important part of constructing programs in any language is testing them, and one purpose of this appendix is to get you thinking about constructing tests as you write your programs. The lb unit is invoked by typing lb unit args, where args is used to indicate the tests you want to run and other options you can supply. Individual tests can be run by using the --test fileName(s) option, where fileName(s) gives the name of the file(s) containing the tests that you want to run. You can also organize your tests into suites, collections of related tests. Similar to the above, you would use the --suite suiteName(s) option to run suite(s) of tests. Each of them names a directory containing a set of test files to execute. You can even run a series of suites by using the --suiteDir suiteDirectory(ies) option. In this case, lb unit will recursively execute the tests in each of the named directories. Regardless of how you invoke lb unit, it first runs any user-specified setup instructions common to the tests in the directory containing them. The instructions are placed in a file named setUp.lb. Similarly, after the tests are run, lb unit runs the instructions in the file tearDown.lb. Note that all test script files should use the .lb suffix.