A Test-Driven Approach for Refining Use Case Specifications of Software Requirements with LLMs
摘要
Requirements described in natural language often require manual organization to align with specifications for test case generation. Similarly, when test cases are modified or enhanced, corresponding updates to the requirements must be performed manually to maintain consistency across design and development. UML use case specifications use textual descriptions to define scenarios and behaviors that achieve user goals. However, existing practices heavily rely on manual efforts to create and maintain use case specifications, leading to inefficiencies and potential inconsistencies. To address these issues, we propose a test-driven approach to further refine UML use case specifications, leveraging large language models (LLMs) to facilitate the synchronization of natural language requirements, UML specifications, and test cases. We introduce a structured format that enables LLMs to transform ambiguous natural language requirements into precise use case specifications compliant with UML, from which test cases can be automatically generated. Conversely, modifications to test cases are propagated back to update the corresponding use cases, ensuring bidirectional consistency. This iterative feedback loop continuously refines use case specifications, enhancing their accuracy and alignment with evolving requirements. Experimental evaluation on two real-world software projects demonstrates the practical application of our approach.