State coverage: an empirical analysis based on a user study

Similar documents
A Survey on Code Coverage as a Stopping Criterion for Unit Testing

MSc Software Testing MSc Prófun hugbúnaðar

The Effect of Code Coverage on Fault Detection under Different Testing Profiles

Test-Driven Development

Assignment 4: True or Quasi-Experiment

Why Tests Don t Pass

An Empirical Study of Process Conformance

Chapter 1. Research : A way of thinking

Chapter 1. Research : A way of thinking

Reliability of feedback fechanism based on root cause defect analysis - case study

Enumerative and Analytic Studies. Description versus prediction

Requirement Error Abstraction and Classification: A Control Group Replicated Study

Quality Metrics of Test Suites in Test-Driven Designed Applications

A Brief Guide to Writing

Controlled Experiments

BIOLOGY. The range and suitability of the work submitted

THEORY OF CHANGE FOR FUNDERS

On the Effectiveness of Unit Tests in Test-driven Development

Understanding the impact of industrial context on software engineering research: some initial insights. Technical Report No.: 390

EMPIRICAL RESEARCH METHODS IN VISUALIZATION

Dolly or Shaun? A Survey to Verify Code Clones Detected using Similar Sequences of Method Calls

The Scientific Method

Fault Detection and Localisation in Reduced Test Suites

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING. CP 7026-Software Quality Assurance Unit-I. Part-A

INTERNATIONAL STANDARD ON ASSURANCE ENGAGEMENTS 3000 ASSURANCE ENGAGEMENTS OTHER THAN AUDITS OR REVIEWS OF HISTORICAL FINANCIAL INFORMATION CONTENTS

Visual book review 1 Safe and Sound, AI in hazardous applications by John Fox and Subrata Das

Estimating the number of components with defects post-release that showed no defects in testing

A Qualitative Survey of Regression Testing Practices

Generalization and Theory-Building in Software Engineering Research

On the Effectiveness of Specification-Based Structural Test-Coverage Criteria as Test-Data Generators for Safety-Critical Systems

OECD WORKSHOP: THE ENVIRONMENTALLY SOUND MANAGEMENT OF RECOVERABLE WASTES (ESM) SESSION 1

Ineffectiveness of Use of Software Science Metrics as Predictors of Defects in Object Oriented Software

Interaction-Based Test-Suite Minimization

Systematic Mapping Studies

TDD HQ : Achieving Higher Quality Testing in Test Driven Development

RESEARCH METHODOLOGY-NET/JRF EXAMINATION DECEMBER 2013 prepared by Lakshmanan.MP, Asst Professor, Govt College Chittur

INTERVIEWS II: THEORIES AND TECHNIQUES 5. CLINICAL APPROACH TO INTERVIEWING PART 1

GCSE. Psychology. Mark Scheme for June General Certificate of Secondary Education Unit B543: Research in Psychology

OUR RECOMMENDED INDIVIDUAL S STRATEGY

Exploration and Exploitation in Reinforcement Learning

Glossary of Research Terms Compiled by Dr Emma Rowden and David Litting (UTS Library)

Assurance Engagements Other than Audits or Review of Historical Financial Statements

Informal Aggregation Technique for Software Engineering Experiments

Unsupervised Measurement of Translation Quality Using Multi-engine, Bi-directional Translation

Analytical Software Design Case

Introspection-based Periodicity Awareness Model for Intermittently Connected Mobile Networks

USE AND MISUSE OF MIXED MODEL ANALYSIS VARIANCE IN ECOLOGICAL STUDIES1

Cambridge International AS & A Level Global Perspectives and Research. Component 4

Research Article An Improved Approach for Reduction of Defect Density Using Optimal Module Sizes

Status of Empirical Research in Software Engineering

International Standard on Auditing (UK) 530

Models of Information Retrieval

Reasons and Emotions that Guide Stakeholder s Decisions and Have an Impact on Corporate Reputation

Lab 2: The Scientific Method. Summary

Standardized Defect Statuses. Abstract

