LLMCFG-TGen: Using LLM-Generated Control Flow Graphs to Automatically Create Test Cases from Use Cases

· Source: cs.SE updates on arXiv.org · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering · Depth: Expert, extended

Summary

LLMCFG-TGen is an end-to-end approach designed to automatically generate comprehensive and accurate test cases directly from Natural Language (NL) use-case descriptions. This method addresses limitations in current LLM-based test generation, which often struggle with coverage and complex conditional logic. LLMCFG-TGen operates in three steps: an LLM first transforms a use case into a structured, JSON-based Control Flow Graph (CFG), which is then explored to extract all complete execution paths. Finally, these paths are used to create detailed test cases. Evaluated across four multi-domain datasets comprising 42 use cases, the system demonstrated high accuracy in CFG generation, achieving an average node-level F1 score of 0.895 and an nGED of 0.933 compared to manually constructed CFGs. It achieved full path coverage with a 2.38% discrepancy rate and an average absolute difference of 0.02 in test case counts, outperforming baseline methods. Practitioner feedback confirmed the logical consistency, comprehensiveness, and significant reduction in manual effort.

Key takeaway

For QA managers and test engineers seeking to automate test case generation from natural language use cases, LLMCFG-TGen offers a robust solution. By leveraging LLM-generated Control Flow Graphs, this approach ensures comprehensive path coverage and significantly reduces manual effort compared to traditional or direct LLM methods. You should consider integrating this CFG-guided pipeline to produce logically consistent, non-redundant test suites, improving overall software quality and accelerating your testing cycles.

Key insights

Coupling LLM semantic reasoning with structured Control Flow Graph modeling effectively bridges NL requirements to systematic test generation.

Principles

Method

An LLM generates a JSON-based CFG from NL use cases, which is then traversed via DFS to extract execution paths. These paths are finally converted into detailed test cases by an LLM.

In practice

Topics

Code references

Best for: AI Engineer, NLP Engineer, Research Scientist, AI Scientist, Software Engineer, Machine Learning Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by cs.SE updates on arXiv.org.