An empirical evaluation of the effectiveness of JML assertions as test oracles

Test oracles remain one of the least understood aspects of the modern testing process. An oracle is a mechanism used by software testers and software engineers for determining whether a test has passed or failed. One widely-supported approach to oracles is the use of runtime assertion checking during the testing activity. Method invariants, preand postconditions help detect bugs during runtime. While assertions are supported by virtually all programming environments, are used widely in practice, and are often assumed to be effective as test oracles, there are few empirical studies of their efficacy in this role. In this thesis, we present the results of an experiment we conducted to help understand this question. To do this, we studied seven of the core Java classes that had been annotated by others with assertions in the Java Modeling Language, used the muJava mutation analysis tool to create mutant implementations of these classes, exercised them with input-only (i.e., no oracle) test suites that achieve branch coverage, and used a machine learning tool, Weka, to determine which annotations were effective at “killing” these mutants. We also evaluate how effective the “null oracle” (in our case, the Java runtime system) is at catching these bugs. The results of our study are interesting, and help provide software engineers with insight into situations in which assertions can be relied upon to find bugs, and situations in which assertions may need to be augmented with other approaches to test oracles.

[1]  David Welch,et al.  An Exception-Based Assertion Mechanism for C++ , 1998, Journal of object-oriented programming.

[2]  R. Lipton,et al.  Mutation analysis , 1998 .

[3]  Richard G. Hamlet,et al.  Automatically Checking an Implementation against Its Formal Specification , 2000, IEEE Trans. Software Eng..

[4]  Ernesto Pimentel,et al.  Design by Contract in Smalltalk , 1996, J. Object Oriented Program..

[5]  Hong Sun,et al.  Investigating the use of analysis contracts to improve the testability of object‐oriented code , 2003, Softw. Pract. Exp..

[6]  Richard G. Hamlet,et al.  Testing Programs with the Aid of a Compiler , 1977, IEEE Transactions on Software Engineering.

[7]  Douglas Hoffman A Taxonomy for Test Oracles , 1998 .

[8]  Stephen H. Edwards,et al.  Experiences evaluating the effectiveness of JML-JUnit testing , 2004, SOEN.

[9]  David Lorge Parnas,et al.  Using Test Oracles Generated from Program Documentation , 1998, IEEE Trans. Software Eng..

[10]  R. Kramer iContract - The Java(tm) Design by Contract(tm) Tool , 1998 .

[11]  Michael D. Ernst,et al.  An overview of JML tools and applications , 2003, International Journal on Software Tools for Technology Transfer.

[12]  A. Jefferson Offutt,et al.  Mutation 2000: uniting the orthogonal , 2001 .

[13]  Leon G. Stucki,et al.  New assertion concepts for self-metric software validation , 1975, Reliable Software.

[14]  M. Young Test Oracles , 2001 .

[15]  Igor D. D. Curcio ASAP—a simple assertion pre-processor , 1998, SIGP.

[16]  A. Jefferson Offutt,et al.  MuJava: an automated class mutation system , 2005, Softw. Test. Verification Reliab..

[17]  Jeanne Marie Hanks Testing Cobol programs by mutation , 1980 .

[18]  Stephen J. Garland,et al.  Larch: Languages and Tools for Formal Specification , 1993, Texts and Monographs in Computer Science.

[19]  David S. Rosenblum,et al.  A historical perspective on runtime assertion checking in software development , 2006, SOEN.

[20]  T.C. Lethbridge,et al.  Guide to the Software Engineering Body of Knowledge (SWEBOK) and the Software Engineering Education Knowledge (SEEK) - a preliminary mapping , 2001, 10th International Workshop on Software Technology and Engineering Practice.

[21]  Karine Arnout,et al.  The .NET Contract Wizard: adding Design by Contract to languages other than Eiffel , 2001, Proceedings 39th International Conference and Exhibition on Technology of Object-Oriented Languages and Systems. TOOLS 39.

[22]  David C. Luckham,et al.  Automatic program verification I: A logical basis and its implementation , 1975, Acta Informatica.

[23]  David S. Rosenblum A Practical Approach to Programming With Assertions , 1995, IEEE Trans. Software Eng..

[24]  David C. Luckham,et al.  An Overview of Anna, a Specification Language for Ada , 1985, IEEE Software.

[25]  Mike A. Marin,et al.  Effective use of assertions in C++ , 1996, SIGP.

[26]  Reinhold Plösch,et al.  Contracts: from analysis to C++ implementation , 1999, Proceedings of Technology of Object-Oriented Languages and Systems - TOOLS 30 (Cat. No.PR00278).

[27]  Nachiappan Nagappan,et al.  Assessing the Relationship between Software Assertions and Faults: An Empirical Investigation , 2006, 2006 17th International Symposium on Software Reliability Engineering.

[28]  Yoonsik Cheon,et al.  A Runtime Assertion Checker for the Java Modeling Language (JML) , 2003, ICSE 2003.

[29]  Luciano Baresi,et al.  An Introduction to Software Testing , 2006, FoVMT.

[30]  Anas N. Al-Rabadi,et al.  A comparison of modified reconstructability analysis and Ashenhurst‐Curtis decomposition of Boolean functions , 2004 .

[31]  A. M. Turing,et al.  Checking a large routine , 1989 .

[32]  A. Jefferson Offutt,et al.  Constraint-Based Automatic Test Data Generation , 1991, IEEE Trans. Software Eng..

[33]  Herman H. Goldstine,et al.  Planning and coding of problems for an Electronic Computing Instrument , 1947 .

[34]  Bertrand Meyer,et al.  Applying 'design by contract' , 1992, Computer.

[35]  Sara Porat,et al.  Class Assertions in C++ , 1995, J. Object Oriented Program..

[36]  Matthias M. Müller,et al.  Two controlled experiments concerning the usefulness of assertions as a means for programming , 2002, International Conference on Software Maintenance, 2002. Proceedings..

[37]  John L. Bruno,et al.  jContractor: A Reflective Java Library to Support Design by Contract , 1999, Reflection.

[38]  Jean-Marc Jézéquel,et al.  Robustness and diagnosability of OO systems designed by contracts , 2001, Proceedings Seventh International Software Metrics Symposium.

[39]  Edward V. Berard,et al.  Testing Object-Oriented Software , 2021, TOOLS.

[40]  Heike Wehrheim,et al.  Jass - Java with Assertions , 2001, RV@CAV.

[41]  Albert L. Baker,et al.  Preliminary design of JML: a behavioral interface specification language for java , 2006, SOEN.

[42]  J. A. McDermid,et al.  Investigating the Effectiveness of Object-Oriented Testing Strategies with the Mutation MethodSun-Woo Kim, John A. Clark *, John A. McDermid , 2001 .

[43]  K. N. King,et al.  A fortran language system for mutation‐based software testing , 1991, Softw. Pract. Exp..

[44]  Lionel C. Briand,et al.  Is mutation an appropriate tool for testing experiments? , 2005, ICSE.

[45]  Pedro Guerreiro Simple support for design by contract in C++ , 2001, Proceedings 39th International Conference and Exhibition on Technology of Object-Oriented Languages and Systems. TOOLS 39.

[46]  Márcio Eduardo Delamaro,et al.  Proteum - A Tool for the Assessment of Test Adequacy for C Programs User's guide , 1996 .

[47]  S. Yau,et al.  Design of self-checking software , 1975, Reliable Software.

[48]  Sérgio Soares,et al.  Implementing Java modeling language contracts with AspectJ , 2008, SAC '08.

[49]  Barry W. Boehm,et al.  Some experience with automated aids to the design of large-scale reliable software , 1975, IEEE Transactions on Software Engineering.

[50]  Francis C. M. Lau,et al.  Testing object-oriented industrial software without precise oracles or results , 2007, CACM.

[51]  Robert W. Floyd,et al.  Assigning meaning to programs , 1967 .

[52]  A. Jefferson Offutt,et al.  Inter-class mutation operators for Java , 2002, 13th International Symposium on Software Reliability Engineering, 2002. Proceedings..

[53]  Richard J. Lipton,et al.  Hints on Test Data Selection: Help for the Practicing Programmer , 1978, Computer.

[54]  Andrew Duncan,et al.  Adding Contracts to Java with Handshake , 1998 .

[55]  Steven P. Reiss,et al.  CCEL: A Metalanguage for C++ , 1992, C++ Conference.

[56]  John A. Clark,et al.  Investigating the effectiveness of object‐oriented testing strategies using the mutation method , 2001 .

[57]  David Chenho Kung,et al.  Testing Object-Oriented Software , 1998 .

[58]  Ian H. Witten,et al.  Weka: Practical machine learning tools and techniques with Java implementations , 1999 .

[59]  J. Offutt,et al.  Mutation testing implements grammar-based testing , 2006, Second Workshop on Mutation Analysis (Mutation 2006 - ISSRE Workshops 2006).

[60]  Gregg Rothermel,et al.  An experimental determination of sufficient mutant operators , 1996, TSEM.

[61]  J. Ross Quinlan,et al.  C4.5: Programs for Machine Learning , 1992 .

[62]  Jeffrey M. Voas,et al.  Putting assertions in their place , 1994, Proceedings of 1994 IEEE International Symposium on Software Reliability Engineering.

[63]  Hong Zhu,et al.  Software unit test coverage and adequacy , 1997, ACM Comput. Surv..