skip to main content
10.1145/1868321.1868326acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
research-article

Dsc+Mock: a test case + mock class generator in support of coding against interfaces

Published:12 July 2010Publication History

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.

References

  1. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}C. Csallner and Y. Smaragdakis. JCrasher: An automatic robustness tester for Java. Software---Practice & Experience, 34(11):1025--1050, Sept. 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}J. Gosling, B. Joy, G. L. Steele, and G. Bracha. The Java Language Specification. Prentice Hall, third edition, June 2005.Google ScholarGoogle Scholar
  6. }}J. C. King. Symbolic execution and program testing. Communications of the ACM, 19(7):385--394, 1976. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}Microsoft Corporation. Unit Testing with Microsoft Moles, Mar. 2010. http://research.microsoft.com/enus/projects/pex/molestutorial.pdf.Google ScholarGoogle Scholar
  8. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Dsc+Mock: a test case + mock class generator in support of coding against interfaces

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in
              • Published in

                cover image ACM Conferences
                WODA '10: Proceedings of the Eighth International Workshop on Dynamic Analysis
                July 2010
                43 pages
                ISBN:9781450301374
                DOI:10.1145/1868321

                Copyright © 2010 ACM

                Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 12 July 2010

                Permissions

                Request permissions about this article.

                Request Permissions

                Check for updates

                Qualifiers

                • research-article

                Upcoming Conference

                ICSE 2025

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader