# US 11,307,971 B1 · Computer analysis of software resource load

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

- Number: US 11,307,971 B1
- Document ID: US11307971B1
- Status: Granted
- Kind: B1
- Application number: 17/302,576
- Filed: 2021-05-06
- Granted: 2022-04-19
- Earliest claimed: 2021-05-06
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Komminist Weldemariam; Smitkumar Narotambhai Marvaniya
- Web page: https://patentgrep.com/patent/US11307971B1

## CPC

- G06F 11/3684: {for test design, e.g. generating new test cases}
- G06F 8/30: Creation or generation of source code
- G06F 8/75: Structural analysis for program understanding
- G06F 8/77: Software metrics
- G06F 11/3058: {Monitoring arrangements for monitoring environmental properties or parameters of the computing system or of the computing system component, e.g. monitoring of power, currents, temperature, humidity, position, vibrations (thermal management in cooling arrangements of a computing system G06F1/206)}
- G06F 11/3688: {for test execution, e.g. scheduling of test suites}
- G06F 16/2379: {Updates performed during online database operations; commit processing}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Generation of a set of carbon-aware test cases based on a software resource load includes receiving, by one or more processors, a source code and identifying code changes on the received source code using code analysis technology. The code changes are used to select a plurality of code snippets from the source code. The one or more processors calculate metrics associated with an energy consumption of each of the plurality of code snippets and an amount of carbon dioxide emissions equivalent to the calculated metrics. The calculated equivalent amount of carbon dioxide emissions associated with each of the plurality of code snippets is displayed by the one or more processors on the source code for automatically generating the set of test carbon-aware test cases based on the calculated amount of carbon dioxide emissions and predefined carbon emissions constraints.

## Claims

### Claim 1

A computer-implemented method for generating a set of test cases, comprising:
receiving, by one or more processors, a source code;
using, by the one or more processors, code analysis technology for identifying code changes on the received source code and selecting a plurality of code snippets based on the identified code changes;
calculating, by the one or more processors, metrics associated with an energy consumption of each of the plurality of code snippets;
calculating, by the one or more processors, for each of the plurality of code snippets an amount of carbon dioxide emissions equivalent to the calculated metrics;
displaying, by the one or more processors, the calculated equivalent amount of carbon dioxide emissions associated with each of the plurality of code snippets on the source code; and
automatically generating, by the one or more processors, a set of test cases based on the calculated amount of carbon dioxide emissions and predefined carbon emissions constraints.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
executing, by the one or more processors, the set of test cases;
generating, by the one or more processors, a notification for reporting a result of the set of test cases;
receiving, by the one or more processors, a real-time input from a user via a dialogue-based conversation system; and
updating, by the one or more processors, the set of test cases based on the received real-time input from the user.

### Claim 3 (depends on 1)

The method of claim 1, wherein source code changes are determined according to a code commit action including at least one of a code commit, a pull request, an approval, an integration, and a coverage plan.

### Claim 4 (depends on 1)

The method of claim 1, further comprising:
calculating, by the one or more processors, a risk score associated with test case execution failure.

### Claim 5 (depends on 4)

The method of claim 4, wherein the risk score is associated with at least one of a brand reputation, customer loss, a reputation risk, and a financial risk.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
creating, by the one or more processors, a compliance database of carbon-aware test cases including a carbon-aware coverage plan; and
updating, by the one or more processors, the compliance database of carbon-aware test cases based on an execution log.

### Claim 7 (depends on 6)

The method of claim 6, further comprising:
based on the carbon-aware coverage plan, modifying, by the one or more processors, one or more test case simulation operations including at least one of a union operation, an intersection operation, and a cross-product operation.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
in response to a test case prioritization request, predicting, by the one or more processors, a failure of at least one test case in the set of test cases based on a failure of a different test case using conditional probability;
based on the predicted failure, determining, by the one or more processors, a dependency between at least two test cases in the set of test cases; and
based on the determined dependency, arranging the set of test cases in a new order of importance.

### Claim 9 (depends on 8)

The method of claim 8, further comprising:
calculating, by the one or more processors, a risk level associated with the predicted failure.

### Claim 10 (depends on 9)

The method of claim 9, further comprising:
monitoring, by the one or more processors, an execution log associated with the set of test cases including the calculated risk level associated with the predicted failure.

### Claim 11

A computer system for generating a set of test cases, comprising:
one or more processors, one or more computer-readable memories, one or more computer-readable tangible storage devices, and program instructions stored on at least one of the one or more storage devices for execution by at least one of the one or more processors via at least one of the one or more memories, wherein the computer system is capable of performing a method comprising:
receiving, by one or more processors, a source code;
using, by the one or more processors, code analysis technology for identifying code changes on the received source code and selecting a plurality of code snippets based on the identified code changes;
calculating, by the one or more processors, metrics associated with an energy consumption of each of the plurality of code snippets;
calculating, by the one or more processors, for each of the plurality of code snippets an amount of carbon dioxide emissions equivalent to the calculated metrics;
displaying, by the one or more processors, the calculated equivalent amount of carbon dioxide emissions associated with each of the plurality of code snippets on the source code; and
automatically generating, by the one or more processors, a set of test cases based on the calculated amount of carbon dioxide emissions and predefined carbon emissions constraints.

### Claim 12 (depends on 11)

The computer system of claim 11, further comprising:
executing, by the one or more processors, the set of test cases;
generating, by the one or more processors, a notification for reporting a result of the set of test cases;
receiving, by the one or more processors, a real-time input from a user via a dialogue-based conversation system; and
updating, by the one or more processors, the set of test cases based on the received real-time input from the user.

### Claim 13 (depends on 11)

The computer system of claim 11, wherein source code changes are determined according to a code commit action including at least one of a code commit, a pull request, an approval, an integration, and a coverage plan.

### Claim 14 (depends on 11)

The computer system of claim 11, further comprising:
calculating, by the one or more processors, a risk score associated with test case execution failure.

### Claim 15 (depends on 14)

The computer system of claim 14, wherein the risk score is associated with at least one of a brand reputation, customer loss, a reputation risk, and a financial risk.

### Claim 16 (depends on 11)

The computer system of claim 11, further comprising:
creating, by the one or more processors, a compliance database of carbon-aware test cases including a carbon-aware coverage plan; and
updating, by the one or more processors, the compliance database of carbon-aware test cases based on an execution log.

### Claim 17 (depends on 16)

The computer system of claim 16, further comprising:
based on the carbon-aware coverage plan, modifying, by the one or more processors, one or more test case simulation operations including at least one of a union operation, an intersection operation, and a cross-product operation.

### Claim 18 (depends on 11)

The computer system of claim 11, further comprising:
in response to a test case prioritization request, predicting, by the one or more processors, a failure of at least one test case in the set of test cases based on a failure of a different test case using conditional probability;
based on the predicted failure, determining, by the one or more processors, a dependency between at least two test cases in the set of test cases; and
based on the determined dependency, arranging the set of test cases in a new order of importance.

### Claim 19 (depends on 18)

The computer system of claim 18, further comprising:
calculating, by the one or more processors, a risk level associated with the predicted failure.

### Claim 20 (depends on 19)

The computer system of claim 19, further comprising:
monitoring, by the one or more processors, an execution log associated with the set of test cases including the calculated risk level associated with the predicted failure.