Unit 2, Lesson 5: Teacher s Edition 1. Unit 2: Lesson 5 Understanding Vaccine Safety

Name of the paper: Effective Development and Testing using TDD. Name of Project Teams: Conversion Team and Patient Access Team.

Psychology 2019 v1.3. IA2 high-level annotated sample response. Student experiment (20%) August Assessment objectives

Defect Removal Metrics. SE 350 Software Process & Product Quality 1

Reliability, validity, and all that jazz

Supporting Blended Workflows

Principles of publishing

LifelogExplorer: A Tool for Visual Exploration of Ambulatory Skin Conductance Measurements in Context

Clever Hans the horse could do simple math and spell out the answers to simple questions. He wasn t always correct, but he was most of the time.

Correlating Trust with Signal Detection Theory Measures in a Hybrid Inspection System

Measuring Focused Attention Using Fixation Inner-Density

Test-Driven Development Exposed Growing Complex Software One Test at a Time

Exploring MultiObjective Fitness Functions and Compositions of Different Fitness Functions in rtneat

Positive and Unlabeled Relational Classification through Label Frequency Estimation

Vocabulary. Bias. Blinding. Block. Cluster sample

Towards More Confident Recommendations: Improving Recommender Systems Using Filtering Approach Based on Rating Variance

Positive and Unlabeled Relational Classification through Label Frequency Estimation

Most Common Mistakes in Test-Driven Development Practice: Results from an Online Survey with Developers

Expert System Profile

LAB 7: THE SCIENTIFIC METHOD

Applying the Experimental Paradigm to Software Engineering

Pupil Dilation as an Indicator of Cognitive Workload in Human-Computer Interaction

Learning with Rare Cases and Small Disjuncts

CRITICAL THINKING: ASSESSMENT RUBRIC. Preliminary Definitions:

Cambridge Pre-U 9773 Psychology June 2013 Principal Examiner Report for Teachers

Comparing the Effectiveness of Equivalence Partitioning, Branch Testing and Code Reading by Stepwise Abstraction Applied by Subjects

RIGOR AND REPRODUCIBILITY IN RESEARCH GUIDANCE FOR REVIEWERS

Empirical Research Methods for Human-Computer Interaction. I. Scott MacKenzie Steven J. Castellucci

Framework on the feedback of health-related findings in research March 2014

Towards an instrument for measuring sensemaking and an assessment of its theoretical features

Writing Reaction Papers Using the QuALMRI Framework

Relationships Between the High Impact Indicators and Other Indicators

Patterns of Simplicity. Giovanni Asproni Kevlin Henney Peter Sommerlad

Confirmation Bias in Software Development and Testing: An Analysis of the Effects of Company Size, Experience and Reasoning Skills

Does pure water boil, when it s heated to 100 C? : The Associative Strength of Disabling Conditions in Conditional Reasoning

Chapter 12. The One- Sample

Reliability of Constructions and Ultrasonic Weld Examinations. Procedure IBUS-NZ

METHODOLOGY FOR DISSERTATION

To conclude, a theory of error must be a theory of the interaction between human performance variability and the situational constraints.

ISA 540, Auditing Accounting Estimates, Including Fair Value Accounting Estimates, and Related Disclosures Issues and Task Force Recommendations

An Introduction to Stylometric Analysis Nathaniel Latta

How to interpret results of metaanalysis

Comments DRAFT Preamble to the IARC Monograph. Health and Safety Department International Union, UAW 8000 East Jefferson Avenue Detroit, MI 48214

Transcription:

