Patent ID: 11921621
Assignee: PARASOFT CORPORATION
Field: Computer technology (Electrical engineering)
Classification: CPC G | IPC G

Claim 8:
9. A system for creating unit tests for testing a computer program comprising:
a memory; and
one or more processors configured to:
construct a Control Flow Graph (CFG) representation for the computer program, wherein the CFG includes at least an assignment node for assigning a method call executed by a flow analysis software to a given variable and information about the given variable that is being assigned with a value, and a return value node representing an exit point from a method called by the flow analysis software;
parse the CFG to build a plurality of different potential execution paths within the computer program and to identify a unique formula for each of the potential execution paths, wherein each formula includes a list of pre-conditions and associated variables that represent a simulated execution path;
parse a source code of the computer program to generate an abstract syntax tree as representation of a content of the computer program, by mapping a source code of the portion to a tree according to syntax rules of a programming language;
analyze the computer program to determine whether it provides capability to set each of the associated variables in each formula utilizing the abstract syntax tree, wherein the one or more processors translate variables, fields, and expressions of the source code represented in the each formula into a plurality of decision variables, using pre-determined categories of constraints;
compute a solution to the list of pre-conditions from the each formula to one of the potential solutions that specifies values for decision variables, wherein the one or more processors select a formula, from the plurality of formulas, with a fewest number of associated variables, which has a solution that specifies values for decision variables for given pre-conditions, and creates a unit test, based on the solution and the list of pre-conditions collected and solved; and
execute the unit test to test the computer program.