JMLAutoTest: A Novel Automated Testing Framework Based on JML and JUnit


Writing specifications using Java Modeling Language has been accepted for a long time as a practical approach to increasing the correctness and quality of Java programs. However, the current JML testing system (the JML and JUnit framework) can only generate skeletons of test fixture and test case class. Writing codes for generating test cases, especially those with a complicated data structure is still a labor-intensive job in the test for programs annotated with JML specifications. This paper presents JMLAutoTest, a novel framework for automated testing of Java programs annotated with JML specifications. Firstly, given a method, three test classes (a skeleton of test client class, a JUnit test class and a test case class) can be generated. Secondly, JMLAutoTest can generate all nonisomorphic test cases that satisfy the requirements defined in the test client class. Thirdly, JMLAutoTest can avoid most meaningless cases by running the test in a double-phase way which saves much time of exploring meaningless cases in the test. This method can be adopted in the testing not only for Java programs, but also for programs written with other languages. Finally, JMLAutoTest executes the method and uses JML runtime assertion checker to decide whether its post-condition is violated. That is whether the method works correctly.

DOI: 10.1007/978-3-540-24617-6_6

Extracted Key Phrases

4 Figures and Tables

Cite this paper

@inproceedings{Xu2003JMLAutoTestAN, title={JMLAutoTest: A Novel Automated Testing Framework Based on JML and JUnit}, author={Guoqing Xu and Zongyuang Yang}, booktitle={FATES}, year={2003} }