Content deleted Content added
Line 64:
When writing behavioral tests there are number of practical rules to keep in mind that will help developers to stay on track with the goals of testing behavior instead of implementation. These numbers aim to make both tests and application code and design as flexible and robust as possible.
* '''Test size''': each test (that is each test method) should not be longer than 15 lines of code (not counting empty lines). Test methods that are longer are either too complex (or the implementation is inefficient) or test too much behavior.
* '''Mock objects''': the usage of mock objects is encouraged (e.g. by using the [[EasyMock]] framework for Java) to achieve the previous goal.
* '''Helper methods''': some behavior is best implemented in a helper method (e.g. load this or that from the database) that can be easily tested and called from elsewhere in the application. These methods help to make the code more expressive (through expressive method and argument names) and easier to test.
|