ABSTRACT
Coding against interfaces is a powerful technique in object-oriented programming. It decouples code and enables independent development. However, code decoupled via interfaces poses additional challenges for testing and dynamic execution, as not all pieces of code that are necessary to execute a piece of code may be available. For example, a client class may be coded against several interfaces. For testing, however, no classes may be available that implement the interfaces. This means that, to support testing, we need to generate mock classes along with test cases. Current test case generators do not fully support this kind of independent development and testing.
In this paper, we describe a novel technique for generating test cases and mock classes for object-oriented programs that are coded against interfaces. We report on our initial experience with an implementation of our technique for Java. Our prototype implementation achieved higher code coverage than related tools that do not generate mock classes, such as Pex.
- }}C. Cadar, V. Ganesh, P. M. Pawlowski, D. L. Dill, and D. R. Engler. Exe: Automatically generating inputs of death. In Proc. 13th ACM Conference on Computer and Communications Security (CCS), pages 322--335. ACM, Oct. 2006. Google ScholarDigital Library
- }}C. Csallner and Y. Smaragdakis. JCrasher: An automatic robustness tester for Java. Software---Practice & Experience, 34(11):1025--1050, Sept. 2004. Google ScholarDigital Library
- }}C. Csallner and Y. Smaragdakis. Check 'n' Crash: Combining static checking and testing. In Proc. 27th ACM/IEEE International Conference on Software Engineering (ICSE), pages 422--431. ACM, May 2005. Google ScholarDigital Library
- }}P. Godefroid, N. Klarlund, and K. Sen. Dart: Directed automated random testing. In Proc. ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 213--223. ACM, June 2005. Google ScholarDigital Library
- }}J. Gosling, B. Joy, G. L. Steele, and G. Bracha. The Java Language Specification. Prentice Hall, third edition, June 2005.Google Scholar
- }}J. C. King. Symbolic execution and program testing. Communications of the ACM, 19(7):385--394, 1976. Google ScholarDigital Library
- }}Microsoft Corporation. Unit Testing with Microsoft Moles, Mar. 2010. http://research.microsoft.com/enus/projects/pex/molestutorial.pdf.Google Scholar
- }}L. d. Moura and N. Bjørner. Z3: An efficient SMT solver. In Proc. 14th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS), pages 337--340. Springer, Apr. 2008. Google ScholarDigital Library
- }}D. L. Parnas. On the criteria to be used in decomposing systems into modules. Communications of the ACM, 15(12):1053--1058, Dec. 1972. Google ScholarDigital Library
- }}N. Tillmann and J. de Halleux. Pex - white box test generation for .Net. In Proc. 2nd International Conference on Tests And Proofs (TAP), pages 134--153. Springer, Apr. 2008. Google ScholarDigital Library
Index Terms
- Dsc+Mock: a test case + mock class generator in support of coding against interfaces
Recommendations
Generating Test Cases for Programs that Are Coded against Interfaces and Annotations
Automatic test case generation for software programs is very powerful but suffers from a key limitation. That is, most current test case generation techniques fail to cover testee code when covering that code requires additional pieces of code not yet ...
Achieving scalable mutation-based generation of whole test suites
Without complete formal specification, automatically generated software tests need to be manually checked in order to detect faults. This makes it desirable to produce the strongest possible test set while keeping the number of tests as small as ...
Experience report: how is dynamic symbolic execution different from manual testing? a study on KLEE
ISSTA 2015: Proceedings of the 2015 International Symposium on Software Testing and AnalysisSoftware testing has been the major approach to software quality assurance for decades, but it typically involves intensive manual efforts. To reduce manual efforts, researchers have proposed numerous approaches to automate test-case generation, which ...
Comments