Using State Diagrams to Generate Unit Tests for Object-Oriented Systems
Traditionally, finite state machines and their extensions, such as stream X-machines, have been used for modelling and testing of graphical user interfaces (GUI) and for acceptance testing. This paper shows how these testing techniques can be successfully extended to unit test generation for object-oriented systems and integrated into Extreme Programming in a simple and designer-friendly way. The approach has been used by MSc students in Computer Science at the Pitesti University to write JUnit tests for XP projects and the effectiveness of these tests has been compared with that of tests produced using ad-hoc and traditional functional methods. The conclusions show that over 90 % of the faults found by other methods have also been found by the stream X-machine based approach, whereas less than 75 % (in many instances less than half) of the faults uncovered by the stream X-machine based testing have been found by other methods. As the finite state machine based test generation has been automated, the time spent using the two testing strategies was roughly equal.
Keywordsunit testing functional testing state diagrams finite state machines stream X-machines
Unable to display preview. Download preview PDF.
- 3.Jeffries, R., Anderson, A., Hendrickson, C.: Extreme programming installed. Addison-Wesley, Reading (2000)Google Scholar