# US 2022/0129371 A1 · Initialization Sequences for Automatic Software Test Generation

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

- Number: US 2022/0129371 A1
- Document ID: US20220129371A1
- Status: Published application
- Kind: A1
- Application number: 17/080,029
- Filed: 2020-10-26
- Published: 2022-04-28
- Earliest claimed: 2020-10-26
- Assignees: Diffblue Ltd
- Applicants: Diffblue Ltd
- Inventors: Cesar Rodriguez Ortega
- Web page: https://patentgrep.com/patent/US20220129371A1

## CPC

- G06F 11/3684: {for test design, e.g. generating new test cases}
- G06F 11/3676: {for coverage analysis}
- G06F 11/3698: Environments for analysis, debugging or testing of software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computer-implemented method comprising, during execution of a software program comprising a procedure, determining whether an execution of the procedure satisfies a predetermined coverage criterion. In accordance with a determination that the execution of the procedure satisfies the predetermined coverage criterion, recording information related to the execution of the procedure to a log, the information based on data received from instrumented code included in the software program, and automatically generating an arrange section of a unit test for the procedure based on an initialization sequence determined from the recorded log, the initialization sequence comprising a sequence of program instructions which when executed invoke the procedure.

## Claims

### Claim 1

A computer-implemented method comprising:
during execution of a software program comprising a procedure, determining, by a computing system comprising one or more computing devices, whether an execution of the procedure satisfies a predetermined coverage criterion;
in accordance with a determination that the execution of the procedure satisfies the predetermined coverage criterion, recording, by the computing system, information related to the execution of the procedure to a log, the information based on data received from instrumented code included in the software program; and
automatically generating, by the computing system, a unit test for the procedure based on an initialization sequence determined from the recorded log, the initialization sequence comprising a sequence of program instructions which when executed invoke the procedure.

### Claim 2

A computer-implemented method comprising:
during execution of a software program comprising a first procedure, instrumenting, by a computing system comprising one or more computing devices, a first code section of the executing software program associated with the first procedure of the software program to define a first instrumented code section, wherein instrumenting the first code section occurs prior to the first procedure of the software program being executed;
receiving, by the computing system, first instrumentation data from the first instrumented code section, wherein the first instrumentation data relates to an execution of the first procedure;
determining, by the computing system, whether the execution of the first procedure satisfies a first predetermined coverage criterion based on the first instrumentation data received from the first instrumented code section;
in accordance with a determination that the execution of the first procedure satisfies the first predetermined coverage criterion, recording, by the computing system, first execution information to an execution log, wherein the first execution information is based at least in part on the first instrumentation data received from the first instrumented code section;
constructing, by the computing system, an initialization sequence for the first procedure of the software program based on the recorded execution log, wherein the initialization sequence comprises an ordered representation of program instructions which when executed invoke the first procedure; and
automatically generating, by the computing system, an arrange section of a unit test for the first procedure of the software program based at least in part on the initialization sequence.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, further comprising:
in accordance with a determination that the execution of the first procedure satisfies the first predetermined coverage criterion:
recording, by the computing system, second execution information to the execution log, wherein the second execution information is based at least in part on second instrumentation data received from a second instrumented code section of the executing software program associated with a second procedure of the software program.

### Claim 4 (depends on 3)

The computer-implemented method of claim 3, wherein the second procedure is executed prior to execution of the first procedure.

### Claim 5 (depends on 3)

The computer-implemented method of claim 3, further comprising:
prior to the second procedure being executed, instrumenting, by the computing system, a second code section of the executing software program associated with the second procedure to produce the second instrumented code section.

### Claim 6 (depends on 5)

The computer-implemented method of claim 5, further comprising:
Receiving, by the computing system, the second instrumentation data from the second instrumented code section during execution of the second procedure.

### Claim 7 (depends on 3)

The computer-implemented method of claim 3, wherein the recorded execution log includes a sequence of program instructions related to invocation of the first procedure and invocation of the second procedure.

### Claim 8 (depends on 7)

The computer-implemented method of claim 7, wherein constructing the initialization sequence further comprises:
iteratively filtering, by the computing system, the sequence of program instructions included in the execution log thereby producing a filtered subsequence of program instructions, the filtered subsequence of program instructions determined to satisfy a first filtration criterion; and
constructing, by the computing system, the initialization sequence by traversing the filtered subsequence of program instructions.

