- Research Article
2
- 10.1002/stvr.1582
Introduction to the special issue on Mutation Testing
- Aug 01, 2015
- Software Testing, Verification and Reliability
- Yue Jia + 2 more +2
Introduction to the special issue on Mutation Testing
Mutation testing is a means of creating more effective test cases. Mutation testing is primarily used as a program-based technique. It uses mutation operations to mutate the program and generate program mutants. The mutation testing aims at generating a test set that its behavior is different from the original program. More formally, the goal in mutation testing is killing the generated mutants by causing the mutant to have different behavior from the original program on the same input data. In this testing method mutation score is the proportion of the dead mutants to the total number of non-equivalent mutants. This paper focuses on using structural complexity of the program in calculating the mutation score. The proposed approach selects some object-oriented metrics which reflect the complexity of features that mutation operators are applied to them in the program. It calculates the total mutation score of the program in terms of mutation scores of different mutation operators and the structural complexity of the program. In the proposed approach, the normalized values of the selected object-oriented metrics are used as weights of different mutation scores of the program. Finally, the total mutation score of the program is estimated in terms of weighted mutation scores of the program. If the program is a concurrent one, the mutation score of the concurrency mutation operators is also considered in calculating the total mutation score.
Introduction to the special issue on Mutation Testing
Introduction to the special issue on Mutation Testing
Control Oriented Mutation Testing for Detection of Potential Software Bugs
An effective test case suite is one that has the potential to reveal real faults in the code. Mutation testing is a fault-based technique that helps measure the strength of test case set and to generate effective test cases. Faults are injected through pre-defined mutation operators and mutation score is a mean to calculate usefulness of test case set. Mutation testing approach suffers from two of its inherent issues, it is computationally expensive, second generation of equivalent mutants. Along with original program, every mutant has to be executed against all the test cases. An equivalent mutant always produces same output on original and mutant program for every possible test case. Program's behavior comprises of two kinds of information, control flow and data flow. Mutation testing techniques that have been proposed so far consider only data flow information and they ignore the importance of flow of control within the program. In this paper we propose a new approach that encourages using control flow information along with data flow information in mutation testing for detection of bugs. Bugs can hide themselves within equivalent mutants and in these scenarios control flow information can be quite useful to uncover them. Experiments show that using control flow information can help revealing potential bugs in the program.
Read moreAnalyzing the effectiveness of One-Op Mutation against the minimal set of mutants
Mutation testing is a fault-based criterion that helps testers to evaluate the adequacy of a test set applied to a given program. In order to do that, mutation operators are applied to the software being tested, creating versions with few syntactic deviations from the original program, called mutants. The choice of mutation operator plays an important role when applying mutation testing regarding the test case design and cost analysis. However, some generated mutants are considered as redundant and may be considered unnecessary during mutation testing. This paper addresses this topic and investigates the effectiveness of test suites designed to kill mutants of a specific operator to kill mutants that belong to the minimal set of mutants. We performed an experimental evaluation using a set of 39 programs written in C language. Guided by previous studies, we evaluated the effectiveness of deletion operators, and due to the results, we extended our investigation to all mutant operators. Concerning deletion operators, the results showed that even combining deletion operators, the best mutation score achieved was, on average, 0.460 using the SODL (SSDL + OODL) operator. The following analyses showed that the VDTR operator performed better than the deletion operators both in terms of mutation score and in terms of cost, proving to be the best approach to design test cases that have a higher impact on killing mutants that belong to the minimal set of mutants.
Read moreAn Evolutionary Mutation Testing System for Java Programs: eMuJava
Mutation-based testing is costly but we can bring it down with combination of evolutionary testing approaches. Search-based mutation testing combines mutation and evolutionary testing to exploit the advantages offered by both of these techniques. The evolutionary techniques like genetic algorithm supports automating the test case generation during software testing that can reduce a lot of testing resources. The processes of mutation testing can also be automated to further save the testing cost. In this research, we present a testing tool, eMuJava that can perform mutation-based testing of Java-based programs automatically. eMuJava is fully automated system that performs all the activities of mutation testing and test case generation automatically. For mutation testing, it supports conventional as well as object-oriented mutation operators. eMuJava is implementing four testing techniques including three different genetic algorithms and random testing. The system offers complete control to the tester to perform testing of Java programs, allows monitoring of all the steps that tool performs, and all intermediary outputs that the tool generates. We have evaluated the tool by performing extensive experiments on Java programs. The outcomes of an experiment include test case set, mutation score, and statistical information about the experiment. We have also statistically evaluated the experimental results to prove their effectiveness. The generated test cases are further analyzed on different set of mutation operators to evaluate their strength.
Read moreComparing Mutation Testing at the Levels of Source Code and Compiler Intermediate Representation
Mutation testing is widely used in research for evaluating the effectiveness of test suites. There are multiple mutation tools that perform mutation at different levels, including traditional mutation testing at the level of source code (SRC) and more recent mutation testing at the level of compiler intermediate representation (IR). This paper presents an extensive comparison of mutation testing at the SRC and IR levels, specifically at the C programming language and the LLVM compiler IR levels. We use a mutation testing tool called SRCIROR that implements conceptually the same mutation operators at both levels. We also employ automated techniques to account for equivalent and duplicated mutants, and to determine minimal and surface mutants. We carry out our study on 15 programs from the Coreutils library. Overall, we find mutation testing to be better at the SRC level: the SRC level produces much fewer mutants and is thus less expensive, but the SRC level still generates a similar number of minimal and surface mutants, and the mutation scores at both levels are very closely correlated. We also perform a case study on the Space program to evaluate which level's mutation score correlates better with the actual fault-detection capability of test suites sampled from Space's test pool. We find the mutation score at both levels to not be very correlated with the actual fault-detection capability of test suites.
Read moreToward Improving the Quality of Mutation Operator and Test Case Effectiveness in Higher-Order Mutation Testing
Currently, there are many research studies that apply and improve mutation testing techniques including traditional mutation testing or first-order mutation testing, and higher-order mutation testing (HOMT) for evaluating the quality of the set of test data in particular, and the quality of test suites in general. The results of those studies have proven the effectiveness of mutation testing in the field of software testing. Mutation testing allows the quality of test cases to be automatically evaluated, thereby helping the testers to improve the quality in the design and execution of the software testing. Besides, these studies have also pointed out the main barriers in applying mutation testing techniques in practice. However, we are the first to introduce a method that can reduce the cost, but keep the quality of testing activity based on evaluating the quality of the mutation operator as well as the quality of the test cases. In this paper, we concentrate on two problems regarding higher-order mutation testing: Evaluating the quality of mutation operators as well as generated mutants and prioritizing test cases based upon its capability of killing mutants. This may help developers allocate suitably their resources during testing phase. The study of this paper is an extended version of our previous study titled “Evaluating Mutation Operator and Test Case Effectiveness by Means of Mutation Testing”, which is published in the proceedings of the 13th Asian Conference on Intelligent Information and Database Systems, ACIIDS 2021 (V. N. Do, Q. V. Nguyen and T. B. Nguyen, Evaluating Mutation Operator and Test Case Effectiveness by Means of Mutation Testing, in Intelligent Information and Database Systems. ACIIDS 2021, eds. N. T. Nguyen, S. Chittayasothorn, D. Niyato and B. Trawiński. Lecture Notes in Computer Science, Vol. 12672 (Springer, Cham), https://doi.org/10.1007/978-3-030-73280-6_66 ) to confirm the usefulness of our proposed method.
Read moreLightweight Assessment of Test-Case Effectiveness Using Source-Code-Quality Indicators
Test cases are crucial to help developers preventing the introduction of software faults. Unfortunately, not all the tests are properly designed or can effectively capture faults in production code. Some measures have been defined to assess test-case effectiveness: the most relevant one is the mutation score, which highlights the quality of a test by generating the so-called mutants, i.e., variations of the production code that make it faulty and that the test is supposed to identify. However, previous studies revealed that mutation analysis is extremely costly and hard to use in practice. The approaches proposed by researchers so far have not been able to provide practical gains in terms of mutation testing efficiency. This leaves the problem of efficiently assessing test-case effectiveness as still open. In this paper, we investigate a novel, orthogonal, and lightweight methodology to assess test-case effectiveness: in particular, we study the feasibility to exploit production and test-code-quality indicators to estimate the mutation score of a test case. We first select a set of 67 factors and study their relation with test-case effectiveness. Then, we devise a mutation score estimation model exploiting such factors and investigate its performance as well as its most relevant features. The key results of the study reveal that our estimation model only based on static features has 86 percent of both F-Measure and AUC-ROC. This means that we can estimate the test-case effectiveness, using source-code-quality indicators, with high accuracy and without executing the tests. As a consequence, we can provide a practical approach that is beyond the typical limitations of current mutation testing techniques.
Read moreInvestigation on Java Mutation Testing Tools
Software Testing is one of the most significant phases within the software development life cycle since software bugs can be costly and traumatic. However, the traditional software testing process is not enough on its own as some undiscovered faults might still exist due to the test cases’ inability to detect all underlying faults. Amidst the various proposed techniques of test suites’ efficiency detection comes mutation testing, one of the most effective approaches as declared by many researchers. Nevertheless, there is not enough research on how well the mutation testing tools adhere to the theory of mutation or how well their mutation operators are performing the tasks they were developed for. This research paper presents an investigative study on two different mutation testing tools for Java programming language, namely PIT and µJava. The study aims to point out the weaknesses and strengths of each tool involved through performing mutation testing on four different open-source Java programs to identify the best mutation tool among them. The study aims to further identify and compare the mutation operators of each tool by calculating the mutation score. That is, the operators’ performance is evaluated with the mutation score, with the presumption that the more prominent the number of killed mutants is, the higher the mutation score, thus the more effective the mutation operator and the affiliated tool.Â
Read moreMemory mutation testing
Memory mutation testing
The application perspective of mutatoin testing
The main goal of this thesis is to investigate, improve and extend the applicability of mutation testing. To seek the potential directions of how to improve and extend the applicability of mutation testing, we have started with a systematic literature review on the current state of how mutation testing is applied. The results from the systematic literature review have further guided us towards three directions of research: (1) speeding up mutation testing; (2) deepening our understanding ofmutation testing; (3) exploring new application domains ofmutation testing. For the first direction, we have leveraged compression techniques and weak mutation information to speed up mutation testing. The results have shown our proposed mutant compression techniques can effectively speed up strong mutation testing up to 94.3 times with an accuracy > 90%. Given the second direction, we are interested in gaining a better understanding of mutation testing especially in the situation where engineers cannot kill all the mutants by just adding test cases. We have investigated the relationships between code quality regarding the testability and observability, and the mutation score. We have observed a correlation between observability metrics and the mutation score. Furthermore, relatively simple refactoring operations/adding tests enable an increase in the mutation score. As for the third direction, we have explored two new application domains: one is physical computing, and the other is GPU programming. In both application domains, we have designed new mutation operators based on our observations of the common mistakes that could happen during the implementation of the software. We have found promising results in that mutation testing can help in revealing weaknesses of the test suite for both application domains. In summary, we have improved the applicability of mutation by proposing a new speed-up approach and investigating the relationship between testability/observability and mutation testing. Also, we have extended the applicability of mutation testing in physical computing and GPU programming domains.
Read moreMutation testing meets approximate computing
One of the most widely studied techniques in software testing research is mutation testing - a technique for evaluating the quality of test suites. Despite over four decades of academic advances in this technique, mutation testing has not found its way to mainstream development. The key issue with mutation testing is its high computational cost: it requires running the test suite against not just the program under test but against typically thousands of mutants, i.e., syntactic variants, of the program. Our key insight is that exciting advances in the upcoming, yet unrelated, area of approximate computing allow us to define a principled approach that provides the benefits of traditional mutation testing at a fraction of its usually large cost.This paper introduces the idea of a novel approach, named ApproxiMut, that blends the power of mutation testing with the practicality of approximate computing. To demonstrate the potential of our approach, we present a concrete instantiation: rather than executing tests against each mutant on the exact program version, ApproxiMut obtains an approximate test/program version by applying approximate transformations and runs tests against each mutant on the approximated version. Our initial goal is to (1) measure the correlation between mutation scores on the exact and approximate program versions, (2) evaluate the relation among mutation operators and approximate transformations, (3) discover the best way to approximate a test and a program, and (4) evaluate the benefits of ApproxiMut. Our preliminary results show similar mutation scores on the exact and approximate program versions and uncovered a case when an approximated test was, to our surprise, better than the exact test.
Read moreA comparison of database fault detection capabilities using mutation testing
Mutation testing involves systematically generating and introducing faults into an application to improve testing. A quasi-experimental study is reported comparing the fault-detection capabilities of real-world database application test suites to those of an SQL vendor test suite (NIST SQL) based on mutation scores. The higher the mutation score the more successful the test suite will be at detecting faults. The SQLMutation tool was used to generate query mutants from beginner-level sample schemas obtained from three popular real-world database test suite vendors -- MySQL, SQL Server, and Oracle. Four SQLMutation operators were applied to both real-world and NIST SQL vendor compliance test suites - SQL Clause (SC), Operator Replacement (OR), NULL (NL) and Identifier Replacement (IR). Two mutation operators, SC and NL generated significantly lower mutation scores in real-world test suites than for those in the vendor test suite. The IR operator generated significantly higher mutation scores in real-world test suites than for those in the vendor test suite. The OR operator produced roughly the same mutation scores in both the real-world and vendor test suites.
Read moreHow to kill them all: An exploratory study on the impact of code observability on mutation testing
Mutation testing is well-known for its efficacy in assessing test quality, and starting to be applied in the industry. However, what should a developer do when confronted with a low mutation score? Should the test suite be plainly reinforced to increase the mutation score, or should the production code be improved as well, to make the creation of better tests possible? In this paper, we aim to provide a new perspective to developers that enables them to understand and reason about the mutation score in the light of testability and observability. First, we investigate whether testability and observability metrics are correlated with the mutation score on six open-source Java projects. We observe a correlation between observability metrics and the mutation score, e.g., test directness, which measures the extent to which the production code is tested directly, seems to be an essential factor. Based on our insights from the correlation study, we propose a number of ”mutation score anti-patterns”, enabling software engineers to refactor their existing code or add tests to improve the mutation score. In doing so, we observe that relatively simple refactoring operations enable an improvement or increase in the mutation score.
Read moreA Comparative Evaluation of Transformers in Seq2Seq Code Mutation: Non-Pre-trained Vs. Pre-trained Variants
Mutation testing (MT) is a gold standard way to assess the efficacy of software test suites. However, the accuracy of mutation score is affected by the presence of trivial mutants which can be “killed” by even the simplest and most basic test suites. Since the existence of trivial mutants is due to the fixed set of mutation operators that constraints the complexity of code mutations, state-of-the-art recurrent neural network (RNN) model is used for sequence-to-sequence (seq2seq) code mutation without relying on mutation operators. However, the quality of the produced mutants is affected by the limitation of RNN in interpreting the relationships between far-apart tokens of the code to be mutated. Transformers that do not have this limitation, have superseded RNN in seq2seq machine translation domains such as natural language processing (NLP). However, to the best of our knowledge, there is still no research that investigates the performance of transformers in seq2seq code mutation. This paper presents a comparison study that involves different variants of the non-pre-trained transformers, the transformers pre-trained with source code, the transformers pre-trained with natural language, and the state-of-the-art RNN model in seq2seq code mutation. The results show that transformers pre-trained with source code, especially CodeT5, demonstrated the best performance, achieving an average character n-gram F-score (CHRF) of 82.89 and superior code mutation complexity. Since the performance of transformers in seq2seq code mutation has not been previously investigated, the primary contribution of this paper is the best performing transformer for seq2seq code mutation. It establishes the foundation for the future research that proposes an integrated solution which addresses both the high-cost problem and the inaccurate mutation score problem of MT simultaneously, unlike existing solutions which only tackle one of the MT problems and give rise to other MT problems.
Read moreLearning‐based mutant reduction using fine‐grained mutation operators
SummaryFor mutation testing, the huge cost of running test suites on a large number of mutants has been a serious obstacle. To resolve this problem, we propose a learning‐based mutant reduction techniqueMuTrain.MuTrainuses cost‐considerate linear regression (i.e., CLARS) to learn amutation model, which predicts the mutation score of a test suite based on the mutation testing results of a previous version of a target program. Then,MuTrainapplies the mutation model for subsequent versions to predict mutation scores with significantly fewer mutants. For effective mutant reduction and accurate mutation score prediction,MuTrainuses fine‐grained mutation operators refined from the existing coarse‐grained mutation operators. The experiment results show thatMuTrainreduces the number of mutants effectively (i.e., selecting only 1.6% of mutants). Moreover,MuTrainpredicts mutation score far more accurately than the existing mutant reduction techniques and random mutant selection. We also found thatMuTrainachieves much greater mutant reduction when it uses the fine‐grained mutation operators than the traditional coarse‐grained mutation operators (i.e., 1.6% vs. 14.6%).
Read more