Method for automating unit test development
First Claim
1. A method for generating JUnit tests for each of a JAVA or C# code unit basis paths, comprising the steps of:
- providing a user-interface for manual selection of which Java or C# code unit a user would like to test;
providing a database to store test data for the selected code unit;
automatically parsing the selected code unit to identify all code constructs therein;
automatically parsing the selected code and generating a full set of linearly independent test executing a look-up to said database to determine what test data, if any, already exist for the selected code unit and if it is still valid;
providing a user-interface to guide the user through their code and prompting them to specify data that will force each decision outcome to be either true or false, as required for each identified test path;
updating said database with said specified data;
automatically creating a new class that contains one new method for each test path being tested;
creating a complete JUnit/NUnit test suite that tests the new class and all basis paths therein.
0 Assignments
0 Petitions
Accused Products
Abstract
A method and software product for capturing decision data and generating JUnit/NUnit tests for each of a JAVA or C# code unit basis paths. The present software erects a user-interface for guiding a user through the basis paths in their source code and assisting them in creating the test data necessary to exercise each of those paths. At each decision in a given path, the software tells the user that the decision must evaluate either true or false to follow the current path, and it allows them to specify, select, or construct test data that will satisfy this condition. After the user has specified test data for all test paths, the software creates a new class containing a rewritten version of the user'"'"'s original source code that allows test data to be injected at each decision while still preserving the overall control flow of the original code. The software then creates a complete JUnit or NUnit test suite to test each basis path from the original class in the new class by injecting the test data specified by the user.
37 Citations
8 Claims
-
1. A method for generating JUnit tests for each of a JAVA or C# code unit basis paths, comprising the steps of:
-
providing a user-interface for manual selection of which Java or C# code unit a user would like to test;
providing a database to store test data for the selected code unit;
automatically parsing the selected code unit to identify all code constructs therein;
automatically parsing the selected code and generating a full set of linearly independent test executing a look-up to said database to determine what test data, if any, already exist for the selected code unit and if it is still valid;
providing a user-interface to guide the user through their code and prompting them to specify data that will force each decision outcome to be either true or false, as required for each identified test path;
updating said database with said specified data;
automatically creating a new class that contains one new method for each test path being tested;
creating a complete JUnit/NUnit test suite that tests the new class and all basis paths therein. - View Dependent Claims (2, 3)
-
-
4. A method for generating basis paths tests for source code, comprising the steps of:
-
presenting a graphical user interface to a user;
applying an analysis engine to automatically analyze original source code and establish a set of basis paths;
generating an instrumented class including a rewritten version of said original source code;
guiding said user through the basis paths of said source code and generating test data therefore by allowing said user to specify test data, select a condition, construct test data, or skip each basis path, in each case suggesting test data to said user;
creating a complete basis path test suite that, by injecting of said generated test data, tests all basis paths of the instrumented class, and, by extension, all the basis paths of the original source code. - View Dependent Claims (5, 6)
-
-
7. A software product for generating basis paths tests for source code, comprising:
-
an intelligent analysis engine for analyzing a user'"'"'s source code and defining a set of basis paths to be tested; and
a graphical user-interface for guiding the user through the defined basis paths in said source code and assisting them in creating tests necessary to exercise each defined basis path; and
a test generator for automatically generating a set of tests to exercise each defined basis path;
whereby by running the automatically-generated tests, the developer tests each of the basis paths in their source code. - View Dependent Claims (8)
-
Specification