Unit test case automatic generation method and device based on preferred iteration feedback

By employing deep dependency analysis and coverage threshold optimization iteration mechanisms, the redundancy and instability issues in unit test case generation within the CIM system were resolved. This enabled the efficient generation of high-quality, high-coverage unit test cases, thereby improving the software quality and R&D efficiency of the CIM system.

CN122111872APending Publication Date: 2026-05-29上海朋熙半导体股份有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
上海朋熙半导体股份有限公司
Filing Date
2026-04-30
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing AI-driven unit test case generation methods in CIM systems suffer from redundant context inputs, low generation accuracy, and unstable iterative optimization, resulting in slow code coverage improvement and difficulty in generating high-quality, high-coverage test cases.

Method used

By extracting necessary reference code through deep dependency analysis, combining iterative optimization of coverage thresholds, accurately filtering external reference information, constructing an internal dependency view, generating unit test cases using AI models, and ensuring the legality and coverage of the generated test cases through a closed-loop feedback path of syntax validity verification and coverage iteration optimization.

Benefits of technology

It significantly improved the first-time compilation pass rate and runnability of unit test cases, steadily increased coverage, shortened the development cycle, reduced project launch risks, and improved the software quality and development efficiency of the CIM system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122111872A_ABST
    Figure CN122111872A_ABST
Patent Text Reader

Abstract

The application provides a unit test case automatic generation method and device based on preferred iteration feedback, which comprises the following steps: setting a target module identifier and a target code coverage rate of a test case to be generated; extracting source code of the target module and necessary reference code; encapsulating the source code of the target module, the necessary reference code, a project status, a requirement description and feedback information into a template prompt word, inputting the template prompt word into an AI model to generate a unit test case; performing iteration legality verification and / or correction on the generated unit test case until the unit test case passes the compilation; executing the test case that passes the compilation to obtain a current code coverage rate and un-covered code information; judging whether the code coverage rate of the unit test case that passes the compilation is greater than a cached historical highest coverage rate; and judging whether the code coverage rate of the highest coverage rate test case obtained is greater than the target code coverage rate. The application can efficiently generate a unit test case with high quality, high coverage rate and operability.
Need to check novelty before this filing date? Find Prior Art