Prioritization Types & Techniques
Compare general, version-specific, and model-based approaches with sample algorithms — Chowdhury Chapter 10 | ISTQB Foundation Level §5.1
Learning Objectives
- Distinguish the three prioritization types: general, version-specific, and model-based.
- Apply the total and additional greedy coverage algorithms for general prioritization.
- Apply change-impact and modification-traversing algorithms for version-specific prioritization.
- Describe ML/ANN model-based prioritization and its advantages over heuristic methods.
- Select the appropriate prioritization type for a given development context.
- Combine general and version-specific prioritization in a single ordered suite.
Prioritization Types vs. Techniques
Session 5.5 established the goals of prioritization. This session covers the types (the scope of information used) and the specific algorithms (techniques) within each type.
| Type | Information Used | Stability | Best For |
|---|---|---|---|
| General Prioritization | Properties of test cases independent of any specific version: coverage, historical FER, execution cost | Stable across versions — recalculate infrequently | Nightly regression; stable products; when change data is unavailable |
| Version-Specific Prioritization | Change information for the current version P′: which code changed, impact analysis results | Changes every version — recalculate per release | CI/CD gates; targeted regression after a specific change; hotfix releases |
| Model-Based Prioritization | Trained ML/statistical model using historical suite + defect + coverage data | Improves over time with more data | Large mature suites (>1,000 cases); products with rich execution history |
Type 1: General Prioritization
General Prioritization
Definition: An ordering of all test cases in the suite based on properties that are independent of any specific software version or change set. The priority order is reusable across multiple regression cycles (with periodic recalculation).
Input data:
- Coverage profile of each case (which statements/branches it exercises).
- Historical fault exposure rate (FER) over the last N runs.
- Execution time of each case.
- Risk and business value ratings (from a stable risk register, not version-specific).
General Prioritization Algorithms
Algorithm 1: Total Coverage Greedy
Principle: Rank each case by its total statement/branch coverage count. Cases covering more code run first.
Advantage: Simple; no iteration needed. Disadvantage: Two cases covering the same 50 branches are equally ranked even though together they cover only 50 branches, not 100. The additional algorithm corrects this.
Algorithm 2: Additional Coverage Greedy (Recommended)
Principle: At each step, select the case that covers the most additional (not yet covered by previously selected cases) branches/statements. This is the greedy set-cover ordering.
Advantage: Maximises coverage rate — the fastest accumulation of coverage as tests execute. Research (Rothermel et al.) shows additional coverage greedy produces APFD values 10–20% higher than total coverage greedy.
Algorithm 3: FER-Based Greedy
Principle: Sort cases by descending historical fault exposure rate. The case most likely to find a defect (based on history) runs first.
Best for: Mature stable products where the code doesn't change much but defect patterns are well-established. Less effective for products under active development where change information should dominate.
Type 2: Version-Specific Prioritization
Version-Specific Prioritization
Definition: An ordering that uses information about the specific change from version P to P′ to rank test cases. Cases that exercise changed code are elevated. This ordering changes with every version and must be recalculated per release.
Input data (version-specific):
- Diff between P and P′: which functions/lines were modified, added, or deleted.
- Impact analysis: which modules depend on the changed module.
- Control/data flow: which test cases exercise the changed paths.
Version-Specific Prioritization Algorithms
Algorithm 4: Change-Impact Prioritization
Principle: Assign each test case a change-impact score based on how much of the changed code it exercises.
Cases with CI = 0 (exercise no changed code) are deprioritized to the end of the queue — but still run. This differs from selection (where CI=0 cases would be excluded).
Algorithm 5: Modification-Traversing (Firewall) Prioritization
Principle: Identify the "firewall" — all modules modified or directly dependent on a modified module. Test cases that traverse the firewall (exercise at least one firewall entity) are elevated to P1.
Advantage: Simpler than CI(ti) calculation; can be performed with module-level impact analysis tools without needing statement-level coverage data for the changed code.
| Algorithm | Granularity | Tool Requirement | Accuracy |
|---|---|---|---|
| Change-Impact (CI score) | Statement/branch level | Statement coverage tool + diff | Highest: precise fraction of changed code exercised |
| Modification-Traversing (Firewall) | Module level | Module dependency graph + diff | Medium: binary (firewall or not) — misses intra-module change proximity |
Type 3: Model-Based Prioritization
Model-Based / ML-Based Prioritization
Concept: Train a predictive model on historical execution data (inputs: test case features, code metrics, coverage; output: probability of failure) and use the model's failure probability prediction as the priority score.
Features used as model inputs:
- Code churn (lines changed per module over recent history)
- Historical failure count for the test case
- Cyclomatic complexity of the changed function
- Test case age (newer tests tend to have higher FER initially)
- Coverage overlap with recently failing cases
- Time since last execution
Model architectures used in research: Logistic regression, random forest, gradient boosting (XGBoost), LSTM (for sequential execution history). LSTM approaches (Spieker et al., 2017) have shown APFD improvements of 15–30% over greedy heuristics on large CI datasets.
- Suite size > 1,000 cases (heuristics degrade; model learns patterns heuristics miss).
- Rich execution history available (≥ 200 historical runs with defect labels).
- Team has ML engineering capacity to build, deploy, and maintain the model.
- APFD gain over greedy > 10% (validate this before committing to model maintenance overhead).
Type Comparison
| Dimension | General | Version-Specific | Model-Based |
|---|---|---|---|
| Recalculation frequency | Per sprint or release | Per commit / change set | Per run (inference) + periodic retraining |
| Data required | Coverage + FER history | Diff + impact analysis | Rich historical execution log |
| Implementation complexity | Low (sort by score) | Medium (requires diff integration) | High (ML pipeline) |
| APFD vs. random | Moderate improvement | High improvement for targeted changes | Highest improvement at scale |
| Robustness to cold start | Good (works with minimal history) | Good (works with any change diff) | Poor (needs significant history) |
| Best suited for | Stable products; nightly regression | Active development; CI gates; hotfixes | Large mature CI systems |
Combining Types in Practice
Real-world CI/CD pipelines typically combine version-specific and general prioritization in a two-tier approach:
Worked Example: Applying Both Types
Scenario: An inventory management system. 8 test cases. Current change: Bug fix in the calculate_reorder_point() function (Module: Stock).
| TC | Feature | Branches | Changed Branches (Δ) | CI Score | FER |
|---|---|---|---|---|---|
| TC-I01 | Reorder point (standard) | B1, B2, B3, B7 | B2, B3 | 2/4 = 0.50 | 0.6 |
| TC-I02 | Reorder point (seasonal) | B1, B3, B4, B7 | B3, B4 | 2/4 = 0.50 | 0.4 |
| TC-I03 | Reorder point (zero lead time) | B2, B3, B5 | B2, B3 | 2/3 = 0.67 | 0.7 |
| TC-I04 | Stock receipt | B6, B8, B9 | (none) | 0.00 | 0.5 |
| TC-I05 | Stock issue | B8, B10, B11 | (none) | 0.00 | 0.3 |
| TC-I06 | Low-stock alert | B7, B12, B13 | B7 (indirect) | 1/3 = 0.33 | 0.8 |
| TC-I07 | Supplier order | B9, B14, B15 | (none) | 0.00 | 0.2 |
| TC-I08 | Audit trail | B16, B17 | (none) | 0.00 | 0.1 |
Changed branches Δ = {B2, B3, B4, B7} (4 total). Note: B7 is touched only indirectly by the fix.
- P1 TC-I03 (CI=0.67, FER=0.7)
- P1 TC-I01 (CI=0.50, FER=0.6) — tie on CI, higher FER wins
- P1 TC-I02 (CI=0.50, FER=0.4)
- P2 TC-I06 (CI=0.33, FER=0.8)
Branches already covered by Tchanged: {B1, B2, B3, B4, B5, B7, B12, B13}.
| Iteration | Selected | New Branches | Reasoning |
|---|---|---|---|
| 1 | TC-I04 | B6, B8, B9 (3 new) | Most new branches; B8,B9 not yet covered |
| 2 | TC-I05 | B10, B11 (2 new) | B8 already covered; 2 new branches |
| 3 | TC-I07 | B14, B15 (2 new) | B9 already covered; 2 new branches |
| 4 | TC-I08 | B16, B17 (2 new) | Last remaining |
- P1 TC-I03 — Reorder point (zero lead time)
- P1 TC-I01 — Reorder point (standard)
- P1 TC-I02 — Reorder point (seasonal)
- P2 TC-I06 — Low-stock alert
- P3 TC-I04 — Stock receipt
- P3 TC-I05 — Stock issue
- P4 TC-I07 — Supplier order
- P4 TC-I08 — Audit trail
All cases that exercise the changed code run in the first 4 positions. If a 30-minute time box only completes TC-I03 to TC-I05, all changed-code coverage is verified and a significant portion of the unchanged code is also checked.
Common Mistakes
General prioritization does not know what changed. A hotfix that modifies the payment module may have high-priority payment tests ranked P3 by general FER if they haven't recently failed. Always use version-specific prioritization for targeted changes.
If CI only runs version-specific P1 cases, the stability regression (unchanged code) is never checked. A change in module A may cause a latent defect in module C to manifest. General prioritization for the unchanged suite is still needed.
General priority is stable across versions. Recalculating it on every commit wastes resources. Recalculate general priority on a schedule (weekly, or after each minimization event). Recalculate version-specific priority on every change.
An ML model trained on 20 execution runs will overfit and perform worse than a simple greedy heuristic. Model-based approaches require at minimum 100–200 historical runs with defect labels to show consistent improvement over heuristics.
Class Activity
apply_coupon() function. Changed statements: S3, S5, S7, S9 (4 statements).
| TC | Feature | Statements Covered | FER |
|---|---|---|---|
| TC-E01 | Apply 10% coupon | S1, S3, S5, S7 | 0.7 |
| TC-E02 | Apply expired coupon | S2, S3, S6 | 0.5 |
| TC-E03 | Apply coupon at threshold | S3, S5, S8, S9 | 0.6 |
| TC-E04 | Apply invalid coupon code | S2, S4, S6 | 0.4 |
| TC-E05 | Apply 50% coupon | S1, S5, S7, S9 | 0.8 |
| TC-E06 | Cart subtotal calculation | S10, S11, S12 | 0.3 |
| TC-E07 | Payment processing | S13, S14, S15 | 0.9 |
| TC-E08 | Order confirmation email | S16, S17 | 0.2 |
| TC-E09 | Apply coupon + loyalty points | S3, S7, S9, S18 | 0.5 |
| TC-E10 | Coupon + free shipping combo | S5, S9, S19, S20 | 0.4 |
- Compute the Change-Impact score CI(ti) for each test case. (|Δ| = 4 changed statements: S3, S5, S7, S9.)
- Partition into Tchanged (CI > 0) and Tunchanged (CI = 0).
- Order Tchanged by descending CI score. Break ties with FER.
- Apply the additional coverage greedy algorithm to Tunchanged. Show all iterations.
- Produce the final combined execution order. If a 20-minute time box fits 6 cases (assume 3-4 min each), which cases are completed? What risk areas are covered?
Exit Ticket
- What is the key difference between general and version-specific prioritization? Give one example of when each should be the dominant approach.
- A test case has CI(t) = 0 after a change. Should it be excluded from the regression run? Justify your answer in terms of the difference between prioritization and selection.
- Describe the "additional coverage greedy" algorithm in 3 steps. Why does it produce higher APFD values than the "total coverage greedy" algorithm?
- Under what conditions would you recommend model-based prioritization over the combined general+version-specific heuristic approach?
Summary & Assignment
Three prioritization types address different information contexts. General prioritization uses stable properties (coverage, FER, execution time) and is recalculated periodically. Version-specific prioritization uses change information (diff, impact analysis) and is recalculated per commit. Model-based prioritization uses trained ML models on historical data for the highest APFD at scale. In practice, the most effective and practical approach combines version-specific ordering for changed-code cases (Tier 1) with additional-coverage-greedy ordering for unchanged-code cases (Tier 2).
- General prioritization: stable, periodic; best for nightly regression on stable products.
- Version-specific: dynamic, per-commit; essential for CI/CD on active development.
- Additional coverage greedy outperforms total coverage greedy for APFD.
- Change-Impact score CI(ti) = |cov(ti) ∩ Δ| / |Δ|; cases with CI > 0 form the version-specific P1 tier.
- Combine both: version-specific Tchanged first; general additional-coverage for Tunchanged.
- Model-based: only justified for suites >1,000 cases with ≥100 historical defect-labelled runs.
- For your mini-project's most recent feature change, compute CI(ti) for all test cases. Report the Tchanged and Tunchanged partition sizes.
- Apply the combined prioritization algorithm (version-specific tier + additional coverage greedy tier) to your suite. Produce the complete ordered list.
- Compare your combined ordering with a FER-only ordering for the same suite. Calculate and compare the estimated APFD for each ordering (assume each test case that exercises a changed branch has a 70% probability of detecting the change-induced defect).
- If your team were to adopt model-based prioritization in the future, what features would you include in the model? What historical data would you need to collect starting now?