swMATH ID: 7262
Software Authors: Cheon, Yoonsik; Leavens, Gary T.
Description: A simple and practical approach to unit testing: The JML and JUnit way. Writing unit test code is labor-intensive, hence it is often not done as an integral part of programming. However, unit testing is a practical approach to increasing the correctness and quality of software; for example, the Extreme Programming approach relies on frequent unit testing. par In this paper we present a new approach that makes writing unit tests easier. It uses a formal specification language’s runtime assertion checker to decide whether methods are working correctly, thus automating the writing of unit test oracles. These oracles can be easily combined with hand-written test data. Instead of writing testing code, the programmer writes formal specifications (e.g., pre- and postconditions). This makes the programmer’s task easier, because specifications are more concise and abstract than the equivalent test code, and hence more readable and maintainable. Furthermore, by using specifications in testing, specification errors are quickly discovered, so the specifications are more likely to provide useful documentation and inputs to other tools. We have implemented this idea using the Java Modeling Language (JML) and the JUnit testing framework, but the approach could be easily implemented with other combinations of formal specification languages and unit test tools.
Homepage: http://junit.org/
Related Software: JML; Eiffel; ESC/Java; Korat; Spec#; KeY; KRAKATOA; SIMPLIFY; Rostra; Daikon; Symstra; LARCH; Defects4J; GitHub; Java PathFinder; Jass; JCrasher; TestEra; MARCA; HyperStar
Cited in: 16 Documents

Citations by Year