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 20 articles , 1 standard article )

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

  1. Ahrendt, Wolfgang; Chimento, Jesús Mauricio; Pace, Gordon J.; Schneider, Gerardo: Verifying data- and control-oriented properties combining static and runtime verification: theory and tools (2017)
  2. Kiniry, Joseph R.; Zimmerman, Daniel M.; Hyland, Ralph: Testing library specifications by verifying conformance tests (2012) ioport
  3. 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) ioport
  4. Frydrych, Dalibor: Usage of modular scissors in the implementation of FEM. (2010)
  5. Chetali, Boutheina; Nguyen, Quang-Huy: An automated testing experiment for layered embedded C code (2009) ioport
  6. 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) ioport
  7. Carlier, Matthieu; Dubois, Catherine: Functional testing in the focal environment (2008)
  8. White, Jules; Schmidt, Douglas C.; Gokhale, Aniruddha: Simplifying autonomic enterprise Java Bean applications via model-driven engineering and simulation (2008) ioport
  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) ioport
  11. Simons, Anthony J.H.: Jwalk: a tool for lazy, systematic testing of java classes by design introspection and user interaction (2007) ioport
  12. Simons, Anthony J.H.: Jwalk: a tool for lazy, systematic testing of Java classes by design introspection and user interaction. (2007) ioport
  13. Xie, Tao; Notkin, David: Tool-assisted unit-test generation and selection based on operational abstractions (2006) ioport
  14. 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) ioport
  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) ioport
  16. 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)
  17. Xie, Tao; Marinov, Darko; Schulte, Wolfram; Notkin, David: Symstra: A framework for generating object-oriented unit tests using symbolic execution (2005)
  18. Barthe, Gilles; Courtieu, Pierre; Dufay, Guillaume; de Sousa, Simão Melo: Tool-assisted specification and verification of the JavaCard platform (2002) ioport
  19. Cheon, Yoonsik; Leavens, Gary T.: A simple and practical approach to unit testing: The JML and JUnit way (2002)
  20. Hightower, Richard: Applying XP tools to J2EE for the extreme programming universe (2002)