The JML and JUnit Way of Unit Testing and its Implementation

dc.contributor.author Leavens, Gary
dc.contributor.author Cheon, Yoonsik
dc.contributor.department Computer Science
dc.date 2018-02-14T01:00:13.000
dc.date.accessioned 2020-06-30T01:56:50Z
dc.date.available 2020-06-30T01:56:50Z
dc.date.issued 2004-02-01
dc.description.abstract <p>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, Extreme Programming relies on frequent unit testing. 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 code to decide whether tests pass or fail is automatically produced from specifications. Our tool combines this testing code with hand-written test data to execute tests. Therefore, 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. In this paper we describe an implementation 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 testing tools.</p>
dc.description.comments <p>Copyright © 2004, Yoonsik Cheon and Gary T. Leavens</p>
dc.identifier archive/lib.dr.iastate.edu/cs_techreports/341/
dc.identifier.articleid 1348
dc.identifier.contextkey 5542854
dc.identifier.s3bucket isulib-bepress-aws-west
dc.identifier.submissionpath cs_techreports/341
dc.identifier.uri https://dr.lib.iastate.edu/handle/20.500.12876/20173
dc.source.bitstream archive/lib.dr.iastate.edu/cs_techreports/341/TR.pdf|||Fri Jan 14 23:41:37 UTC 2022
dc.subject.disciplines Software Engineering
dc.subject.disciplines Theory and Algorithms
dc.subject.keywords Unit testing
dc.subject.keywords automatic test oracle generation
dc.subject.keywords testing tools
dc.subject.keywords runtime assertion checking
dc.subject.keywords formal methods
dc.subject.keywords programming by contract
dc.subject.keywords JML language
dc.subject.keywords JUnit testing framework
dc.subject.keywords Java language
dc.title The JML and JUnit Way of Unit Testing and its Implementation
dc.type article
dc.type.genre article
dspace.entity.type Publication
relation.isOrgUnitOfPublication f7be4eb9-d1d0-4081-859b-b15cee251456
File
Original bundle
Now showing 1 - 1 of 1
No Thumbnail Available
Name:
TR.pdf
Size:
297.17 KB
Format:
Adobe Portable Document Format
Description:
Collections