Test-First Protocol for Deriving Unit Tests from Use Case Specifications - Muhammad Ridho Kurniawan Pratama; Deni Utama; Rauhil Fahmi (This journal is published by the Department of Electrical and Information Engineering, Faculty of Engineering, Universitas Gadjah Mada., 2026)
Early and systematic derivation of unit test scenarios remains challenging in software engineering, particularly in aligning functional requirements with executable tests. Graduate-level observations reveal that most students operate without granular traceability, standardized structures, or alternate flow testing. This study explored a structured test-first protocol that transformed use case specifications into coverage-aware test scenarios by applying object-oriented analysis and design principles. The protocol integrated sequence diagrams via behavioral modeling. Internal logic was extracted from sequence diagrams and visualized using control flow graphs. Basis path testing identified independent paths, serving as foundations for deriving unit test cases using the arrange-act-assert pattern. The “Pay the Order” use case in a hypothetical e-commerce system demonstrated the feasibility of the protocol. Cyclomatic complexity analysis yielded a complexity of 2, indicating that two independent test paths were required for complete coverage. The protocol successfully derived two-unit test cases with 100% basis path coverage, demonstrating complete traceability from functional requirements to unit test scenarios with one-to-one mapping between control flow paths and test cases. Results highlight the protocol’s ability to support early verification and validation processes. Unlike prior works focused on automated system-level test generation, this protocol offers a lightweight, human-centric approach promoting testability, traceability, and strong semantic alignment between requirements and implementation. The protocol is well-suited for educational settings and environments that prioritize traceability. Future research should pursue empirical validation, scalability investigations, semi-automated tool development, domain generalization across paradigms, and longitudinal impact assessment.