# US 12,111,753 B2 · Method, apparatus, and storage medium for generating test cases

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 12,111,753 B2
- Document ID: US12111753B2
- Status: Granted
- Kind: B2
- Application number: 17/834,105
- Filed: 2022-06-07
- Published: 2023-02-23
- Granted: 2024-10-08
- Earliest claimed: 2021-08-18
- Assignees: Xepic Corporation Limited
- Applicants: Xepic Corporation Limited
- Inventors: Wu Huang
- Web page: https://patentgrep.com/patent/US12111753B2

## CPC

- G06F 11/3684: {for test design, e.g. generating new test cases}
- G06F 11/3676: {for coverage analysis}
- G06F 11/3688: {for test execution, e.g. scheduling of test suites}
- G06F 11/3692: {for test results analysis}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for generating test cases. The test cases are used to test a plurality of functional units of a logic system design during a simulation process of the logic system design. The method includes acquiring a constraint for generating test cases, and generating a first set of test cases according to the constraint. The first set of test cases is used to cover a part of the plurality of functional units. The method further includes performing a test on the logic system design based on the first set of test cases, determining uncovered functional units that are not covered by the test and a current coverage of the test, and, in response to the current coverage failing to satisfy a preset test coverage condition, generating a second set of test cases according to the uncovered functional units.

## Claims

### Claim 1

A method for generating test cases, wherein the test cases are used to test a plurality of functional units of a logic system design during a simulation process of the logic system design, the method comprising:
acquiring a constraint for generating test cases;
generating a first set of test cases according to the constraint, wherein the first set of test cases is used to cover a part of the plurality of functional units;
performing a test on the logic system design based on the first set of test cases to obtain a test result;
based on the test result, determining uncovered functional units that are not covered by the test and a current coverage of the test; and
after the current coverage of the test is determined based on the test result, in response to the current coverage failing to satisfy a preset test coverage condition, generating a second set of test cases according to the uncovered functional units.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
continuing to test the logic system design based on the second set of test cases; and
updating the uncovered functional units and the current coverage.

### Claim 3 (depends on 2)

The method of claim 2, further comprising:
ending the test of the logic system design in response to the current coverage satisfying the preset test coverage condition.

### Claim 4 (depends on 1)

The method of claim 1, wherein generating the second set of test cases according to the uncovered functional units comprises:
updating the constraint according to the uncovered functional units to obtain an updated constraint; and
generating the second set of test cases according to the updated constraint.

### Claim 5 (depends on 1)

The method of claim 1, wherein generating the first set of test cases according to the constraint comprises:
generating candidate test cases according to the constraint; and
obtaining the first set of test cases by filtering the candidate test cases.

### Claim 6 (depends on 1)

The method of claim 1, wherein the preset test coverage condition includes that the current coverage is higher than a given threshold.

### Claim 7 (depends on 1)

The method of claim 1, wherein acquiring the constraint for generating test cases comprises:
acquiring an initial constraint for generating test cases; and
parsing the initial constraint to obtain the constraint.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
acquiring a plurality of constraints for generating test cases;
generating, based on the plurality of constraints a plurality of sets of test cases satisfying the preset test coverage condition; and
training a neural network model based on the plurality of constraints, the logical system design, and the plurality of sets of test cases.

### Claim 9 (depends on 1)

The method of claim 1, wherein:
acquiring the constraint for generating the test cases comprises acquiring a constraint input by a user and generating the constraint based on the constraint input; and
generating the first set of test cases according to the constraint comprises:
parsing the constraint to generate a constraint parsing code;
reading the constraint parsing code to obtain candidate test cases; and
generating the first set of test cases according to the candidate test cases.

### Claim 10 (depends on 9)

The method of claim 9,
wherein the constraint is one of a plurality of constraints including a first constraint and a second constraint, the first constraint being different from the second constraint;
the method further comprising:
generating the candidate test cases according to the plurality of constraints;
wherein
generating the first set of test cases according to the candidate test cases further comprises:
filtering the plurality of candidate test cases to obtain the first set of test cases corresponding to the first constraint; and
generating the second set of test cases comprises:
filtering the plurality of candidate test cases to obtain the second set of test cases corresponding to the second constraint.

### Claim 11

An apparatus for generating test cases, wherein the test cases are used to test a plurality of functional units of a logic system design during a simulation process of the logic system design, the apparatus comprising:
a memory storing a set of instructions; and
at least one processor, configured to execute the set of instructions to:
acquire a constraint for generating test cases;
generate a first set of test cases according to the constraint, wherein the first set of test cases is used to cover a part of the plurality of functional units;
perform a test on the logic system design based on the first set of test cases to obtain a test result;
based on the test result, determine uncovered functional units that are not covered by the test and a current coverage of the test; and
after the current coverage of the test is determined based on the test result, in response to the current coverage failing to satisfy a preset test coverage condition, generate a second set of test cases according to the uncovered functional units.

### Claim 12 (depends on 11)

The apparatus of claim 11, wherein the processor is further configured to execute the set of instructions to:
continue to test the logic system design based on the second set of test cases; and
update the uncovered functional units and the current coverage.

### Claim 13 (depends on 12)

The apparatus of claim 12, wherein the processor is further configured to execute the set of instructions to:
end the test of the logic system design in response to the current coverage satisfying the preset test coverage condition.

### Claim 14 (depends on 11)

The apparatus of claim 11, wherein the processor is further configured to execute the set of instructions to:
update the constraint according to the uncovered functional units to obtain an updated constraint; and
generate the second set of test cases according to the updated constraint.

### Claim 15 (depends on 11)

The apparatus of claim 11, wherein the processor is further configured to execute the set of instructions to:
generate candidate test cases according to the constraint; and
obtain the first set of test cases by filtering the candidate test cases.

### Claim 16 (depends on 11)

The apparatus of claim 11, wherein the preset test coverage condition includes that the current coverage is higher than a given threshold.

### Claim 17 (depends on 11)

The apparatus of claim 11, wherein the processor is further configured to execute the set of instructions to:
acquire an initial constraint for generating test cases; and
parse the initial constraint to obtain the constraint.

### Claim 18 (depends on 11)

The apparatus of claim 11, wherein the processor is further configured to execute the set of instructions to:
acquire a plurality of constraints for generating test cases;
generate, based on the plurality of constraints, a plurality of sets of test cases that satisfy the preset test coverage condition; and
train a neural network model based on the plurality of constraints, the logical system design, and the plurality of sets of test cases.

### Claim 19

A non-transitory computer-readable storage medium storing a set of instructions that, when executed by a processor, causes the processor to perform a method for generating test cases, wherein the test cases are used to test a plurality of functional units of a logic system design during a simulation process of the logic system design, the method comprising:
acquiring a constraint for generating test cases;
generating a first set of test cases according to the constraint, wherein the first set of test cases is used to cover a part of the plurality of functional units;
generating a first set of test cases according to the constraint, wherein the first set of test cases is used to cover a part of the plurality of functional units;
performing a test on the logic system design based on the first set of test cases to obtain a test result;
based on the test result, determining uncovered functional units that are not covered by the test and a current coverage of the test; and
after the current coverage of the test is determined based on the test result, in response to the current coverage failing to satisfy a preset test coverage condition, generating a second set of test cases according to the uncovered functional units.