### Claim 9 (depends on 3)

The computer-implemented method of claim 3, wherein determining whether the execution of the first procedure satisfies the first predetermined coverage criterion occurs prior to a program instruction being executed to return control flow from the first procedure.

### Claim 10

A computing system comprising:
one or more processors; and
one or more non-transitory computer-readable media that collectively store instructions that, when executed by the one or more processors, cause the system to perform operations, the operations comprising:
during execution of a software program comprising a first procedure,
instrumenting a first code section of the executing software program associated with the first procedure of the software program to define a first instrumented code section, wherein the first code section is instrumented prior to the first procedure of the software program being executed;
receiving first instrumentation data from the first instrumented code section, wherein the first instrumentation data is related to an execution of the first procedure;
determining whether the execution of the first procedure satisfies a first predetermined coverage criterion based on the first instrumentation data received from the first instrumented code section;
in accordance with a determination that the execution of the first procedure satisfies the first predetermined coverage criterion, recording first execution information to an execution log, wherein the first execution information is based at least in part on the first instrumentation data received from the first instrumented code section;
constructing an initialization sequence for the first procedure of the software program based on the recorded execution log, wherein the initialization sequence comprises an ordered representation of program instructions which when executed invoke the first procedure; and
automatically generating an arrange section of a unit test for the first procedure of the software program based at least in part on the initialization sequence.

### Claim 11 (depends on 10)

The computing system of claim 10, wherein the operations further comprise:
in accordance with a determination that the execution of the first procedure satisfies the first predetermined coverage criterion:
recording second execution information related to an execution of a second procedure of the software program to the execution log, wherein the second execution information is based at least in part on second instrumentation data received from a second instrumented code section of the executing software program associated with the second procedure of the software program.

### Claim 12 (depends on 11)

The computing system of claim 11, wherein the second procedure is executed prior to execution of the first procedure.

### Claim 13 (depends on 11)

The computing system of claim 11, wherein the operations further comprise:
instrumenting a second code section of the executing software program associated with the second procedure prior to the second procedure being executed to produce the second instrumented code section.

### Claim 14 (depends on 13)

The computing system of claim 13, wherein the operations further comprise:
receiving the second instrumentation data from the second instrumented code section during execution of the second procedure.

### Claim 15 (depends on 11)

The computing system of claim 11, wherein the execution log includes a sequence of program instructions related to invocation of the first procedure and invocation of the second procedure.

### Claim 16 (depends on 14)

The computing system of claim 14, wherein the operations further comprise:
iteratively filtering the sequence of program instructions included in the recorded execution log thereby to produce a filtered subsequence of program instructions, the filtered subsequence of program instructions determined to satisfy a first filtration criteria; and
constructing the initialization sequence based on a traversal of the filtered subsequence of program instructions.

### Claim 17 (depends on 16)

The computing system of claim 16, wherein the first filtration criteria is based on a measured change of coverage.

### Claim 18 (depends on 10)

The computing system of claim 10, wherein the first predetermined coverage criterion includes one or more of a function coverage, a statement coverage, a condition coverage, a branch coverage, or an edge coverage.

### Claim 19 (depends on 10)

The computing system of claim 10, wherein execution of the first procedure occurs at least in part as a result of a user interaction with the software program.

### Claim 20

A non-transitory computer readable medium comprising one or more instructions which when executed by one or more processors cause the device to carry out one or more operations, the operations comprising:
during execution of a software program comprising a first procedure, instrumenting a first code section of the executing software program associated with the first procedure of the software program to define a first instrumented code section, wherein instrumenting the first code section occurs prior to the first procedure of the software program being executed;
receiving first instrumentation data from the first instrumented code section, wherein the first instrumentation data relates to an execution of the first procedure;
determining whether the execution of the first procedure satisfies a first predetermined coverage criterion based on the first instrumentation data received from the first instrumented code section;
in accordance with a determination that the execution of the first procedure satisfies the first predetermined coverage criterion, recording first execution information to an execution log, wherein the first execution information is based at least in part on the first instrumentation data received from the first instrumented code section;
constructing an initialization sequence for the first procedure of the software program based on the recorded execution log, wherein the initialization sequence comprises an ordered representation of program instructions which when executed invoke the first procedure; and
automatically generating an arrange section of a unit test for the first procedure of the software program based at least in part on the initialization sequence.
