STD: Quantity Weight Rule (QTYWEIGHT)
Version: v1.0.0
Status: Draft
SRS Source: docusaurus/docs/srs/rules/rule-quantity-weight.md
Rule Name: TISSUE_WEIGHT
Domain: RULES-QTYWEIGHT
Overview
This document specifies tests for the Quantity Weight rule using decision tables and test vectors. The rule normalizes observation quantities by dividing by twice the tissue weight value during run analysis.
Rule Characteristics:
- Pure business logic (no UI)
- Simple guard clause logic (null/zero/non-numeric checks)
- Fixed formula with no configurable parameters
- Error generation for malformed input
Test Method: TM-API (per Test Plan Section 3.3 - 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. This format enables exhaustive condition coverage while remaining concise and auditable.
Coverage Summary
| REQ ID | Title | Conditions | Test Vectors | Coverage | Gaps |
|---|
| REQ-RULES-QTYWEIGHT-001 | Normalize Quantity Using Tissue Weight | 5 | 8 | 100% | None |
| REQ-RULES-QTYWEIGHT-002 | Generate Error for Invalid Tissue Weight | 2 | 3 | 100% | None |
Totals: 2 REQs, 7 Conditions, 11 Test Vectors, 100% Coverage
REQ-RULES-QTYWEIGHT-001: Normalize Quantity Using Tissue Weight
| Variable | Type | Valid Values | Description |
|---|
well.tissue_weight | string/float/null | null, "0", 0, positive numeric, non-numeric string | Tissue weight property from well |
obs.quantity | float/null | null, any numeric | Observation quantity to normalize |
Output Variables
| Variable | Type | Description |
|---|
obs.quantity | float/null | Normalized quantity (or unchanged if skipped) |
rule_executed | bool | Whether calculation was performed |
Decision Table: Guard Clause - Tissue Weight Null
| TV | tissue_weight | quantity | expected_quantity | rule_executed | Covers |
|---|
| TV-001-001 | null | 100 | 100 | false | AC: Tissue weight null - skip, preserve quantity |
Decision Table: Guard Clause - Tissue Weight Zero
| TV | tissue_weight | quantity | expected_quantity | rule_executed | Covers |
|---|
| TV-001-002 | 0 | 100 | 100 | false | AC: Tissue weight zero - skip, preserve quantity |
| TV-001-003 | 0.0 | 50 | 50 | false | AC: Tissue weight zero (float) - skip |
Decision Table: Guard Clause - Quantity Null
| TV | tissue_weight | quantity | expected_quantity | rule_executed | Covers |
|---|
| TV-001-004 | 0.1 | null | null | false | AC: Quantity null - skip, preserve null |
Decision Table: Valid Calculation
| TV | tissue_weight | quantity | expected_quantity | calculation | Covers |
|---|
| TV-001-005 | 0.1 | 100 | 500 | 100 / (2 x 0.1) = 500 | AC: Valid inputs - calculate normalized quantity |
| TV-001-006 | 0.5 | 200 | 200 | 200 / (2 x 0.5) = 200 | AC: Different values - formula applied |
| TV-001-007 | 1.0 | 100 | 50 | 100 / (2 x 1.0) = 50 | AC: Tissue weight = 1 - halves quantity |
| TV-001-008 | 0.25 | 10 | 20 | 10 / (2 x 0.25) = 20 | AC: Small values - precision preserved |
Decision Table: Boundary Values
| TV | tissue_weight | quantity | expected_quantity | rule_executed | Covers |
|---|
| TV-001-009 | 0.001 | 1 | 500 | true | AC: Very small tissue weight |
| TV-001-010 | 100 | 1000 | 5 | true | AC: Large tissue weight |
REQ-RULES-QTYWEIGHT-002: Generate Error for Invalid Tissue Weight
| Variable | Type | Valid Values | Description |
|---|
well.tissue_weight | string | Non-numeric string (e.g., "ab", "test") | Invalid tissue weight value |
Output Variables
| Variable | Type | Description |
|---|
well.error_code | string | INVALID_TISSUE_WEIGHT error code |
error_level | string | Well (error applied at well level) |
Decision Table: Non-Numeric Tissue Weight
| TV | tissue_weight | expected_error | error_level | Covers |
|---|
| TV-002-001 | "ab" | INVALID_TISSUE_WEIGHT | Well | AC: Non-numeric string - error generated |
| TV-002-002 | "test123" | INVALID_TISSUE_WEIGHT | Well | AC: Alphanumeric string - error generated |
| TV-002-003 | " " | INVALID_TISSUE_WEIGHT | Well | AC: Whitespace - error generated |
Decision Table: Distinction Between Skip and Error
This table clarifies the boundary between REQ-001 (skip) and REQ-002 (error) behaviors:
| TV | tissue_weight | behavior | reason | Covers |
|---|
| TV-CROSS-001 | null | skip | Missing data - not malformed | REQ-001 AC |
| TV-CROSS-002 | 0 | skip | Zero value - division undefined | REQ-001 AC |
| TV-CROSS-003 | "ab" | error | Malformed data - requires correction | REQ-002 AC |
| TV-CROSS-004 | "0.5" | calculate | Numeric string - valid | REQ-001 AC |
| TV-CROSS-005 | 0.5 | calculate | Numeric value - valid | REQ-001 AC |
Traceability to Existing Tests
| Requirement | Jira Tests | Status |
|---|
| REQ-RULES-QTYWEIGHT-001 | BT-5243 | Existing |
| REQ-RULES-QTYWEIGHT-002 | BT-4167 | Existing |
Gap Analysis
Identified Gaps
| Gap | Requirement | Description | Priority | Owner |
|---|
| None | - | All acceptance criteria covered by test vectors | - | - |
Coverage Notes
- All guard clause conditions have dedicated test vectors
- Calculation formula verified with multiple input combinations
- Boundary values tested (very small and large tissue weights)
- Error vs skip distinction explicitly tested
- Existing Jira test tickets provide traceability