JUnit

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.


References in zbMATH (referenced in 21 articles , 1 standard article )

Showing results 1 to 20 of 21.
Sorted by year (citations)

1 2 next

  1. Kiniry, Joseph R.; Zimmerman, Daniel M.; Hyland, Ralph: Testing library specifications by verifying conformance tests (2012)
  2. du Bousquet, Lydie; Ledru, Yves; Maury, Olivier; Oriat, Catherine; Lanet, Jean-Louis: Reusing a JML specification dedicated to verification for testing, and vice-versa: Case studies (2010)
  3. Frydrych, Dalibor: Usage of modular scissors in the implementation of FEM. (2010)
  4. Chetali, Boutheina; Nguyen, Quang-Huy: An automated testing experiment for layered embedded C code (2009)
  5. du Bousquet, Lydie; Nakamura, Masahide; Yan, Ben; Igaki, Hiroshi: Using formal methods to increase confidence in a home network system implementation: a case study (2009)
  6. Carlier, Matthieu; Dubois, Catherine: Functional testing in the focal environment (2008)
  7. White, Jules; Schmidt, Douglas C.; Gokhale, Aniruddha: Simplifying autonomic enterprise Java Bean applications via model-driven engineering and simulation (2008)
  8. Dadeau, Frédéric; Ledru, Yves; Du Bousquet, Lydie: Measuring a Java test suite coverage using JML specifications. (2007)
  9. Engel, Christian; Hähnle, Reiner: Generating unit tests from formal proofs (2007)
  10. Heckel, Reiko; Lohmann, Marc: Model-driven development of reactive information systems: from graph transformation rules to JML contracts (2007)
  11. Ledru, Yves; Du Bousquet, Lydie; Dadeau, Frédéric; Allouti, F.: A case study in matching test and proof coverage. (2007)
  12. Simons, Anthony J.H.: Jwalk: a tool for lazy, systematic testing of Java classes by design introspection and user interaction. (2007)
  13. Simons, Anthony J.H.: Jwalk: a tool for lazy, systematic testing of java classes by design introspection and user interaction (2007)
  14. Xie, Tao; Notkin, David: Tool-assisted unit-test generation and selection based on operational abstractions (2006)
  15. Burdy, Lilian; Cheon, Yoonsik; Cok, David R.; Ernst, Michael D.; Kiniry, Joseph R.; Leavens, Gary T.; Leino, K.Rustan M.; Poll, Erik: An overview of JML tools and applications (2005)
  16. Burdy, Lilian; Cheon, Yoonsik; Cok, David R.; Ernst, Michael D.; Kiniry, Joseph R.; Leavens, Gary T.; Leino, K.Rustan M.; Poll, Erik: An overview of JML tools and applications (2005)
  17. Leavens, Gary T.; Cheon, Yoonsik; Clifton, Curtis; Ruby, Clyde; Cok, David R.: How the design of JML accommodates both runtime assertion checking and formal verification (2005)
  18. Xie, Tao; Marinov, Darko; Schulte, Wolfram; Notkin, David: Symstra: A framework for generating object-oriented unit tests using symbolic execution (2005)
  19. Burdy, Lilian; Cheon, Yoonsik; Cok, David R.; Ernst, Michael D.; Kiniry, Joseph; Leavens, Gary T.; Leino, K.Rustan M.; Poll, Erik: An overview of JML tools and applications. (2003)
  20. Barthe, Gilles; Courtieu, Pierre; Dufay, Guillaume; de Sousa, Simão Melo: Tool-assisted specification and verification of the JavaCard platform (2002)

1 2 next