--- stepsCompleted: - step-01-detect-mode - step-02-load-context - step-03-risk-and-testability - step-04-coverage-plan - step-05-generate-output lastStep: step-05-generate-output lastSaved: 2026-03-17 workflowType: testarch-test-design inputDocuments: - D:\Development\Tracking_Kits\docs\project-overview.md - D:\Development\Tracking_Kits\docs\architecture.md - D:\Development\Tracking_Kits\docs\module-map.md - D:\Development\Tracking_Kits\docs\development-guide.md - D:\Development\Tracking_Kits\_bmad-output\project-context.md - D:\Development\Tracking_Kits\App\Controllers\Kit\KitController.asp - D:\Development\Tracking_Kits\App\DomainModels\InkjetRecordsRepository.asp - D:\Development\Tracking_Kits\App\Views\Kit\SwitchBoardPurpleEnvelopeEdit.asp - D:\Development\Tracking_Kits\Tests\Test_All.asp --- # Test Design for QA: Purple Envelope Edit and Ballot Range Report **Purpose:** Test execution recipe for QA and devs adding regression coverage for the current purple-envelope edit/report workflow. **Date:** 2026-03-17 **Author:** Daniel Covington **Status:** Draft **Project:** workspace **Related:** See `test-design-architecture.md` for architectural blockers and testability gaps. --- ## Executive Summary **Scope:** Preserve the current behavior of the purple-envelope edit screen, including report content, mixed-format precinct ordering, election-date rendering, color assignment, empty states, and print-only markup boundaries. **Risk Summary:** - Total Risks: 7 (3 high-priority, 4 medium) - Critical Categories: DATA, TECH, BUS **Coverage Summary:** - P0 tests: ~4 - P1 tests: ~6 - P2 tests: ~4 - P3 tests: ~2 manual checks - **Total:** ~16 targeted checks plus 2 manual browser-print checks (~1-1.5 QA weeks) --- ## Not in Scope | Item | Reasoning | Mitigation | | --- | --- | --- | | **ReportMan/PDF exports** | Not part of this feature slice; separate export path and COM dependencies | Covered by existing manual export verification | | **Browser-generated print headers/footers** | Controlled by browser settings, not reliably by page code | Manual print smoke checklist documents expected operator setup | | **Jurisdiction import or unrelated kit workflows** | Outside the current purple-envelope regression target | Existing module-level validation remains separate | --- ## Dependencies & Test Blockers ### Backend/Architecture Dependencies (Pre-Implementation) 1. **Disposable test MDB strategy** - Dev - Pre-implementation - QA needs a resettable database copy or equivalent seed/reset routine. - Without this, controller/repository tests will be brittle and non-repeatable. 2. **Seed dataset for mixed-format precincts** - Dev + QA - Pre-implementation - QA needs representative data for `000x`, numeric, alpha-suffixed, alpha-only, and empty-state precinct cases. - Without this, ordering and aggregation checks will not cover the risky paths. 3. **Controller render harness convention** - Dev - Pre-implementation - QA needs a repeatable way to exercise `SwitchBoardPurpleEnvelopeEdit` and inspect the HTML body under IIS/ASPUnit-compatible flow. - Without this, only repository tests will be automated and the view contract stays manual. ### QA Infrastructure Setup (Pre-Implementation) 1. **ASPUnit extension points** - Add one focused test container for purple-envelope regression checks. - Keep tests deterministic and data-seeded. 2. **Test data fixtures** - Fixture set A: ballot ranges with known low/high numbers. - Fixture set B: mixed-format precinct ordering. - Fixture set C: missing/invalid `Electiondate`. 3. **Windows/IIS smoke environment** - One browser-print smoke pass for report-only printing and repeated-page top spacing. --- ## Risk Assessment ### High-Priority Risks (Score >=6) | Risk ID | Category | Description | Score | QA Test Coverage | | --- | --- | --- | --- | --- | | **R-001** | DATA | Mixed-format precinct ordering changes | **6** | Seeded render assertions for both color table and report table | | **R-002** | DATA | Wrong low/high ballot aggregation per precinct | **6** | Repository aggregation tests plus rendered-value checks | | **R-006** | TECH | No isolated fixture/reset path for stable tests | **6** | Test harness readiness criteria and pre-test reset validation | ### Medium/Low-Priority Risks | Risk ID | Category | Description | Score | QA Test Coverage | | --- | --- | --- | --- | --- | | R-003 | BUS | Election date renders incorrectly or crashes on bad input | 4 | Valid/missing/invalid setting render checks | | R-004 | OPS | Print-only scope or top spacing regresses | 4 | HTML/CSS assertions plus manual print smoke | | R-005 | BUS | Color-assignment actions regress while report tests are added | 4 | POST regression checks for kit-wide and precinct-specific updates | | R-007 | BUS | Empty precinct state breaks current report contract | 4 | Explicit no-data render check | --- ## Entry Criteria - [ ] Disposable test MDB or equivalent reset strategy available - [ ] Mixed-format precinct fixtures agreed and documented - [ ] IIS-accessible test path for controller/render verification available - [ ] Existing `Tests/Test_All.asp` runner still executes successfully - [ ] Manual Windows browser available for final print smoke ## Exit Criteria - [ ] All P0 checks passing - [ ] All P1 checks passing or formally triaged - [ ] No open high-risk regression on ordering, aggregation, or data header behavior - [ ] HTML render contract validated for empty state and report-only print container - [ ] Manual print smoke completed for report-only output and repeated-page spacing --- ## Test Coverage Plan **Note:** P0/P1/P2/P3 represent priority and risk, not execution timing. ### P0 (Critical) **Criteria:** Preserves operator-facing data correctness and high-risk regression paths with no acceptable workaround. | Test ID | Requirement | Test Level | Risk Link | Notes | | --- | --- | --- | --- | --- | | **P0-001** | Report shows correct jurisdiction/JCode and formatted election label for seeded valid data | Integration | R-003 | Assert rendered HTML content | | **P0-002** | Mixed-format precincts render in the approved ascending order | Integration | R-001 | Cover `000x`, numeric, alpha-suffixed, alpha-only | | **P0-003** | Each precinct shows correct low/high ballot numbers from seeded records | Integration | R-002 | Assert repository output and rendered HTML | | **P0-004** | Empty precinct dataset renders current no-data message instead of broken markup | Integration | R-007 | Protect empty-state contract | **Total P0:** ~4 tests --- ### P1 (High) **Criteria:** Preserves important same-screen workflows and print-related regressions with moderate-to-high operational impact. | Test ID | Requirement | Test Level | Risk Link | Notes | | --- | --- | --- | --- | --- | | **P1-001** | `AssignKitColorPost` updates all `InkjetRecords.ColorId` rows for the kit | Integration | R-005 | Seeded DB verification | | **P1-002** | `AssignPrecinctColorsPost` updates only the targeted precinct rows | Integration | R-005 | Ensure no cross-precinct bleed | | **P1-003** | Missing `Electiondate` does not error and leaves report date blank | Integration | R-003 | Assert safe fallback | | **P1-004** | Invalid `Electiondate` value preserves non-crashing fallback behavior | Integration | R-003 | Use non-date string fixture | | **P1-005** | Print container isolates the report section in markup/CSS | Integration | R-004 | Assert presence of `#purple-envelope-report-print` rules | | **P1-006** | `Ready To Assign STIDS` status still gates the existing form block | Integration | R-005 | Regression for same-screen conditional behavior | **Total P1:** ~6 tests --- ### P2 (Medium) **Criteria:** Lower-risk formatting and regression checks that still help freeze today’s behavior. | Test ID | Requirement | Test Level | Risk Link | Notes | | --- | --- | --- | --- | --- | | **P2-001** | Full-year format renders as `Mon-YYYY` for valid election dates | Integration | R-003 | Example `May-2026` | | **P2-002** | Print spacer row and top buffer CSS remain present | Integration | R-004 | Markup/CSS contract only | | **P2-003** | Report font-size contract remains at current reduced print size | Integration | R-004 | CSS assertion | | **P2-004** | Color table and report table stay aligned on precinct order | Integration | R-001 | Prevent divergent ordering paths | **Total P2:** ~4 tests --- ### P3 (Low) **Criteria:** Manual, browser-dependent, or release-smoke-only validation. | Test ID | Requirement | Test Level | Notes | | --- | --- | --- | --- | | **P3-001** | Browser print preview shows only the report section | Manual Browser | Requires operator print settings | | **P3-002** | Page 2+ maintains visible top breathing room in print preview | Manual Browser | Validate on Windows/IIS browser | **Total P3:** ~2 checks --- ## Execution Strategy ### Every PR: ASPUnit + seeded render/repository checks (~5-10 min) - Run the existing `Tests/Test_All.asp` suite - Run the new purple-envelope regression container against disposable seeded data - Keep automated checks focused on repository correctness and rendered HTML contract ### Nightly: expanded seeded regression pass (~10-20 min) - Re-run the purple-envelope suite against larger mixed-format datasets - Include any fixture-reset verification and broader same-screen regression checks ### Weekly or Pre-Release: manual Windows/IIS print smoke (~15-30 min) - Confirm report-only printing - Confirm repeated-page top spacing - Confirm browser-dependent behavior still matches operator expectations --- ## QA Effort Estimate | Priority | Count | Effort Range | Notes | | --- | --- | --- | --- | | P0 | ~4 | ~8-12 hours | Core seeded render/aggregation checks | | P1 | ~6 | ~10-16 hours | POST regressions, fallbacks, print markup | | P2 | ~4 | ~6-10 hours | Formatting and alignment checks | | P3 | ~2 | ~2-4 hours | Manual print verification | | **Total** | ~16 | **~26-42 hours** | **~1-1.5 QA weeks** | **Assumptions:** - Disposable fixture/reset path is provided early. - Tests reuse existing ASPUnit conventions instead of introducing a new framework. - Manual print validation remains intentionally small and release-focused. --- ## Implementation Planning Handoff | Work Item | Owner | Target Milestone (Optional) | Dependencies/Notes | | --- | --- | --- | --- | | Add disposable MDB copy/reset process for purple-envelope tests | Dev | Sprint next | Required before automation | | Add repository regression tests for ballot range aggregation | Dev/QA | Sprint next | Uses fixture set A | | Add controller/render assertions for report HTML and sort order | Dev/QA | Sprint next | Uses fixture sets A/B/C | | Add manual print smoke checklist to release flow | QA | Pre-release | Browser-dependent only | --- ## Tooling & Access | Tool or Service | Purpose | Access Required | Status | | --- | --- | --- | --- | | IIS-hosted local app | Execute controller/render tests | Windows + IIS site access | Ready | | Disposable MDB copy | Stable seeded data | File-system access to test DB copy | Pending | | ASPUnit runner | Automated regression execution | Existing `Tests/Test_All.asp` access | Ready | | Windows browser print preview | Manual print smoke | Local browser access | Ready | **Access requests needed (if any):** - [ ] Disposable test database path and reset ownership confirmed --- ## Interworking & Regression | Service/Component | Impact | Regression Scope | Validation Steps | | --- | --- | --- | --- | | **KitController** | Orchestrates page model and POST actions | Existing edit page behavior plus report additions | Render and POST regression checks | | **InkjetRecordsRepository** | Supplies precinct lists, aggregation, and color updates | Ordering-sensitive and data-sensitive queries | Seeded repository assertions | | **SettingsRepository** | Supplies `Electiondate` | Header formatting/fallback | Valid/missing/invalid setting cases | | **SwitchBoardPurpleEnvelopeEdit.asp** | Final HTML/print contract | Report-only container, table content, empty state | HTML response assertions + manual print smoke | **Regression test strategy:** - Existing `Tests/Test_All.asp` must still pass. - New seeded regression checks should run before release on any change touching the purple-envelope screen, repository, or print CSS. - Manual Windows print smoke remains required for print-affecting changes. --- ## Appendix A: Code Examples & Tagging For this repo, prefer ASPUnit naming aligned to the existing suite rather than Playwright tagging: - `PurpleEnvelopeReport_Should_Render_ElectionDate` - `PurpleEnvelopeReport_Should_Sort_MixedPrecincts_Ascending` - `PurpleEnvelopeReport_Should_Show_BallotRanges_PerPrecinct` - `AssignPrecinctColors_Should_Update_Only_TargetPrecinct` Keep tests deterministic: - Seed explicit fixture data - Assert HTML or repository outputs directly - Avoid browser timing waits in automated checks --- ## Appendix B: Knowledge Base References - `risk-governance.md` - `probability-impact.md` - `test-levels-framework.md` - `test-priorities-matrix.md` - `test-quality.md` --- **Generated by:** BMad TEA Agent **Workflow:** `_bmad/tea/testarch/bmad-testarch-test-design` **Mode:** System-level (brownfield feature scope)