State coverage: an empirical analysis based on a user study Dries Vanoverberghe 1, Emma Eyckmans 1, and Frank Piessens 1 Katholieke Universiteit Leuven, Leuven, Belgium {dries.vanoverberghe,frank.piessens}@cs.kuleuven.be Abstract. State coverage is a relatively new metric to evaluate the quality of test suites. While most existing test adequacy criteria measure the degree of exploration of the code under test, state coverage estimates the strength of the assertions in the test suite. Initial experiments have shown that there is a correlation between state coverage and mutation adequacy, and that expert users can discover new faults by modifying the test suite to increase state coverage. Since the faults injected by mutation testing are relatively simple, it is not clear whether these experiment are valid in a broader setting. Furthermore, these results may not be reproducible by average users, since they usually lack full understanding of the internals of the tool. This paper presents a user-based experiment to evaluate whether the state coverage of a test suite correlates with the number defects it discovers. While the results of the experiments fail to confirm this hypothesis, they do raises important questions. First, test suites with high state coverage should be good in finding logical software faults, but these faults occur less frequently than structural faults. Second, state coverage is not monotonic in the size of the test suite. Therefore, adding new test cases which check new properties and detect new faults can often reduce state coverage. Based on this, we suggest a number of improvements. Key words: state coverage, test adequacy metric, user study 1 Introduction In order to detect software faults, programmers often develop test sets. The question that arises when developing a test set is how the programmer will know when his test set is sufficiently elaborated to have a good chance that a large amount of faults have been detected. To make that decision, a lot of test adequacy metrics were defined. Those metrics indicate the reliability of a test set with respect to the detection of faults in the code under test. The existing metrics are divided into three classes based on their underlying approach [13]: structural metrics, fault-based metrics and error-based metrics. Although a lot of metrics for test adequacy already exist, there seems to be a void in the range of available metrics. Currently used metrics tend to focus on measuring a certain amount of code that is executed by the test set. Both structural and error-based metrics apply this technique. On the other hand, test adequacy metrics that verify whether Dries Vanoverberghe is a Postdoctoral Fellow of the Fund for Scientific Research - Flanders (FWO). This research is partially funded by the Interuniversity Attraction Poles Programme Belgian State, Belgian Science Policy, by the IWT, and by the Research Fund K.U.Leuven.

a test set sufficiently checks the program s behavior are rather rare [7]. Checking the behavior of programs is nevertheless important to verify that the program correctly implements the desired functionality. Fault-based metrics do focus on the behavior of the code under test, but most fault-based techniques are very expensive in terms of execution time. State coverage was originally developed to fill up this void in the range of available metrics for test adequacy. State coverage focuses on checking the behavior of the code under test like fault-based metrics, but pursues the low execution cost and low effort in use of structural metrics [7]. Due to its specific focus on behavior checking, state coverage is best used in combination with a metric that concentrates on measuring an amount of code executed by the test set [11]. This way, both the amount of executed code and the behavior of the code are monitored. While the theory behind state coverage sounds promising, its practical merits still need to be demonstrated. Previous experiments to evaluate state coverage indicate that it is a promising metric [11, 7]. However, both earlier experiments have disadvantages. Koster et. al. [7] have shown a correlation between the state coverage of test suites and their mutation adequacy score [3, 5]. Unfortunately, it is unlikely that intricate logical faults can be created by using simple syntactic mutations. Therefore, the mutation adequacy score may not be a good proxy for measuring a test suites capacity to detect faults. Vanoverberghe et. al. [11] performed a case study on an open source project. By increasing the state coverage of the test suite, they discovered several new faults. However, since the user of the case study had expert knowledge about state coverage, it is not clear whether these results can be reproduced by average users. In this paper, we perform a two-phase experiment to compare the state coverage of a test suite with its capacity to detect faults. First, we follow the process of Vanoverberghe et. al. [11], and try to find new faults by increasing state coverage. Afterward, we manually inject more faults according to a documented distribution of common faults in software [8]. Second, we ask external users to write a test suite, and we compare the state coverage of the resulting test suites with the number of detected faults. This process avoids the the influence of pre-existing knowledge about state coverage, and it allows more intricate faults. Unfortunately, both phases of the experiment fail to confirm that state coverage correlates with the number of detected faults. Therefore, we verify a number of potential causes for these surprising results. Most importantly, state coverage is designed to measure the strength of the properties that are checked using assertions. Therefore, test suites with high state coverage focus on logical software faults, which did not occur frequently in the experiment. Alternatively, it is surprising that the state coverage of a test suites can often be reduced by adding new test cases to the test suite. This behavior occurs when the new test cases perform many write operations, but only check a few of them using assertion. This lack of monotonicity adversely affects the correlation with the number of detected faults. The remainder of this paper is structured as follows. Section 2 introduces the definition of state coverage and illustrates it by means of an example. Section 3 describes the design of the experiment. In Section 4, the results of this experiment are presented and possible causes for the results are discussed. Finally, section 5 describes the conclusion.

