# US 2023/0068689 A1 · Ranking test cases specific to changes in software code

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

- Number: US 2023/0068689 A1
- Document ID: US20230068689A1
- Status: Published application
- Kind: A1
- Application number: 17/407,018
- Filed: 2021-08-19
- Published: 2023-03-02
- Earliest claimed: 2021-08-19
- Assignees: Sap SE
- Applicants: Sap SE
- Inventors: Amrit Shankar Dutta; Amitabh Goswami
- Web page: https://patentgrep.com/patent/US20230068689A1

## CPC

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

## Abstract

Technologies are described for ranking test cases related to changes in a software code base using at least a portion of a call graph that is generated from the software code base. The at least a portion of the call graph comprises method nodes corresponding to methods in the software code base. The method nodes represent control flow relationships between the methods in the software code base. The at least a portion of the call graph also comprises test case nodes. Each test case node is connected to one or more method nodes corresponding to coverage of the one or more method nodes by the test case node. Using the at least a portion of the call graph, the test case nodes are automatically ranked. Ranking of the test case nodes is performed by evaluating various criteria associated with the at least a portion of the call graph.

## Claims

### Claim 1

A method, performed by one or more computing devices, for ranking test cases related to changes in a software code base, the method comprising:
obtaining at least a portion of a call graph, wherein the at least a portion of the call graph comprises:
method nodes corresponding to methods in the software code base, wherein the method nodes represent control flow relationships between the methods in the software code base, and wherein a subset of the method nodes are identified as associated with methods that have code changes; and
test case nodes corresponding to test cases used to test the software code base, wherein each test case node is connected to one or more of the method nodes corresponding to coverage of the one or more method nodes by the test case node, and wherein a subset of the test case nodes are identified as connected to the identified method nodes that are associated with methods that have code changes;
automatically ranking the test case nodes using a plurality of criteria based on structure of the at least a portion of the call graph, wherein the plurality of criteria consider at least:
how many outgoing edges each method node has to other of the method nodes; and
how many incoming edges each method node has from other of the method nodes; and
outputting an indication of the ranking of the test case nodes.

### Claim 2 (depends on 1)

The method of claim 1, wherein automatically ranking the test case nodes comprises:
for each method node, counting a number of outgoing (called by) edges to other of the method nodes, wherein a greater number of the outgoing edges for a given method node results a proportionately lower ranking of test case nodes directly connected to the given method node.

### Claim 3 (depends on 1)

The method of claim 1, wherein automatically ranking the test case nodes comprises:
for each method node, counting a number of incoming (called by) edges from other of the method nodes, wherein a greater number of the incoming edges for a given method node results in a proportionately higher ranking of test case nodes directly connected to the given method node.

### Claim 4 (depends on 1)

The method of claim 1, wherein automatically ranking the test case nodes comprises:
for each method node, counting a number of outgoing (called by) edges to other of the method nodes, wherein a greater number of the outgoing edges for a given method node results a proportionately lower ranking of test case nodes directly connected to the given method node; and
for each method node, counting a number of incoming (called by) edges from other of the method nodes, wherein a greater number of the incoming edges for a given method node results in a proportionately higher ranking of test case nodes directly connected to the given method node.

### Claim 5 (depends on 1)

The method of claim 1, wherein automatically ranking the test case nodes comprises:
for each test case node, calculating a score for the test case node comprising:
calculating a first score component for a first criteria based on a number of outgoing (called_by) edges for each method node that is directly connected to the test case node;
calculating a second score component for a second criteria based on a number of incoming (called_by) edges for each method node that is directly connected to the test case node; and
calculating the score for the test case node based at least in part on the first score component and the second score component; and
ranking the test case nodes in an order based on their scores.

### Claim 6 (depends on 5)

The method of claim 5, wherein calculating the score for each test case node further comprises:
weighting the first score component by a first weight value; and
weighting the second score component by a second weight value.

### Claim 7 (depends on 6)

The method of claim 6, wherein the first weight value and the second weight value are determined using a machine learning model or linear regression.

### Claim 8 (depends on 5)

The method of claim 5, wherein automatically ranking the test case nodes further comprises:
for each test case node, calculating the score for the test case node comprising:
calculating a third score component based on distance from the one or more method nodes covered by the test case node to one or more of the method nodes identified as associated with methods having code changes;
calculating a fourth score component based on a number of incoming (covered by) edges to the test case node from the method nodes; and
calculating the score for the test case node based at least in part on the first score component, the second score component, the third score component, and the fourth score component.

### Claim 9 (depends on 8)

The method of claim 8, wherein calculating the score for each test case node further comprises:
weighting the first score component by a first weight value;
weighting the second score component by a second weight value;
weighting the third score component by a third weight value; and
weighting the fourth score component by a fourth weight value;.

### Claim 10 (depends on 1)

The method of claim 1, wherein the at least a portion of the call graph is a call graph chain that is independent of, and disconnected from, other call graph chains for the software code base.

### Claim 11 (depends on 1)

The method of claim 1, further comprising:
parsing the software code base to identify the methods having code changes since the last code commit; and
generating the at least a portion of the call graph;
wherein the at least a portion of the call graph is a single call graph chain of connected method nodes and test case nodes, without any disconnected method nodes or disconnected test case nodes.

### Claim 12

