Combining Multiple Coverage Criteria in Search-Based Unit Test Generation

  • José Miguel Rojas
  • José Campos
  • Mattia Vivanti
  • Gordon Fraser
  • Andrea Arcuri
Conference paper

DOI: 10.1007/978-3-319-22183-0_7

Part of the Lecture Notes in Computer Science book series (LNCS, volume 9275)
Cite this paper as:
Rojas J.M., Campos J., Vivanti M., Fraser G., Arcuri A. (2015) Combining Multiple Coverage Criteria in Search-Based Unit Test Generation. In: Barros M., Labiche Y. (eds) Search-Based Software Engineering. SSBSE 2015. Lecture Notes in Computer Science, vol 9275. Springer, Cham

Abstract

Automated test generation techniques typically aim at maximising coverage of well-established structural criteria such as statement or branch coverage. In practice, generating tests only for one specific criterion may not be sufficient when testing object oriented classes, as standard structural coverage criteria do not fully capture the properties developers may desire of their unit test suites. For example, covering a large number of statements could be easily achieved by just calling the main method of a class; yet, a good unit test suite would consist of smaller unit tests invoking individual methods, and checking return values and states with test assertions. There are several different properties that test suites should exhibit, and a search-based test generator could easily be extended with additional fitness functions to capture these properties.

However, does search-based testing scale to combinations of multiple criteria, and what is the effect on the size and coverage of the resulting test suites? To answer these questions, we extended the EvoSuite unit test generation tool to support combinations of multiple test criteria, defined and implemented several different criteria, and applied combinations of criteria to a sample of 650 open source Java classes. Our experiments suggest that optimising for several criteria at the same time is feasible without increasing computational costs: When combining nine different criteria, we observed an average decrease of only 0.4 % for the constituent coverage criteria, while the test suites may grow up to 70 %.

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  • José Miguel Rojas
    • 1
  • José Campos
    • 1
  • Mattia Vivanti
    • 2
  • Gordon Fraser
    • 1
  • Andrea Arcuri
    • 3
    • 4
  1. 1.Department of Computer ScienceThe University of SheffieldSheffieldUK
  2. 2.Università Della Svizzera Italiana (USI)LuganoSwitzerland
  3. 3.ScientaOsloNorway
  4. 4.University of LuxembourgLuxembourg CityLuxembourg

Personalised recommendations