Subject : Use cases, invariants, pre- and post-conditions, white and blackbox testing, unit testing with JUnit. Slides from the lecture (available after the lecture).
Text : MS Ch. 3 (from p.78), Ch. 4. [Expected reading time 5 hours.]
Comment : This time we will look at use cases and how they can form the basis for functional test cases. We also look at white and black box testing, and discuss the use of invariants and pre- and post-conditions for documenting code and as the basis for making functional and robustness test cases. We will show how to implement automatic unit testing with JUnit.
In the book, chapter 3 discusses test planning. As with most topics within testing there is here neither any silver bullet. View the descriptions as inspiration for how this could be done. In any given project, you would have to select and adapt the suggestions for actual use. Chapter 4 describes the idea of guided inspection: a systematic approach to manually, in groups, inspect models for correctness. It is summarized in Figure 4.41 on p. 156. It is largely based on use cases and the chapter contains a lot of examples of use cases, which you should think of as a starting point for test cases. Depending on the type of models, various different notations can be handy in documenting the test. For instance, (Message) Sequence Diagrams to show the method invocations as a function of time.
Further Reading : There is a lot of online material on JUnit. We have collected references to some of it on the Resources page. The corresponding unit testing framework for C# and .NET is called NUnit.
Get acquainted with Eclipse and JUnit. You will be offered assistance to install Eclipse and various other necessary tools. At the Lab session you will be given tasks to make sure you understand the necessary parts of Eclipse. Please refer to the lab setup guide. If you have time for it, you can start on the exercises for Friday..