STD: Repeat Sample Check Rule (WREP)
Version: v1.0.0 Status: Draft SRS Source:
docusaurus/docs/srs/rules/rule-repeat-sample.mdRule Name: WREP Domain: RULES-REPEATSAMP
Overview
This document specifies tests for the Repeat Sample Check rule (WREP) using decision tables and test vectors. The rule validates classification and quantitative consistency between repeat samples of the same sample/mix combination.
Rule Characteristics:
- Pure business logic (no UI)
- Sequential decision flow: first-time check, classification match, quantitative threshold
- Single configuration parameter (Log(Quant) threshold)
- Uses most recent historical sample for comparison
Test Method: TM-API (per Test Plan - Rules use automated API tests)
Automation Status: Automated
Verification Approach: Rule verification is performed using data-driven test vectors. Each row in a decision table represents a complete verification scenario with defined inputs and expected outputs. The decision tables exhaustively cover first-time handling, classification matching, quantitative consistency, boundary conditions, and error paths.
Coverage Summary
| REQ ID | Title | Conditions | Test Vectors | Coverage | Gaps |
|---|---|---|---|---|---|
| REQ-RULES-REPEATSAMP-001 | Validate Repeat Sample Consistency | 11 | 15 | 100% | None |
Totals: 1 REQ, 11 Conditions, 15 Test Vectors, 100% Coverage
REQ-RULES-REPEATSAMP-001: Validate Repeat Sample Consistency
Input Variables
| Variable | Type | Valid Values | Description |
|---|---|---|---|
is_first_time | bool | true, false | Whether this sample/mix combination has been tested before |
historical_data_available | bool | true, false | Whether historical data is accessible |
current.classification | string | Pos, Neg | Current sample classification |
previous.classification | string | Pos, Neg | Previous sample classification (most recent) |
current.log_quant | float | numeric | Log(Quant) of current sample |
previous.log_quant | float | numeric | Log(Quant) of previous sample |
threshold | float | 0.5 (default) | Configured wrep_log_quant_threshold |
Output Variables
| Variable | Type | Description |
|---|---|---|
result | string | pass, skip, error |
error_code | string? | WREP_CLASSIFICATION_MISMATCH, WREP_QUANT_THRESHOLD_EXCEEDED, null |
Derived Variables
| Variable | Formula | Description |
|---|---|---|
log_quant_diff | ABS(current.log_quant - previous.log_quant) | Absolute difference in Log(Quant) values |
Decision Table: First-Time Sample Handling
Tests AC: First-time samples bypass validation.
| TV | is_first_time | historical_data_available | result | error_code | Covers |
|---|---|---|---|---|---|
| TV-001-001 | true | N/A | skip | null | AC: First-time sample bypasses validation |
| TV-001-002 | false | false | skip | null | AC: Unavailable history treated as first-time |
Decision Table: Classification Matching
Tests AC: Classification mismatch triggers error; matching classifications proceed to next check.
Precondition: is_first_time = false AND historical_data_available = true
| TV | current.classification | previous.classification | classifications_match | result | error_code | Covers |
|---|---|---|---|---|---|---|
| TV-001-003 | Pos | Neg | false | error | WREP_CLASSIFICATION_MISMATCH | AC: Classification mismatch |
| TV-001-004 | Neg | Pos | false | error | WREP_CLASSIFICATION_MISMATCH | AC: Classification mismatch (reverse) |
| TV-001-005 | Neg | Neg | true | pass | null | AC: Negative match passes (no quant check) |
| TV-001-006 | Pos | Pos | true | (continue) | - | AC: Positive match continues to quant check |
Decision Table: Quantitative Consistency (Positive Samples)
Tests AC: Log(Quant) difference exceeding threshold triggers error; within threshold passes.
Precondition: is_first_time = false AND historical_data_available = true AND current.classification = Pos AND previous.classification = Pos
| TV | current.log_quant | previous.log_quant | threshold | log_quant_diff | result | error_code | Covers |
|---|---|---|---|---|---|---|---|
| TV-001-007 | 3.0 | 2.0 | 0.5 | 1.0 | error | WREP_QUANT_THRESHOLD_EXCEEDED | AC: Exceeds threshold |
| TV-001-008 | 3.0 | 2.6 | 0.5 | 0.4 | pass | null | AC: Within threshold |
| TV-001-009 | 3.0 | 3.5 | 0.5 | 0.5 | pass | null | AC: Exactly at threshold (boundary) |
| TV-001-010 | 3.0 | 3.501 | 0.5 | 0.501 | error | WREP_QUANT_THRESHOLD_EXCEEDED | AC: Just over threshold (boundary) |
Decision Table: Threshold Configuration
Tests AC: System uses configured threshold for comparison.
Precondition: is_first_time = false AND current.classification = Pos AND previous.classification = Pos
| TV | current.log_quant | previous.log_quant | threshold | log_quant_diff | result | error_code | Covers |
|---|---|---|---|---|---|---|---|
| TV-001-011 | 3.0 | 2.0 | 1.5 | 1.0 | pass | null | AC: Custom threshold - within |
| TV-001-012 | 3.0 | 1.0 | 1.5 | 2.0 | error | WREP_QUANT_THRESHOLD_EXCEEDED | AC: Custom threshold - exceeds |
Decision Table: Negative Sample Bypass
Tests AC: Quantitative check bypassed for negative samples.
Precondition: is_first_time = false AND classifications_match = true
| TV | current.classification | previous.classification | current.log_quant | previous.log_quant | quant_check_performed | result | Covers |
|---|---|---|---|---|---|---|---|
| TV-001-013 | Neg | Neg | N/A | N/A | false | pass | AC: Negative bypasses quant check |
| TV-001-014 | Pos | Pos | 3.0 | 2.4 | true | pass | AC: Positive performs quant check |
Decision Table: History Selection
Tests AC: Most recent sample used when multiple exist.
| TV | history_samples | selected_for_comparison | Covers |
|---|---|---|---|
| TV-001-015 | [S1(date=2025-01-01, cls=Pos), S2(date=2025-01-15, cls=Neg)] | S2 | AC: Most recent sample selected |
End-to-End Scenarios
Scenario Matrix
Complete verification scenarios combining all conditions:
| TV | is_first_time | hist_avail | curr.cls | prev.cls | curr.lq | prev.lq | threshold | result | error_code |
|---|---|---|---|---|---|---|---|---|---|
| E2E-001 | true | - | - | - | - | - | - | skip | null |
| E2E-002 | false | false | - | - | - | - | - | skip | null |
| E2E-003 | false | true | Pos | Neg | - | - | - | error | WREP_CLASSIFICATION_MISMATCH |
| E2E-004 | false | true | Neg | Neg | - | - | - | pass | null |
| E2E-005 | false | true | Pos | Pos | 3.0 | 2.0 | 0.5 | error | WREP_QUANT_THRESHOLD_EXCEEDED |
| E2E-006 | false | true | Pos | Pos | 3.0 | 2.8 | 0.5 | pass | null |
Traceability to Acceptance Criteria
| AC Category | Acceptance Criterion | Test Vectors |
|---|---|---|
| First-Time Handling | First-time sample bypasses validation | TV-001-001 |
| First-Time Handling | Unavailable history treated as first-time | TV-001-002 |
| Classification Matching | Classification mismatch triggers error | TV-001-003, TV-001-004 |
| Classification Matching | Matching negative samples pass | TV-001-005 |
| Quantitative Consistency | Quant check only for positive samples | TV-001-013, TV-001-014 |
| Quantitative Consistency | Exceeds threshold triggers error | TV-001-007, TV-001-010, TV-001-012 |
| Quantitative Consistency | Within threshold passes | TV-001-008, TV-001-011 |
| Threshold Calculation | Uses absolute difference formula | TV-001-007 through TV-001-012 |
| Boundary | Exactly at threshold passes | TV-001-009 |
| History Selection | Most recent sample used | TV-001-015 |
Supplementary Gap-Fill Tests
| TC | Description | Covers |
|---|---|---|
| TC-REPEATSAMP-G-001A | First-time Pos sample bypasses repeat sample check | AC: First-time positive sample, no prior history |
| TC-REPEATSAMP-G-001B | First-time Neg sample bypasses repeat sample check | AC: First-time negative sample, no prior history |
| TC-REPEATSAMP-G-002 | Hardcoded 0.5 threshold triggers WREP error (KCI) | AC: Threshold is hardcoded, not configurable |
| TC-REPEATSAMP-G-003A | Multiple historical Pos runs within threshold do not trigger WREP | AC: Within-threshold quant diff across history |
| TC-REPEATSAMP-G-003B | Multiple historical Neg runs with matching cls do not trigger WREP | AC: Matching negative classifications across history |
Gap Analysis
Identified Gaps
| Gap | Description | Priority | Status |
|---|---|---|---|
| None | All acceptance criteria covered by test vectors | - | - |
Coverage Notes
- All 11 acceptance criteria from REQ-RULES-REPEATSAMP-001 are covered
- Boundary conditions at threshold value tested (TV-001-009, TV-001-010)
- Both directions of classification mismatch tested (Pos/Neg and Neg/Pos)
- Custom threshold configuration verified (TV-001-011, TV-001-012)
- Negative sample bypass explicitly verified (TV-001-013)