Regression Mutation Testing

Regression Mutation Testing

Regression Mutation Testing Lingming Zhang1, Darko Marinov2, Lu Zhang3, Sarfraz Khurshid1 1Electrical and Computer Engineering, University of Texas at Austin, USA [email protected], [email protected] 2Department of Computer Science, University of Illinois, Urbana, IL 61801, USA [email protected] 3Key Laboratory of High Confidence Software Technologies (Peking University), MoE, China [email protected] ABSTRACT The more mutants the test suite can kill, the more effective the test Mutation testing is one of the most powerful approaches for eval- suite is considered to be. uating quality of test suites. However, mutation testing is also one Mutation testing is often viewed as the strongest test criterion in of the most expensive testing approaches. This paper presents Re- terms of characterizing high-quality test suites [3,13]. Researchers gression Mutation Testing (ReMT), a new technique to speed up have used mutation testing in numerous studies on software testing; mutation testing for evolving systems. The key novelty of ReMT see a recent survey by Jia and Harman [20]. Some studies have is to incrementally calculate mutation testing results for the new even shown that mutation testing can be more suitable than manual program version based on the results from the old program ver- fault seeding in simulating real program faults for software testing sion; ReMT uses a static analysis to check which results can be experimentation [4, 12]. safely reused. ReMT also employs a mutation-specific test prioriti- However, despite the potential mutation testing holds for soft- zation to further speed up mutation testing. We present an empirical ware testing, it primarily remains confined to research settings. One study on six evolving systems, whose sizes range from 3.9KLoC to of the main reasons is the costly analysis that underlies the method- 88.8KLoC. The empirical results show that ReMT can substantially ology: the requirement to execute many tests against many mutants. reduce mutation testing costs, indicating a promising future for ap- A number of techniques aim to scale mutation testing, for example, plying mutation testing on evolving software systems. by selecting a subset of mutants to generate instead of generating all of them [28,31,41,45], by partially executing mutants to determine whether a test (weakly) kills a mutant [19, 42], and by executing Categories and Subject Descriptors some mutants in parallel [23, 26, 33]. While these techniques are D2.5 [Software Engineering]: Testing and Debugging able to reduce some cost of mutation testing, it still remains one of the most costly software testing methodologies. Our key insight is that we can amortize this high cost of mutation General Terms testing in the context of software systems that undergo evolution Algorithms, Experimentation by incrementally updating the results for successive applications of mutation testing. Real software systems undergo a number of revi- sions to implement bug fixes, add new features, or refactor existing Keywords code. An application of existing mutation testing techniques to an Regression Mutation Testing, Mutation Testing, Regression Test- evolving system would require repeated, independent applications ing, Software Evolution, Static Analysis of the technique to each software version, inducing expensive costs for every version. Our approach utilizes the mutation testing results on a previous version to speed up the mutation testing for a subse- 1. INTRODUCTION quent version. Our approach opens a new direction for reducing the Mutation testing [9, 15, 39, 45] is a methodology for assessing cost of mutation testing; it is orthogonal to the previous techniques quality of test suites. The process of mutation testing has two ba- for optimizing mutation testing, and it is applicable together with sic steps. One, generate desired variants (known as mutants)of these previous techniques. the original program under test through small syntactic transfor- This paper presents Regression Mutation Testing (ReMT), a novel mations. Two, execute the generated mutants against a test suite technique that embodies our insight. ReMT identifies mutant-test to check whether the test suite can distinguish the behavior of the pairs whose execution results (i.e., whether the test killed the mu- mutants from the original program (known as killing the mutants). tant or not) on the current software version can be reused from the previous version without re-executing the test on the mutant. ReMT builds on the ideas from regression test selection techniques that traverse control flow graphs of two program versions to identify the Permission to make digital or hard copies of all or part of this work for set of dangerous edges which may lead to different test behaviors in personal or classroom use is granted without fee provided that copies are the new program version [17,34,37]. More precisely, ReMT reuses not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to a mutant-test result if (1) the execution of the test does not cover a republish, to post on servers or to redistribute to lists, requires prior specific dangerous edge before it reaches the mutated statement for the first permission and/or a fee. time and (2) the execution of the test cannot reach a dangerous edge ISSTA ’12, July 15-20, 2012, Minneapolis, MN, USA after executing the mutated statement. ReMT determines (1) with Copyright 12 ACM 978-1-4503-1454-1/12/07 ...$10.00. dynamic coverage and determines (2) with a novel static analysis may in the limit be full, having no cell as U. However, our ReMT for dangerous-edge reachability based on Context-Free-Language technique does not require such full matrices. Indeed, to compute (CFL) reachability. the mutation score for a given program, for each mutant m,itsuf- As an additional optimization to our core ReMT technique, we fices that the matrix has (1) at least one cell as K (while others can introduce Mutation-specific Test Prioritization (MTP). For each mu- be E, N,orevenU), or (2) all cells as E or N (indicating that the test tant, MTP reorders the tests that need to be executed based on their suite T does not kill m). effectiveness in killing that mutant on previous versions and their Some existing mutation testing tools, such as Javalanche [39] coverage of the mutated statement. Combining ReMT with MTP and Proteum [7], support two mutation testing scenarios: (1) par- can further reduce the time to kill the mutants. tial mutation testing – where a mutant is only run until it is killed Specifically, this paper makes the following contributions: and thus the matrix may have some U cells; and (2) full mutation testing – where a mutant is run against each test and thus the mutant • Regression Mutation Testing. We introduce the idea of execution matrix has no U cells. Our ReMT technique is applicable unifying regression testing with mutation testing—two well- for both scenarios. researched methodologies that previous work has explored independently—to make mutation testing of evolving sys- 2.2 Regression Testing tems more efficient. A key problem studied in regression testing is Regression Test • Technique. We develop a core technique for regression mu- Selection (RTS): determine how changes between program ver- tation testing (ReMT) using dangerous-edge reachability anal- sions influence regression tests and select to run only tests that are ysis based on CFL reachability. related to changes. RTS techniques [17, 34, 37] commonly use the control-flow graph (CFG) and its extended forms, e.g., the Java • Optimization. We introduce the idea of mutation-specific Interclass Graph [17], to represent program versions and analyze test prioritization (MTP) and present an MTP technique to them. A typical RTS technique first traverses CFGs of two pro- optimize our core ReMT technique. gram versions using depth-first search (DFS) to identify the set of dangerous edges, EΔ, i.e., the edges which may cause the program • Implementation. We implement ReMT and MTP on top behavior to change in the new program version. Then, for each test of Javalanche [39], a recent mutation testing tool for Java t in the regression test suite, the technique matches its coverage in- programs with JUnit test suites. formation on the old version with the set of dangerous edges EΔ to • Evaluation. We present an empirical study on version repos- determine whether t could be influenced by the dangerous edges. itories of six open-source Java programs between 3.9KLoC Following previous work [17, 34], we consider RTS techniques and 88.8KLoC. The results show that ReMT substantially re- that use inter-procedural CFGs: duce the costs of mutation testing on evolving systems. DEFINITION 2.2. An inter-procedural CFG of a program is a directed graph, N, E,whereN is the set of CFG nodes, and 2. PRELIMINARIES E : N × N is the set of CFG edges. This section describes some core concepts in mutation testing Each inter-procedural CFG has several intra-procedural CFGs: (Section 2.1) and regression testing (Section 2.2). It also provides some basic definitions that we use to present our Regression Muta- DEFINITION 2.3. An intra-procedural CFG within an inter- tion Testing (Section 2.3). procedural CFG N,E is a subgraph Ni,Ei,whereNi ⊆ N and Ei ⊆ E denote edges that start from nodes in Ni. Each intra- 2.1 Mutation Testing procedural CFG has a unique entry node and a unique exit node. Mutation testing, first proposed by DeMillo et al. [9] and Ham- Note that Ei includes edges that are method invocation edges con- let [15], is a fault-based testing methodology that is effective for necting invocation nodes in Ni with entry nodes of other intra- evaluating and improving the quality of test suites.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us