This chapter explained why tests are an important investment in the future of your code. We explained in a step-by-step fashion how to define a few tests for the class
Set. Then we gave an overview of the core of the SUnit framework by presenting the classes
TestResources. Finally we looked deep inside SUnit by following the execution of a test and a test suite.
- To maximize their potential, unit tests should be fast, repeatable, independent of any direct human interaction and cover a single unit of functionality.
- Tests for a class called
MyClassbelong in a class classed
MyClassTest, which should be introduced as a subclass of
- Initialize your test data in a
- Each test method should start with the word “test”.
- Use the
deny:and others to make assertions.
- Run tests using the SUnit test runner tool (in the tool bar).