Skip to content

Latest commit

 

History

History
67 lines (58 loc) · 4.15 KB

Testing-Strategy.md

File metadata and controls

67 lines (58 loc) · 4.15 KB

Industrial Evidence Chain — Testing Strategy & Verification Plan

1. Testing Philosophy & Multi-Tier Methodology

The Industrial Evidence Chain testing regimen employs a defense-in-depth quality assurance strategy spanning four automated testing tiers:

+-----------------------------------------------------------------------------------+
|                           TESTING PYRAMID HIERARCHY                               |
+-----------------------------------------------------------------------------------+
|  Tier 4: Live Research Benchmarks & Stress Tests                                  |
|          - Python Benchmark Harness (tests/benchmark_suite.py)                    |
|          - Statistical Latency Distribution, Jitter, and Throughput                |
+-----------------------------------------------------------------------------------+
|  Tier 3: End-to-End Integration Test Suite                                        |
|          - Python Full Lifecycle Harness (tests/verify_api.py)                     |
|          - Auth -> QR Resolve -> Ingest -> Media -> Anchor -> Tamper -> Verify    |
+-----------------------------------------------------------------------------------+
|  Tier 2: Backend Integration & Controller Tests                                   |
|          - IndustrialEvidenceChain.IntegrationTests                               |
|          - WebApplicationFactory, In-Memory / Test DB, HTTP pipeline testing      |
+-----------------------------------------------------------------------------------+
|  Tier 1: Core Unit Tests                                                          |
|          - IndustrialEvidenceChain.UnitTests                                      |
|          - Cryptographic Canonicalization, SHA-256 Hasher, ECDSA Digital Signature |
+-----------------------------------------------------------------------------------+

2. Test Suite Specifications

2.1 Tier 1: Core Cryptographic Unit Tests (IndustrialEvidenceChain.UnitTests)

  • Framework: xUnit (2.9.3), FluentAssertions, Moq
  • Focus Areas:
    • EvidenceHashServiceTests: Asserts deterministic key sorting, whitespace elimination, coordinate normalization (6 decimals), and byte-for-byte SHA-256 digest reproducibility.
    • DigitalSignatureServiceTests: Asserts ECDSA NIST P-256 keypair generation, valid signature verification, and signature rejection upon payload tampering.
    • AssetServiceTests: Asserts asset code uniqueness and status transition validation.

2.2 Tier 2: API Integration Tests (IndustrialEvidenceChain.IntegrationTests)

  • Framework: Microsoft.AspNetCore.Mvc.Testing
  • Focus Areas:
    • JWT Token generation and claims extraction.
    • Role-Based Access Control enforcement across all HTTP verbs.
    • Media upload streaming, 50MB file size limits, and MIME type validation.

2.3 Tier 3: End-to-End Integration Verification (tests/verify_api.py)

  • Runtime: Python 3.11 with requests library.
  • Workflow:
    1. Authenticates as Field Technician (tech@proofchain.local).
    2. Queries and validates industrial assets.
    3. Creates a new maintenance evidence record with GPS coordinates.
    4. Generates a synthetic inspection image and uploads to evidence media endpoint.
    5. Submits evidence record and captures canonical SHA-256 hash.
    6. Authenticates as Maintenance Manager (manager@proofchain.local) and anchors hash to ledger.
    7. Executes verification check: asserts VERIFIED status.
    8. Authenticates as System Admin (admin@proofchain.local) and invokes tamper endpoint on evidence description.
    9. Re-executes verification check: asserts INTEGRITY_MISMATCH status and tamper flag.

2.4 Tier 4: Quantitative Research Benchmarking Suite (tests/benchmark_suite.py)

  • Runtime: Python 3.11 with scipy / numpy statistics.
  • Focus Areas:
    • SHA-256 Canonical Hashing latency across 20 consecutive iterations.
    • Blockchain Anchoring latency across 15 consecutive transactions.
    • Verification & Ledger Query latency across 20 consecutive checks.
    • Tamper Detection Accuracy rate across 15 deliberate database mutations.
    • Storage Footprint Efficiency comparison (On-Chain vs. Off-Chain).