# US 2021/0286805 A1 · Generation of test datasets for guarded commands

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

- Number: US 2021/0286805 A1
- Document ID: US20210286805A1
- Status: Published application
- Kind: A1
- Application number: 16/818,596
- Filed: 2020-03-13
- Published: 2021-09-16
- Earliest claimed: 2020-03-13
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Tara Astigarraga; Saurabh Sinha; Hao Chen; Lian Xue Hu; Federico Eduardo Carpi; Juan Ariel Brusco Cannata
- Web page: https://patentgrep.com/patent/US20210286805A1

## CPC

- G06F 16/242: Query formulation
- G06F 11/3684: {for test design, e.g. generating new test cases}
- G06F 11/3688: {for test execution, e.g. scheduling of test suites}
- G06F 11/3692: {for test results analysis}
- G06F 16/2282: {Tablespace storage structures; Management thereof}
- G06F 16/248: Presentation of query results
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Systems and techniques that facilitate automated generation of relevant and adequate test datasets based on guarded commands are provided. In various embodiments, a query generation component can generate a query language query based on a first guarded command. In various aspects, an execution component can execute the query language query on a data table to return one or more datasets for testing the first guarded command. In various embodiments, the query generation component can comprise an initialization component that can initialize conditions of a WHERE clause of the query language query based on the first guarded command. In various instances, the query generation component can further comprise a transformation component that can transform the conditions of the WHERE clause of the query language query based on a sequence of guarded commands on which the first guarded command depends. In various cases, the query generation component can further comprise a translation component that can convert the transformed conditions of the WHERE clause of the query language query into query language syntax.

## Claims

### Claim 1

A system, comprising:
a processor, operably coupled to a memory, that executes computer-executable components stored in the memory, wherein the computer-executable components comprise:
a query generation component that generates a query language query based on a first guarded command; and
an execution component that executes the query language query on a data table to return one or more datasets for testing the first guarded command.

### Claim 2 (depends on 1)

The system of claim 1, wherein the query generation component comprises:
an initialization component that initializes conditions of a WHERE clause of the query language query based on the first guarded command;
a transformation component that transforms the conditions of the WHERE clause of the query language query based on a sequence of guarded commands on which the first guarded command depends; and
a translation component that converts the transformed conditions of the WHERE clause of the query language query into query language syntax.

### Claim 3 (depends on 2)

The system of claim 2, wherein the initialization component inserts conditions from a guard clause of the first guarded command into the WHERE clause of the query language query, and if any variable of any condition in the WHERE clause of the query language query is assigned in a command clause of a second guarded command in the sequence of guarded commands, the transformation component:
replaces the variable in the WHERE clause of the query language query with a corresponding assignment specified in the command clause of the second guarded command; and
inserts into the WHERE clause of the query language query conditions from a guard clause of the second guarded command.

### Claim 4 (depends on 3)

The system of claim 3, wherein the transformation component removes from the WHERE clause of the query language query duplicate or tautological conditions.

### Claim 5 (depends on 2)

The system of claim 2, further comprising:
a graph component that performs backward traversals on a command dependence graph to identify a subgraph of guarded commands on which the first guarded command depends, and performs a topological sort on the subgraph to generate the sequence of guarded commands.

### Claim 6 (depends on 2)

The system of claim 2, wherein one of the one or more datasets causes all conditions of the WHERE clause of the query language query to evaluate true.

### Claim 7 (depends on 2)

The system of claim 2, wherein, for a given condition of the WHERE clause of the query language query, one of the one or more datasets causes the given condition to evaluate false and causes conditions preceding the given condition to evaluate true.

### Claim 8 (depends on 1)

The system of claim 1, further comprising:
a testing component that runs the first guarded command on the one or more datasets to test the first guarded command.

### Claim 9

A computer-implemented method, comprising:
generating, by a device operatively coupled to a processor, a query language query based on a first guarded command; and
executing, by the device, the query language query on a data table to return one or more datasets for testing the first guarded command.

### Claim 10 (depends on 9)

The computer-implemented method of claim 9, wherein the generating the query language query comprises:
initializing, by the device, conditions of a WHERE clause of the query language query based on the first guarded command;
transforming, by the device, the conditions of the WHERE clause of the query language query based on a sequence of guarded commands on which the first guarded command depends; and
converting, by the device, the transformed conditions of the WHERE clause of the query language query into query language syntax.

### Claim 11 (depends on 10)

The computer-implemented method of claim 10, further comprising:
inserting, by the device, conditions from a guard clause of the first guarded command into the WHERE clause of the query language query; and
if any variable of any condition in the WHERE clause of the query language query is assigned in a command clause of a second guarded command in the sequence of guarded commands:
replacing, by the device, the variable in the WHERE clause of the query language query with a corresponding assignment specified in the command clause of the second guarded command; and
inserting, by the device, into the WHERE clause of the query language query conditions from a guard clause of the second guarded command.

### Claim 12 (depends on 11)

The computer-implemented method of claim 11, further comprising:
removing, by the device, from the WHERE clause of the query language query duplicate or tautological conditions.

### Claim 13 (depends on 10)

The computer-implemented method of claim 10, further comprising:
performing, by the device, backward traversals on a command dependence graph to identify a subgraph of guarded commands on which the first guarded command depends; and
performing, by the device, a topological sort on the subgraph to generate the sequence of guarded commands.

### Claim 14 (depends on 10)

The computer-implemented method of claim 10, wherein one of the one or more datasets causes all conditions of the WHERE clause of the query language query to evaluate true.

### Claim 15 (depends on 10)

The computer-implemented method of claim 10, wherein, for a given condition of the WHERE clause of the query language query, one of the one or more datasets causes the given condition to evaluate false and causes conditions preceding the given condition to evaluate true.

### Claim 16 (depends on 9)

The computer-implemented method of claim 9, further comprising:
running, by the device, the first guarded command on the one or more datasets to test the first guarded command.

### Claim 17

A computer program product for facilitating automated generation of relevant and adequate test datasets based on guarded commands, the computer program product comprising a computer readable memory having program instructions embodied therewith, the program instructions executable by a processing component to cause the processing component to:
generate a query language query based on a first guarded command; and
execute the query language query on a data table to return one or more datasets for testing the first guarded command.

### Claim 18 (depends on 17)

The computer program product of claim 17, wherein the program instructions are further executable to cause the processing component to:
initialize conditions of a WHERE clause of the query language query based on the first guarded command;
transform the conditions of the WHERE clause of the query language query based on a sequence of guarded commands on which the first guarded command depends; and
convert the transformed conditions of the WHERE clause of the query language query into query language syntax.

### Claim 19 (depends on 18)

The computer program product of claim 18, wherein the program instructions are further executable to cause the processing component to:
insert conditions from a guard clause of the first guarded command into the WHERE clause of the query language query; and
if any variable of any condition in the WHERE clause of the query language query is assigned in a command clause of a second guarded command in the sequence of guarded commands:
replace the variable in the WHERE clause of the query language query with a corresponding assignment specified in the command clause of the second guarded command; and
insert into the WHERE clause of the query language query conditions from a guard clause of the second guarded command.

### Claim 20 (depends on 19)

The computer program product of claim 19, wherein the program instructions are further executable to cause the processing component to:
remove from the WHERE clause of the query language query duplicate or tautological conditions.