One or more computing devices comprising:
processors; and
memory;
the one or more computing devices configured, via computer-executable instructions, for ranking test cases related to changes in a software code base, the operations comprising:
obtaining at least a portion of a call graph, wherein the at least a portion of the call graph comprises:
method nodes corresponding to methods in the software code base, wherein the method nodes represent control flow relationships between the methods in the software code base, and wherein a subset of the method nodes are identified as associated with methods that have code changes since a last code commit;
test case nodes corresponding to test cases used to test the software code base, wherein each test case node is connected to one or more of the method nodes corresponding to coverage of the one or more method nodes by the test case node, and wherein a subset of the test case nodes are identified as connected to the identified method nodes that are associated with methods that have code changes since the last code commit;
automatically ranking the test case nodes using a plurality of criteria based on structure of the at least a portion of the call graph, wherein the plurality of criteria consider at least:
how many outgoing edges each method node has to other of the method nodes; and
how many incoming edges each method node has from other of the method nodes; and
outputting an indication of the ranking of the test case nodes.

### Claim 13 (depends on 12)

The one or more computing devices of claim 12, wherein automatically ranking the test case nodes comprises:
for each method node, counting a number of outgoing (called_by) edges to other of the method nodes, wherein a greater number of the outgoing edges for a given method node results a proportionately lower ranking of test case nodes directly connected to the given method node.

### Claim 14 (depends on 12)

The one or more computing devices of claim 12, wherein automatically ranking the test case nodes comprises:
for each method node, counting a number of incoming (called_by) edges from other of the method nodes, wherein a greater number of the incoming edges for a given method node results in a proportionately higher ranking of test case nodes directly connected to the given method node.

### Claim 15 (depends on 12)

The one or more computing devices of claim 12, wherein automatically ranking the test case nodes comprises:
for each test case node, calculating a score for the test case node comprising:
calculating a first score component for a first criteria based on a number of outgoing (called_by) edges for each method node that is directly connected to the test case node;
calculating a second score component for a second criteria based on a number of incoming (called_by) edges for each method node that is directly connected to the test case node;
calculating a third score component based on distance from the one or more method nodes covered by the test case node to one or more of the method nodes identified as associated with methods having code changes;
calculating a fourth score component based on a number of incoming (covered by) edges to the test case node from the method nodes; and
calculating the score for the test case node based at least in part on the first score component, the second score component, the third score component, and the fourth score component; and
ranking the test case nodes in an order based on their scores.

### Claim 16 (depends on 12)

The one or more computing devices of claim 12, wherein the at least a portion of the call graph is a call graph chain that is independent of, and disconnected from, other call graph chains for the software code base.

### Claim 17

One or more computer-readable storage media storing computer-executable instructions for execution on one or more computing devices to perform operations for ranking test cases related to changes in a software code base, the operations comprising:
parsing the software code base to identify methods having code changes since a last code commit;
generating at least a portion of a call graph, wherein the at least a portion of the call graph comprises:
method nodes corresponding to methods in the software code base, wherein the method nodes represent control flow relationships between the methods in the software code base, and wherein a subset of the method nodes are identified as associated with methods that have code changes since a last code commit;
test case nodes corresponding to test cases used to test the software code base, wherein each test case node is connected to one or more of the method nodes corresponding to coverage of the one or more method nodes by the test case node, and wherein a subset of the test case nodes are identified as connected to the identified method nodes that are associated with methods that have code changes since the last code commit;
automatically ranking the test case nodes using one or more of the following criteria:
a first criteria evaluating a number of outgoing edges each method node has to other of the method nodes; and
a second criteria evaluating a number of incoming edges each method node has from other of the method nodes;
a third criteria evaluating distances from the one or more method nodes covered by each test case node to one or more of the method nodes identified as associated with methods having code changes; or
a fourth criteria evaluating a number of incoming edges to each test case node; and
outputting an indication of the ranking of the test case nodes.

### Claim 18 (depends on 17)

The one or more computer-readable storage media of claim 17, wherein automatically ranking the test case nodes is performed based at least in part on the first criteria and the second criteria, comprising:
for each method node, counting a number of outgoing (called by) edges to other of the method nodes, wherein a greater number of the outgoing edges for a given method node results a proportionately lower ranking of test case nodes directly connected to the given method node; and
for each method node, counting a number of incoming (called by) edges from other of the method nodes, wherein a greater number of the incoming edges for a given method node results in a proportionately higher ranking of test case nodes directly connected to the given method node.

### Claim 19 (depends on 18)

The one or more computer-readable storage media of claim 18, wherein automatically ranking the test case nodes is performed based at least in part on the third criteria and the fourth criteria, comprising:
for each test case node, determining a distance from the one or more method nodes covered by the test case node to a closest of the method nodes identified as associated with methods having code changes, wherein a greater distance results a proportionately lower ranking of test case node; and
for each test case node, counting a number of incoming (covered by) edges to the test case node from the method nodes, wherein a greater number of the incoming edges for a given test case node results in a proportionately lower ranking of the given test case node.

### Claim 20 (depends on 17)

The one or more computer-readable storage media of claim 17, wherein automatically ranking the test case nodes comprises:
for each test case node, calculating a score for the test case node comprising:
calculating a first score component for the first criteria based on a number of outgoing (called_by) edges for each method node that is directly connected to the test case node;
calculating a second score component for the second criteria based on a number of incoming (called_by) edges for each method node that is directly connected to the test case node;
calculating a third score component for the third criteria based on distance from the one or more method nodes covered by the test case node to one or more of the method nodes identified as associated with methods having code changes;
calculating a fourth score component for the fourth criteria based on a number of incoming (covered by) edges to the test case node from the method nodes; and
calculating the score for the test case node based at least in part on the first score component, the second score component, the third score component, and the fourth score component; and
ranking the test case nodes in an order based on their scores.
