Unit test case generation method and device, equipment and storage medium

By evaluating and encapsulating the program code to improve code coupling, and generating unit test cases through semantic analysis, the problem of test instability caused by insufficient training data was solved, and the coverage and accuracy of unit tests were improved.

CN121501646APending Publication Date: 2026-02-10ANHUI SANQI JIYU NETWORK TECH CO LTD
0 Cites 3 Cited by

Patent Information

Application Number
CN202511362359.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-23
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing unit test case generation methods suffer from insufficient or biased training data, resulting in a lack of guaranteed stability and reliability of test cases. Traditional manual writing methods consume a lot of time and manpower, affecting project development progress.

Method used

By evaluating the code coupling level of the program code, encapsulating and processing code segments with strong coupling, and combining semantic analysis to determine test boundary values ​​and scenarios, unit test cases are generated.

Benefits of technology

It improves the coverage and accuracy of unit test cases, reduces code coupling and redundant dependencies, and enhances the comprehensiveness and efficiency of test cases.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The embodiment of the invention discloses a unit test case generation method and device, equipment and a storage medium, and the method comprises the steps: receiving a to-be-tested program code, carrying out the structure analysis of the program code, and determining the code dependency information of the program code and the business type corresponding to each code snippet in the program code; performing code coupling degree grade evaluation on the program code according to the code dependency relationship information to obtain a code coupling degree grade, and under the condition that the code coupling degree grade is greater than a preset risk grade, performing packaging processing on code snippets of the same service type in the program code to obtain a plurality of service code sets; and performing semantic analysis on each service code set to determine a test boundary value and a test scene, and generating a unit test case corresponding to each service code set based on the test boundary value and the test scene. The code coupling degree and redundant dependence between codes are reduced, and the comprehensiveness and accuracy of the unit test case are improved.
Need to check novelty before this filing date? Find Prior Art