IP Library Granted Patent US 9,639,453
Granted Patent B2
US 9,639,453 · App. 14/638,442 · Granted May 2, 2017

Method and system for determining functional tests to execute based on code coverage

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,639,453
App. No.
14/638,442
Granted
May 2, 2017
Kind
B2
Abstract

Techniques are disclosed for automatically determining tests to run on source code based on code coverage. In one embodiment, an extensible system takes as input a configuration file having pointers to an IP address of a server where tests are being run and a type of code coverage instrumentation. An agent configured to instrument source code and collect code coverage information is copied to the server at the IP address. During a training phase, the agent intercepts tests being run on source code and provides a dump of the interception results after each test is executed. Using such results, mappings of the tests to the source code is created and stored. During an execution phase, when new or modified source code file is being checked in, a testing application retrieves for execution tests which map to the source code file and to code dependent on the source code file.

Claims (38)

1. A method for testing source code, comprising:

receiving a configuration file specifying an Internet Protocol (IP) address of a server which runs tests on source code and a type of code coverage instrumentation used in the tests;

copying an agent, which is configured to interpret the type of code coverage instrumentation specified in the configuration file, to the server based on the IP address of the server;

intercepting, by the agent, tests run on a first version of the source code at the server specified in the configuration file, based on the type of code coverage instrumentation specified in the configuration file, to determine the tests being run and code coverage from running the tests;

storing, in a database, mappings of the determined tests to portions of the first version of the source code based on the determined code coverage;

responsive to a second version of the source code being checked in, determining a set of tests to run on the second version of the source code and code that is dependent on the second version of the source code based on the stored mappings in the database, wherein the code that is dependent on the second version of the source code includes code determined to use application programming interfaces (APIs) within the second version of the source code;

running the determined set of tests on the second version of the source code and the dependent code; and

re-learning one or more of the stored mappings subsequent to changes being made to one or more of the tests corresponding to the one or more of the stored mappings.

2. The method of claim 1 , wherein the intercepting comprises running each of the tests and interpreting code coverage instrumentation.

3. The method of claim 1 , wherein a blacklist is used in determining the set of tests to run on the second version of the source code, the blacklist specifying one or more criteria for determining tests to run in cases of repeated code coverage.

4. The method of claim 1 , wherein a whitelist is used in determining the set of tests to run on the second version of the source code, the whitelist specifying a default set of tests to run.

5. The method of claim 1 , wherein the stored mappings of the tests to the portions of the first version of the source code are mappings of the tests to source code files.

6. The method of claim 1 , wherein the stored mappings of the tests to the portions of the first version of the source code are mappings of the tests to lines of the first version of the source code.

7. The method of claim 1 , wherein the second version of the source code includes a class and the dependent code includes one or more other classes which import the class in the second version of the source code.

8. A non-transitory computer-readable storage medium containing one or more programs which, when executed by one or more processors, performs operations for testing source code, the operations comprising:

receiving a configuration file specifying an Internet Protocol (IP) address of a server which runs tests on source code and a type of code coverage instrumentation used in the tests;

copying an agent, which is configured to interpret the type of code coverage instrumentation specified in the configuration file, to the server based on the IP address of the server;

intercepting, by the agent, tests run on a first version of the source code at the server specified in the configuration file, based on the type of code coverage instrumentation specified in the configuration file, to determine the tests being run and code coverage from running the tests;

storing, in a database, mappings of the determined tests to portions of the first version of the source code based on the determined code coverage;

responsive to a second version of the source code being checked in, determining a set of tests to run on the second version of the source code and code that is dependent on the second version of the source code based on the stored mappings in the database, wherein the code that is dependent on the second version of the source code includes code determined to use application programming interfaces (APIs) within the second version of the source code;

running the determined set of tests on the second version of the source code and the dependent code; and

re-learning one or more of the stored mappings subsequent to changes being made to one or more of the tests corresponding to the one or more of the stored mappings.

9. The computer-readable storage medium of claim 8 , wherein the intercepting comprises running each of the tests and interpreting code coverage instrumentation.

10. The computer-readable storage medium of claim 8 , wherein a blacklist is used in determining the set of tests to run on the second version of the source code, the blacklist specifying one or more criteria for determining tests to run in cases of repeated code coverage.

11. The computer-readable storage medium of claim 8 , wherein a whitelist is used in determining the set of tests to run on the second version of the source code, the whitelist specifying a default set of tests to run.

12. The computer-readable storage medium of claim 8 , wherein the stored mappings of the tests to the portions of the first version of the source code are mappings of the tests to source code files.

13. The computer-readable storage medium of claim 8 , wherein the stored mappings of the tests to the portions of the first version of the source code are mappings of the tests to lines of the first version of the source code.

14. The computer-readable storage medium of claim 8 , wherein the second version of the source code includes a class and the dependent code includes one or more other classes which import the class in the second version of the source code.

15. A system, comprising:

a processor; and

a memory, wherein the memory includes one or more programs configured to perform operations for testing source code, the operations comprising:

receiving a configuration file specifying an Internet Protocol (IP) address of a server which runs tests on source code and a type of code coverage instrumentation used in the tests,

copying an agent, which is configured to interpret the type of code coverage instrumentation specified in the configuration file, to the server based on the IP address of the server,

intercepting, by the agent, tests run on a first version of the source code at the server specified in the configuration file, based on the type of code coverage instrumentation specified in the configuration file, to determine the tests being run and code coverage from running the tests,

storing, in a database, mappings of the determined tests to portions of the first version of the source code based on the determined code coverage,

responsive to a second version of the source code being checked in, determining a set of tests to run on the second version of the source code and code that is dependent on the second version of the source code based on the stored mappings and code coverage information in the database, wherein the code that is dependent on the second version of the source code includes code determined to use application programming interfaces (APIs) within the second version of the source code,

running the determined set of tests on the second version of the source code and the dependent code, and

re-learning one or more of the stored mappings subsequent to changes being made to one or more of the tests corresponding to the one or more of the stored mappings.

Assignments (2)
CHANGE OF NAME Recorded Apr 15, 2024
From: VMWARE, INC.
To: VMWARE LLC
Reel/Frame 067102/0314 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 4, 2015
From: BELUR, REKHA
To: VMWARE, INC.
Reel/Frame 035127/0398 →