line art

Performance and Test, Spring 2007 : Episode 6.1

line art
Spring 2007 Description Schedule Resources
line art

Lecture [test 2]: Wednesday, 7 Mar, 13:30-15:30, room 2A14

Subject : Use cases, invariants, pre- and post-conditions, unit testing with JUnit. Slides from 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 will further 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.



Lab Session, Wednesday, March 7

Get acquainted with Eclipse and JUnit. You will be offered assistance to install Eclipse on your own laptop if you want to. At the Lab session you will be given tasks to make sure you understand the necessary parts of Eclipse. If you have time for it, you can start on the exercises for Friday: they are here on Episode 6.2.