Whenever I do refactoring, the first step is always the same. I need to build a solid set of tests for that section of code.
The tests are essential because even though I follow refactorings structured to avoid most of the opportunities for introducing bugs, I am still human and still make mistakes. Thus I need solid tests.
Because the statement result produces a string,
- I create a few customers,
- give each customer a few rentals of various kinds of films, and
- generate the statement strings.
I then do a string comparison between the new string and some reference strings that I have hand checked. I set up all of these tests so I can run them from one Java command on the command line.
The tests take only a few seconds to run and I run them often.
An important part of the tests is the way they report their results.
They either say "OK," meaning that all the strings are identical to the reference strings, or they print a list of failures: lines that turned out differently. The tests are thus self-checking. It is vital to make tests self-checking.
If you do not you end up spending time hand checking some numbers from the test against some numbers of a desk pad, and that slows you down
|Initial definition ||In this definition the developer has to possess a wide range of skills. The developer also has to choose between activities that each use a different set of tools and skills. |
| Design the user interfaces|
Write the user interfaces
Test the user interfaces
| User interface design uses screen elements and events. The priority is usability for the user as measured by easy of use, ease of understanding, ease of navigation, and the quality of content and presentation. |
| Design client applications|
Write client applications
Test client applications
| Client application design uses event management, flow of control, error handling, and server interface access. |
| Design server applications|
Write server applications
Test server applications
|Server application design uses transaction management, object caching and persistence strategies, database access, and much more. |