2 State coverage In [11] state coverage is defined as the ratio of the number of state updates which are read by assertions to the total number of state updates. For example, consider the class Person in Figure 1a. This class contains a field name and provides a getter, a setter and a default setter. Figure 1b shows a test case for this class. During the execution of this test case, there are three status updates to the field name: in the constructor, setname and setnamedefault. The test case uses getname to read the values written in the constructor and setname and checks them in an assertion. Consequently, the test case has 2/3 or 66 percent state coverage. class Person { String name; Person(String name) { this.name = name; } void setname(string name) { this.name = name; } void setnamedefault() { this.name = "John Doe"; } } (a) The Person class class TestPerson { @Test void test() { Person anne = new Person("Anne"); assertequals("anne", anne.getname()); //SC Person.ctor: 100% anne.setname("anne-maria"); assertequals("anne-maria", anne.getname()); //SC Person.setName: 100% anne.setnamedefault(); //SC Person.setNameDefault: 0% } } (b) The TestPerson class Fig. 1: Example to illustrate state coverage The existing definitions of state coverage [7, 11] use a complex dependency algorithm to decide whether a test case reads a written value in an assertion. In this paper, we use lightweight state coverage, a variant which monitors the fields that are read while evaluating the expression of the assertion and remembers the writes that are responsible for it. While this is slightly less precise, it is easier to understand and more efficient. 3 Design of the experiment 3.1 Goal As discussed in the first chapter, the earlier experiments regarding the efficiency of state coverage [11, 7] show that state coverage could be a promising metric for test adequacy. However, both experiments exhibit serious disadvantages. The main goal of the experiment described in this paper is to evaluate the efficiency of state coverage without the manifestation of these disadvantages so that the results of this experiment become more generally applicable. The experiment will therefore investigate the direct relationship between state coverage and the number of detected faults. Furthermore, non expert users will be employed to develop test sets instead of experts in the matter of state coverage.

3.2 Hypotheses The experiment described in this paper evaluates two different hypotheses. The first hypothesis, hypothesis 1, states that a user will find more faults in the code under test by elevating the state coverage percentage than when state coverage is not being applied. The user will thus discover new faults by applying state coverage to an existing test set. Hypothesis 2 reads as follows: Consider a given program and different test sets that verify that program. The higher the state coverage percentage of a test set, the more faults the test set will detect in the program code when that test set is applied to the program. In other words, hypothesis 2 states that a correlation between the state coverage percentage and the number of detected faults in a program exists. Hypothesis 1 is weaker than hypothesis 2, but can be checked more easily. Hypothesis 1 will therefore serve as a quick check to offer a first indication concerning the efficiency of state coverage. It simply states that elevating the state coverage percentage will cause more faults to be found than when state coverage is not applied. The experiment is designed so that this hypothesis can quickly be examined. The stronger hypothesis 2 will further investigate the relation between state coverage and the number of faults found in the program under test, guided by the results for hypothesis 1. 3.3 Structure of the experiment The experiment designed to evaluate the two discussed hypotheses is based on different existing experiments [2, 9, 12, 1, 4, 10] to evaluate the efficiency of other test adequacy metrics. In general, these experiments have the same structure: In a chosen program, faults are introduced. For that program, different test sets are created. Each of those test sets has a certain coverage percentage. By executing the test sets and monitoring the amount of faults in the program code found by the test sets, the relation between the coverage percentage and the detection of faults in the program can be observed. The remainder of this section describes the choices that were made regarding the employed program, the injected faults and the creation of test sets. For the program, we chose a Java application (the MOP-application) which was developed in the software design course of the third year of the bachelor in informatics at the KULeuven. We made this choice because the voluntary users involved in the experiment need to be able to write a test set for the program in a limited amount of time. Hence, the program needs to be rather small. In addition, it allows minor modifications to the program to avoid tool-related problems. In the first phase of the experiment, we developed a test set for the MOP-application. First, the existing test set for the MOP-application was extended to reach a code coverage percentage 1 of approximately 90 percent. The faults discovered in this step were registered for later consultation. The use of code coverage is important, because state coverage does not measure the degree of exploration of a test suite. By combining code coverage and state coverage in the experiment, we ensure that both the amount of executed code and the behavior of that executed code is monitored. In a second step of this first phase, the state coverage percentage of the developed test set was also increased to reach approximately 90 percent. To that end, assertions 1 instruction coverage as measuerd by EclEmma [6]

were added to the existing test set. Thus, the code coverage percentage of the test set stayed the same. The faults that were found while increasing the state coverage percentage, were recorded together with the state coverage percentage of the test set on the moment the fault was found. In this first phase it became clear that developing a test set for the original MOPapplication was too time-consuming for the voluntary users time constraints. The original MOP-application was therefore shortened. In the rest of this text, the original MOPapplication will always be referred to using the word original. Other occurrences of the word MOP-application refer to the shortened version. After this shortening, additional faults were injected manually into the program. In total, 20 faults were present in the simplified MOP-application. Four of those faults were faults that were discovered in the first phase of the experiment. Nine faults were explicitly injected in the program code. The choice of the faults to inject was based on a documented distribution of common faults in software [8]. A last group contains the additional seven faults that users of the experiment detected while writing a test set for the program in the second phase of the experiment. In this second phase, the users developed a test set for the MOP-application with injected faults. The users of the experiment were voluntary students in the last year of the master in computer science. Like in the first phase of the experiment, the users initially developed a test set for the MOP-application that reached a code coverage percentage of approximately 90 percent. In this first step, the users were kept in the dark about the existence and practice of state coverage. After this step, the users were informed about the existence of state coverage and the Java state coverage tool. They were asked to use that tool to increase the state coverage percentage of their developed test sets to approximately 90 percent. During this phase, all the faults that the users detected were registered together with the code and state coverage percentage on the moment the fault was found. 3.4 Threats to validity As for any other experiment, there are a number of threats to the validity of the conclusions of the experiment. Internal validity The experiment took place in two different sessions. Therefore, there may be a discrepancy between the results of these sessions. In practice, we have not observed significant differences between both sessions. Since the users first tested the program using code coverage, the users may have become more proficient in the programming language and the testing environment before using state coverage. However, both the programming language and the test environment were well-known to the users before the start of the experiment. External validity In the experiment, a self-written application is used. It is possible that the chosen program is not representative enough for realistic programs. The chosen application was developed by students instead of experienced programmers. Moreover, there is a lot of variation in software applications, so a single program can never represent them all. This threat to validity is inherent to our choice for the MOP-application and will have to be kept in mind while analyzing the results.

Another threat is the result of the choice of the injected faults. The faults that were already present in the MOP-application and that were found by either us or the users of the experiment are real faults. Although the injected faults were selected by using a distribution of common software faults, there is no guarantee that this distribution is correct nor that the injected faults correctly represent the determined classes. This threat is inherent to our choices and will have to be kept in mind while analyzing the results. The last threat to the validity of the experiment is the fact that students may not be the best users for the experiment. Students may not achieve the same results as experienced programmers. In addition, experiences state coverage users may achieve better results. On the other hand, state coverage was developed to help users develop good test sets, so even less experienced users should be able to benefit from it. 4 Evaluation of the results 4.1 Phase 1 The results of phase one of the experiment, where we developed a test set for the original MOP-application, are limited. The goal of this phase was to perform a preliminary evaluation of hypothesis 1 by checking whether increasing the state coverage percentage would cause additional faults to be found in the original MOP-application. However, during the part of this phase where the state coverage percentage was increased, no additional faults were found. Based on these results, hypothesis 1 can not be accepted. The results of phase two will further investigate hypothesis 1 and 2 based on the data gathered from the user experiment, since the data gathered in this phase is too limited to draw any general conclusions. Most likely, no additional faults were found because state coverage assists in finding a specific class of faults, and these faults are rather rare in the original MOP-application. State coverage was designed to measure the strength of the assertions in a test suite. Most discovered faults were structural faults, such as null pointer exceptions due to improper handling of null arguments. This kind of fault can not be detected by adding new assertions. Instead, test suites with high state coverage focus on logical faults, such as violations of an invariant or a post condition. Of the 13 discovered faults, only one could be found by increasing state coverage. However, it was already discovered while increasing code coverage. 4.2 Phase 2 A first goal of the experiment was to evaluate whether elevating the state coverage percentage of a test set would lead to more detected faults in the program code (hypothesis 1). In this phase also, like in phase one, none of the 13 users found an additional fault during the state coverage part of the experiment. This result suggests that the explicit augmentation of state coverage has little effect on the number of faults found. However, before such a rigorous conclusion can be drawn, a more detailed investigation is required.

Before proceeding to the evaluation of hypothesis 2, we check a control hypothesis about code coverage which states that there is a positive correlation between the code coverage of a test suite and the number of faults it detects. During the experiment, users were required to gather snapshots of their test set on certain points in the development. The users were asked to create a snapshot every time they detected a fault, at the end of the code coverage part of the experiment and at the end of the state coverage part of the experiment. These snapshots are the data that is used to evaluate the hypotheses. In figure 2, a chart is shown that displays the code coverage percentage of these snapshots on the y-axis and the number of detected faults on the x-axis. A visual inspection of the chart reveals a correlation between the code coverage percentage and the number of faults found. To confirm hypothesis 2, we need a similar correlation between state coverage and the number of detected faults. Fig. 2: Code coverage evolution The chart that displays the state coverage percentage of the users snapshots on the y-axis and the number of detected faults on the x-axis is shown in Figure 3. Unfortunately, there is no correlation visible in this chart. There does not seem to be a positive relation between the state coverage percentage and the number of detected faults. Both the results for hypothesis 1 and 2 thus seem to indicate that state coverage is not an efficient test adequacy metric. In the remainder of this section, two possible causes for these unexpected results will be discussed. Afterwards state coverage will be critically analyzed and suggestions for the improvement of state coverage will be presented.

Fig. 3: State coverage evolution 4.3 Potential causes for the results Frequency of logical faults As discussed before, state coverage was designed to measure the strength of the assertions in a test suite. Consequently, it will probably only correlate with the number of logical faults in the code base. Because state coverage measures the fraction of the state updates that are read in assertions, it implicitly focuses on incorrect state updates. After executing the experiment, we can conclude that these faults are rather rare in the MOP-application. Of the 20 faults in the MOP-application, only three faults are caused by an incorrect state update. Unfortunately, only one of those three faults was actually discovered by users. Therefore, there is insufficient data to be representative for all such faults. While state coverage focuses on missing state updates, logical faults can also be caused by missing state updates. Since test suites with high state coverage usually contain more assertions, it is likely that they will also discover more missing state updates and therefore we can broaden the scope to general logical faults. Of all detected faults in the MOP-application, 35.7 percent of the total amount of detected faults can be discovered using assertions. When we only consider these faults, there is an indication that state coverage influences the detection of faults. To investigate this, the appropriate test classes for finding a fault were divided into two groups. One group contained the test classes that were implemented by a user, but were not able to detect a certain fault in the class under test. The other group contained the test classes that were able to detect a certain fault in the class under test. For both groups, the average state coverage percentage was calculated. On average, test classes that discover a fault have a higher state coverage percentage (42 percent) than test classes that do not discover the fault (34 percent). These results indicate that, when

focusing on logical faults, the correlation between state coverage and the detected number of faults may improve. Since the variance between the state coverage within one group is rather high and the number of data points is still small, the results are not significant enough to draw strong conclusions. The most important question that remains based on this analysis is the question whether faults that are caused by incorrect state updates are as rare in real applications as they were in the MOP-application. If so, the specific focus of state coverage on such faults is probably not justifiable. Monotonicity Another reason why state coverage may not have a correlation with the number of detected faults is that it is not monotonic in the size of the test suite. Most test adequacy criteria can only increase when new test cases are added to the test suite. Since state coverage is relative to the exploration of the test suite, exploring a new path in the program may introduce new state updates and thus reduce state coverage, even if it discovers new faults by rereading a small fraction of them in an assertion. Consider the chart depicted in Figure 4. This chart displays the number of detected faults on the x-axis and the absolute number of covered state updates on the y-axis. The represented points are again the snapshots of the users test sets. In this chart, there is a positive correlation between the number of detected faults and the number of covered state updates. Thus, the absolute number of covered state updates has an influence on the detection of faults after all. However, this influence is not reflected in the state coverage percentage, as shown in Figure 3. Fig. 4: Absolute state coverage evolution

Since the state coverage percentage can both increase and decrease when additional code is added to the test set, it may require much more effort from the tester to maintain a high state coverage ration. Therefore, high state coverage may be too strict to discover a high number of faults. However, covering state updates in assertions seems promising since a correlation between the absolute number of covered state updates and the number of detected faults is present. 4.4 Analysis of state coverage In this section, the current form of state coverage is thoroughly analyzed. First, the benefits and drawbacks of state coverage will be discussed. Afterwards, several suggestions for the improvement of state coverage will be presented to eliminate some of the current drawbacks. Benefits The most important benefit of state coverage is the fact that the metric focuses the programmers attention on checking the behavior of the code under test. This focus is different than the focus of most existing metrics for test adequacy. Hence, state coverage is not another metric of the same kind, but it is an innovative metric with an original approach. Another benefit of state coverage is that it is easily understandable. Comprehensibility is an essential quality for a test adequacy metric. State coverage is easily explicable by means of a definition and some simple examples. The users of the experiment confirmed state coverage s understandability and had little or no problems learning to work with state coverage. A last benefit of state coverage is the fact that it can be calculated efficiently. Unlike the mutation adequacy score, state coverage can be measured by monitoring a single execution of the test suite. Both state coverage and mutation testing focus on the behavior of the code under test, but the execution cost of state coverage is far lower than that of mutation testing. Drawbacks A first drawback of state coverage that needs to be considered is the fact that state coverage in its current form always has to be used in combination with another metric for test adequacy. State coverage only considers the code that is executed by the test suite to calculate the state coverage percentage. Therefore, state coverage will always have to be applied in combination with a metric that monitors the amount of executed code. A second disadvantage of state coverage is the fact that in the current implementation of state coverage, a lot of useless assertions may need to be written to achieve a high state coverage percentage. On the one hand, not all state updates are equally likely to be incorrect. On the other hand, the state coverage percentage is currently calculated per test method. If a certain piece of code occurs in different test methods, state coverage will require to check the state updates for that piece of code in each test method separately, creating a bunch of duplicated assertions. A last disadvantage arises from the disappointing results of the experiment. State coverage by design focuses on logical faults. This class is implicitly reduced to incorrect

state update. These faults were rare in the MOP-application. If broader experiments suggest that logical faults do not occur frequently enough in real applications, achieving high state coverage may require too much effort with respect to the rewards that can be gained. Suggestions for improvement A first aspect of state coverage that can be improved is the implementation. As discussed in the previous section, the current implementation calculates the state coverage percentage per test method. A possible improvement of this approach is to calculate state coverage for the whole test and thus join the results of all test methods. In this way, a lot of repeated assertions can be avoided by registering the same state updates only once. A problem that could arise using this new approach is the fact that the memory usage might increase to unacceptable levels since all state updates will need to be kept in memory during the entire execution of the test set. In addition, this requires an intelligent way to join the state updates of different test cases. As discussed before, the definition of state coverage currently allows the state coverage percentage to increase as well as decrease on expansion of a test set. It may be possible to create a variant of state coverage that is monotonously increasing. For example, this can be done by using a more static version of state coverage where the maximum number of state updates is fixed statically. The advantage is that the new definition will more strongly comply with the expectations of the users. A drawback of this approach is that the definition of state coverage may be less dynamic and therefore easier to achieve. 5 Conclusion and future work State coverage is a promising metric to evaluate the strength of the assertions in a test suite. Unfortunately, the results of our experiment fail to confirm that there is a correlation between state coverage and the number of detected faults. Based on an analysis of the results, the main open question is whether logical software faults occur frequently enough to justify the increased effort to achieve high state coverage. In addition, it seems worthwhile to explore new variants of state coverage. On the one hand, state coverage only helps to find logical software faults which are caused by incorrect state updates, as opposed to the full spectrum of logical software faults. On the other hand, a monotonic metric is more convenient to work with and may have a better correlation with the number of detected faults. References 1. V. Basili and R. Selby. Comparing the effectiveness of software testing strategies. Software Engineering, IEEE Transactions on, SE-13(12):1278 1296, dec. 1987. 2. X. Cai and M. R. Lyu. The effect of code coverage on fault detection under different testing profiles. In Proceedings of the 1st international workshop on Advances in model-based testing, A-MOST 05, pages 1 7, New York, NY, USA, 2005. ACM. 3. R. A. DeMillo, R. J. Lipton, and F. G. Sayward. Hints on test data selection: Help for the practicing programmer. Computer, 11(4):34 41, 1978.

4. M. Hutchins, H. Foster, T. Goradia, and T. Ostrand. Experiments of the effectiveness of dataflow- and controlflow-based test adequacy criteria. In Proceedings of the 16th international conference on Software engineering, ICSE 94, pages 191 200, Los Alamitos, CA, USA, 1994. IEEE Computer Society Press. 5. Y. Jia and M. Harman. An analysis and survey of the development of mutation testing. Software Engineering, IEEE Transactions on, 37(5):649 678, sept.-oct. 2011. 6. M. G.. C. KG and Contributors. Eclemma: Java code coverage for eclipse. http://www.eclemma.org. 7. K. Koster and D. Kao. State coverage: a structural test adequacy criterion for behavior checking. In The 6th Joint Meeting on European software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering: companion papers, ESEC-FSE companion 07, pages 541 544, New York, NY, USA, 2007. ACM. 8. Z. Li, L. Tan, X. Wang, S. Lu, Y. Zhou, and C. Zhai. Have things changed now?: an empirical study of bug characteristics in modern open source software. In Proceedings of the 1st workshop on Architectural and system support for improving software dependability, ASID 06, pages 25 33, New York, NY, USA, 2006. ACM. 9. M. R. Lyu, Z. Huang, S. K. S. Sze, and X. Cai. An empirical study on testing and fault tolerance for software reliability engineering. In Proceedings of the 14th International Symposium on Software Reliability Engineering, ISSRE 03, pages 119, Washington, DC, USA, 2003. IEEE Computer Society. 10. A. Mockus, N. Nagappan, and T. T. Dinh-Trong. Test coverage and post-verification defects: A multiple case study. In Proceedings of the 2009 3rd International Symposium on Empirical Software Engineering and Measurement, ESEM 09, pages 291 301, Washington, DC, USA, 2009. IEEE Computer Society. 11. D. Vanoverberghe, J. de Halleux, N. Tillmann, and F. Piessens. State coverage: software validation metrics beyond code coverage. In Proceedings of the 38th international conference on Current Trends in Theory and Practice of Computer Science, SOFSEM 12, pages 542 553, Berlin, Heidelberg, 2012. Springer-Verlag. 12. W. Wong, J. Horgan, S. London, and A. Mathur. Effect of test set size and block coverage on the fault detection effectiveness. In Software Reliability Engineering, 1994. Proceedings., 5th International Symposium on, pages 230 238, nov 1994. 13. H. Zhu, P. A. V. Hall, and J. H. R. May. Software unit test coverage and adequacy. ACM Comput. Surv., 29:366 427, December 1997.