Test Case Prioritization in Software Testing
Last Updated :
21 May, 2024
As the name suggests, test case prioritization refers to prioritizing test cases in the test suite based on different factors. Factors could be code coverage, risk/critical modules, functionality, features, etc.
Why should test cases be prioritized?
As the size of software increases, the test suite also grows bigger and requires more effort to maintain the test suite. To detect bugs in software as early as possible, it is important to prioritize test cases so that important test cases can be executed first.
Types of Test Case Prioritization :
- General Prioritization: In this type of prioritization, test cases that will be useful for the subsequent modified versions of the product are prioritized. It does not require any information regarding modifications made to the product.
- Version-Specific Prioritization: Test cases can also be prioritized such that they are useful on a specific version of the product. This type of prioritization requires knowledge about changes that have been introduced in the product.
Prioritization Techniques
1. Coverage-based Test Case Prioritization :
This type of prioritization is based on code coverage i.e. test cases are prioritized based on their code coverage.
- Total Statement Coverage Prioritization – In this technique, the total number of statements covered by a test case is used as a factor to prioritize test cases. For example, a test case covering 10 statements will be given higher priority than a test case covering 5 statements.
- Additional Statement Coverage Prioritization – This technique involves iteratively selecting a test case with maximum statement coverage, then selecting a test case that covers statements that were left uncovered by the previous test case. This process is repeated till all statements have been covered.
- Total Branch Coverage Prioritization – Using total branch coverage as a factor for ordering test cases, prioritization can be achieved. Here, branch coverage refers to coverage of each possible outcome of a condition.
- Additional Branch Coverage Prioritization – Similar to the additional statement coverage technique, it first selects a text case with maximum branch coverage and then iteratively selects a test case that covers branch outcomes that were left uncovered by the previous test case.
- Total Fault-Exposing-Potential Prioritization – Fault-exposing-potential (FEP) refers to the ability of the test case to expose fault. Statement and Branch Coverage Techniques do not take into account the fact that some bugs can be more easily detected than others and also that some test cases have more potential to detect bugs than others.
- FEP depends on:
- Whether test cases cover faulty statements or not.
- Probability that faulty statement will cause test case to fail.
2. Risk-based Prioritization
This technique uses risk analysis to identify potential problem areas which if failed, could lead to bad consequences. Therefore, test cases are prioritized keeping in mind potential problem areas. In risk analysis, the following steps are performed :
- List potential problems.
- Assigning probability of occurrence for each problem.
- Calculating the severity of impact for each problem.
After performing the above steps, a risk analysis table is formed to present results. The table consists of columns like Problem ID, Potential problem identified, Severity of Impact, Risk exposure, etc.
3. Prioritization using Relevant Slice
In this type of prioritization, slicing technique is used – when program is modified, all existing regression test cases are executed in order to make sure that program yields same result as before, except where it has been modified. For this purpose, we try to find part of program which has been affected by modification, and then prioritization of test cases is performed for this affected part. There are 3 parts to slicing technique :
- Execution slice – The statements executed under test case form execution slice.
- Dynamic slice – Statements executed under test case that might impact program output.
- Relevant Slice – Statements that are executed under test case and don’t have any impact on the program output but may impact output of test case.
4. Requirements – based Prioritization
Some requirements are more important than others or are more critical in nature, hence test cases for such requirements should be prioritized first. The following factors can be considered while prioritizing test cases based on requirements :
- Customer assigned priority – The customer assigns weight to requirements according to his need or understanding of requirements of product.
- Developer perceived implementation complexity – Priority is assigned by developer on basis of efforts or time that would be required to implement that requirement.
- Requirement volatility – This factor determines frequency of change of requirement.
- Fault proneness of requirements – Priority is assigned based on how error-prone requirement has been in previous versions of software.
Metric for measuring Effectiveness of Prioritized Test Suite
For measuring how effective prioritized test suite is, we can use metric called APFD (Average Percentage of Faults Detected). The formula for APFD is given by :
APFD = 1 - ( (TF1 + TF2 + ....... + TFm) / nm ) + 1 / 2n
where,
TFi = position of first Test case in Test suite T that exposes Fault i
m = total number of Faults exposed under T
n = total number of Test cases in T
AFPD value can range from 0 to 100. The higher APFD value, faster faults detection rate. So simply put, APFD indicates of how quickly test suite can identify faults or bugs in software. If test suite can detect faults quickly, then it is considered to be more effective and reliable.
Similar Reads
Basis Path Testing in Software Testing
Prerequisite - Path Testing Basis Path Testing is a white-box testing technique based on the control structure of a program or a module. Using this structure, a control flow graph is prepared and the various possible paths present in the graph are executed as a part of testing. Therefore, by definit
5 min read
Internationalization Testing in Software Testing
Prerequisite: Software Testing Software testing is an important part of the software development life cycle. There are different types of software testing are performed during the development of a software product/service. Software testing ensures that our developed software product/service is bug-f
4 min read
Testing Documentation - Software Testing
Testing documents are prepared at different stages. These documents are discussed as follows. 1. Before Testing: Since testing begins with the generation of the test cases. The following documents are required for reference â SRS document - Functional Requirements document. Test Policy document - It
2 min read
Software Testing - Test Case Review
When a test engineer prepares a test case, he or she may skip some scenarios like entering incorrect data and writing incorrect navigation steps, all of which might have an impact on the overall test execution process. To avoid this, one round of evaluation and approval will be conducted before begi
14 min read
Pilot Testing in Software Testing
Pilot testing is the type of software testing where a group of users uses the software in totality before the final launch or deployment of the software. This testing verifies a component of the system or the entire system under a real-time operating condition. The purpose of the pilot testing is to
6 min read
Test Design Coverage in Software Testing
Test coverage is the degree to which a test or set of tests exercises a particular program or system. The more code that is covered by a test, the more confidence developers have that the code is free of bugs. Measuring test coverage can be difficult because it is often hard to determine what percen
15+ min read
Confirmation Testing in Software Testing
This article describes Confirmation testing, one of the software testing techniques that is used to assure the quality of the software and covers the concepts of Confirmation testing that help testers in confirming that the software is bug-free by retesting the software till all bugs are fixed. Conf
8 min read
Pair Testing in Software Testing
In this article, we are deeply learning about the Pair testing which includes the method of Working with more members in a team with the same feature development purpose. A detailed guide to the same is mentioned below: Prerequisite: Software Testing Table of Content What is Pair Testing?How to Perf
6 min read
Prototype Testing in Software Testing
Prototype testing is an important part of software development. It involves testing an early version or model of a product with real users to see how it works. This step helps you confirm your design ideas, find any issues, and improve them before fully developing the product. In this article, we wi
9 min read
Automation Testing - Software Testing
Automated Testing means using special software for tasks that people usually do when checking and testing a software product. Nowadays, many software projects use automation testing from start to end, especially in agile and DevOps methods. This means the engineering team runs tests automatically wi
15+ min read