Concepts: Key Measures of TestIntroduction
The key measures of a test include coverage and quality. Test coverage is the measurement of testing completeness, and is based on the coverage of testing, expressed either by the coverage of test requirements and test cases, or the coverage of executed code. Quality is a measure is of reliability, stability, and the performance of the target-of-test (system or application-under-test). Quality is based upon the evaluation of test results and the analysis of change requests (defects) identified during the testing. Coverage Measures
Coverage metrics provides answers to the question "How complete is the testing?" The most commonly used coverage measures are requirements-based and code-based test coverage. In brief, test coverage is any measure of completeness with respect to either a requirement (requirement-based) or the code's design / implementation criterion (code-based), such as the verification of use cases (requirement-based) or execution of all lines of code (code-based). Any systematic testing activity is based on at least one test coverage strategy. The coverage strategy guides the design of test cases by stating the general purpose of the testing. The statement of coverage strategy can be as simple as verifying all performance. If the requirements are completely cataloged, a requirements-based coverage strategy may be sufficient for yielding a quantifiable measure of testing completeness. For example, if all performance test requirements have been identified, then the test results can be referenced to get measures, such as 75 percent of the performance test requirements have been verified. If code-based coverage is applied, test strategies are formulated in terms of how much of the source code has been executed by tests. This type of test coverage strategy is very important for safety-critical systems. Both measures can be derived manually (equations given below), or may be calculated by test automation tools. Requirements-based test coverage
Requirements-based test coverage is measured several times during the test life cycle and provides the identification of the test coverage at a milestone in the testing life cycle (such as the planned, implemented, executed, and successful test coverage).
Turning the above ratios into percentages allows the following statement of requirements-based test coverage:
This is a meaningful statement of test coverage that can be matched against a defined success criteria. If the criteria have not been met, then the statement provides a basis for predicting how much testing effort remains. Code-based test coverage
Code-based test coverage measures how much code has been executed during the test, compared to how much code there is left to execute. Code coverage can either be based on control flows (statement, branch, or paths) or data flows. In control-flow coverage, the aim is to test lines of code, branch conditions, paths through the code, or other elements of the software's flow of control. In data-flow coverage, the aim is to test that data states remain valid through the operation of the software, for example, that a data element is defined before it is used. Code-based test coverage is calculated by the following equation:
Turning this ratio into a percentage allows the following statement of code-based test coverage:
This is a meaningful statement of test coverage that can be matched against a defined success criteria. If the criteria have not been met, then the statement provides a basis for predicting how much testing effort remains. Quality Measures
While the evaluation of test coverage provides the measure of testing completion, an evaluation of defects discovered during testing provides the best indication of software quality. Quality is the indication of how well the software meets the requirements, so in this context, defects are identified as a type of change request in which the target-of-test failed to meet the requirements. Defect evaluation may be based on methods that range from simple defect counts to rigorous statistical modeling. Rigorous evaluation uses assumptions about the arrival or discovery rates of defects during the testing process. A common model assumes that the rate follows a Poisson distribution. The actual data about defect rates are then fit to the model. The resulting evaluation estimates the current software reliability and predicts how the reliability will grow if testing and defect removal continue. This evaluation is described as software-reliability growth modeling and is an area of active study. Due to the lack of tool support for this type of evaluation, you should carefully balance the cost of doing it with the value it adds. Defects analysis means to analyze the distribution of defects over the values of one or more the parameters associated with a defect. Defect analysis provides an indication of the reliability of the software. For defect analysis, there are four main defect parameters commonly used:
Defects included in an analysis of this kind have to be confirmed defects. Not all reported defects report an actual flaw, as some may be enhancement requests, out of the scope of the project, or describe an already reported defect. However, there is value to looking at and analyzing why there are many defects being reported that are either duplicates or not confirmed defects. Defect Reports
The Rational Unified Process provides defect evaluation in the form of three classes of reports:
Many of these reports are valuable in assessing software quality. The usual test criteria include a statement about the allowable numbers of open defects in particular categories, such as severity class. This criterion is easily checked with a defect distribution evaluation. By filtering or sorting on test requirements, this evaluation can be focused on different sets of requirements. To be effective producing reports of this kind normally requires tool support. Defect Density Reports
Defect Status Versus PriorityEach defect should be given a priority; usually it is practical to have four priority levels:
Criteria for a successful test could be expressed in terms of how the distribution of defects over these priority levels should look. For example, to a successful test criteria might be no Priority 1 defects and fewer than five Priority 2 defects are open. A defect distribution diagram, such as the following, should be generated:
It is clear that the criterion has not been met. Note that this diagram needs to include a filter to show only open defects as required by the test criterion. Defect Status Versus SeverityDefect severity reports show how many defects there are of each severity class (for example: fatal error, major function not performed, minor annoyance). Defect Status Versus Location in the Implementation ModelDefect source reports show distribution of defects on elements in the implementation model. Defect Aging Reports
Defect age analyses provide good feedback on the effectiveness of the testing and the defect removal activities. For example, if the majority of older, unresolved defects are in a pending-validation state, it probably means that not enough resources are applied to the re-testing effort. Defect Trend Reports
Trend reports identify defect rates and provide a particularly good view of the state of the testing. Defect trends follow a fairly predictable pattern in a testing cycle. Early in the cycle, the defect rates rise quickly. Then they reach a peak and fall at a slower rate over time.
To find problems, the project schedule can be reviewed in light of this trend. For example, if the defect rates are still rising in the third week of a four-week test cycle, the project is clearly not on schedule. This simple trend analysis assumes that defects are being fixed promptly and that the fixes are being tested in subsequent builds, so that the rate of closing defects should follow the same profile as the rate of finding defects. When this does not happen, it indicates a problem with the defect-resolution process; the defect fixing resources or the resources to re-test and validate fixes might be inadequate.
The trend reflected in this report shows that new defects are discovered and
opened quickly at the beginning of the project, and that they decrease over
time. The trend for open defects is similar to that for new defects, but lags
slightly behind. The trend for closing defects increases over time as open
defects are fixed and verified. These trends depict a successful effort. When combined with the measures of test coverage, the defect analyses provide a very good assessment on which to base the test completion criteria. Performance Measures
Several measures are used for assessing the performance behaviors of the target-of-test and focus on capturing data related to behaviors such as response time, timing profiles, execution flow, operational reliability and limits. Primarily, these measures are assessed in the Evaluate Test activity, however, there are performance measures that are used during the Execute Test activity to evaluate test progress and status. The primary performance measures include:
Dynamic Monitoring
Dynamic monitoring provides real-time display / reporting, typically in the
form of a histogram or graph. The report is used to monitor or assess
performance test execution during test execution by displaying the current
state, status, and progress the test scripts being executed. For example, in the above histogram, we have 80 test scripts executing the same use case. In this display, 14 test scripts are in the Idle state, 12 in the Query, 34 in SQL Execution, 4 in SQL Connect, and 16 in the Other state. As the test progresses, we would expect to see the number of scripts in each state change. The displayed output would be typical of a test execution that is executing normally and is in the middle of the execution. However, if during test execution, test scripts remain in one state or are not showing changes, this could indicate a problem with the test execution or the need to implement or evaluate other performance measures. Response Time / Throughput
Reports
Response time / Throughput reports, as their name implies measures and calculates the performance behaviors related to time and / or throughput (number of transactions processed). Typically these reports are displayed as a graph with response time (or number of transactions) on the "y" axis and events on the "x" axis. In addition to showing the actual performance behaviors, it is often valuable to calculate and display statistical information such as the mean and standard deviation of the data values. Percentile Reports
Percentile reports provide another statistical calculation of performance by displaying population percentile values for data types collected. Comparison Reports
It is highly desirable to compare the results of one performance test execution with that of another, to evaluate the impact of changes made between test executions the on the performance behaviors. Comparison reports should be used to display the difference between two sets of data (each representing different test executions) or trends between many executions of test. Trace and Profile
Reports
When performance behaviors are
acceptable, or performance monitoring indicates the possible bottlenecks (such
as when test scripts remain in a given state for exceedingly long periods) trace
reporting may be the most valuable report. Trace and Profile reports display
lower level information. This information includes the messages between the
actor and the target-of-test, execution flow, data access, and the
function and system calls. |
Rational Unified
Process |