Code Testing Method for Single Object Segmentation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current software testing methods generate test cases that include multiple objects under test, leading to execution exceptions and poor test effectiveness due to random operation ordering.
Innovation Solution
A code testing method that determines member variables and constructs operation calling statement sequences for each object under test, creating initial test cases and then reconstructing target test cases to improve coverage and stability by focusing on individual objects.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of manufacture
If one test case includes multiple objects under test with random operation ordering, then test case generation is simpler, but execution exceptions occur easily and test effect is poor
Solution Approach 1:
The patent divides the test case into multiple independent units, each targeting a single object under test. This segmentation prevents the complexity and random ordering issues that arise when multiple objects are mixed in one test case, thereby improving execution stability while maintaining generation simplicity through automated single-object processing
2Reliability
If one test case includes multiple objects under test, then test coverage can be achieved, but test case complexity increases and execution stability decreases
Solution Approach 1:
The patent segments test cases by object, creating distinct test units for each object under test. This approach maintains comprehensive coverage through systematic generation of test cases for all objects while reducing structural complexity by eliminating the need to manage multiple objects within a single test case
Solution Approach 2:
The test case generation system automatically creates test cases based on object analysis, eliminating the need for manual construction of complex multi-object test cases. The system self-generates appropriate test structures for each object, reducing overall complexity while maintaining coverage
3Productivity
If random operation ordering is used in test cases, then test case construction is faster, but execution exceptions occur and test effect deteriorates
Solution Approach 1:
The patent performs preliminary analysis of each object to determine the correct operation sequence before generating test cases. This preliminary action ensures operations are executed in the proper order, preventing execution exceptions while maintaining fast automated generation through systematic rather than random ordering
Data Source
AI summary
The present specification discloses a code testing method and apparatus. The code testing method includes: determining, for each object under test, all member variables corresponding to the object under test and a variable calling statement corresponding to each member variable, and constructing an operation calling statement sequence based on a calling order corresponding to operations under test included in the object under test; constructing an initial test case corresponding to the object under test based on the variable calling statements and the operation calling statement sequence, each initial test case corresponding to only one object under test; and determining a target test case based on each initial test case, and testing to-be-tested code by using the target test case.


