Abstract

There exist many automated unit test-generator tools for Java with the primary task of generating test cases, comprised of inputs and a corresponding oracle, each of which is explicitly paired with a specific supporting test implementation. The authors posit that this explicit pairing, or conflating, of test implementation with test case is unnecessary and counter-productive. The authors address this problem by separating the conflated concerns into two distinct tasks: 1) instantiating test implementations and 2) instantiating test cases. This paper focuses on automating the first task in support of the second with the goal of freeing the test engineer to concentrate on test case instantiation. The authors present a new open-source test-preparation tool Obsidian that produces robust, comprehensive, and maintainable unit test implementations. Obsidian, built on the JUnit framework, uses a set of context patterns and associated algorithms combined with information from the Java Reflection API to generate these unit test implementations from Java byte code. These context patterns guide Obsidian to prepare test implementations that guarantee compilation, support exception handling, enable multiple test cases when required, and provide a suitable location for assertions about the test case outcome(s). Obsidian supports regression testing and test-driven development through its novel audits of the testing process.

Highlights

  • The software-process models extreme programming [1] and test-driven development [2] have inspired software test engineers to automate unit-testing tasks

  • This paper focuses on automating the first task in support of the second through the generation of robust and complete test implementations in Java, freeing the test engineer to concentrate on test case instantiation

  • We presented Obsidian as a new testing tool for Java programs that automatically generates comprehensive unit test implementations built on the JUnit 4 framework and guided by a set of four context patterns

Read more

Summary

Introduction

The software-process models extreme programming [1] and test-driven development [2] have inspired software test engineers to automate unit-testing tasks. Obsidian uses the Java Reflection API [4] in concert with a set of context patterns, abstracted from basic method signatures, to generate test implementations from Java byte code. These implementations support multiple test cases consisting of input and outcome data. These data can be generated by hand or by automation and inserted into an Obsidian-prescribed location within the test implementation. A context pattern specifies how to prepare the test implementation to guarantee compilation, support exception handling, enable multiple test cases when required, and provide a suitable location for assertions [5] about the test case outcome(s). As the code base under test evolves, Obsidian can track and report to the user that methods have test implementations and any class attributes that have been introduced since the last execution of Obsidian

Context Patterns
Method Call
Exception Test Case Iterator Pattern
Support for Assertions
Strategies for Generation
Java Reflection API
Method Test Invocation Ordering
Default Object Creation
Object Equality by Indirection
Method Accountability
Field Accountability
Workflow
Background
Conclusions and Future Work
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.