Reliable unit testing through cached mocking
US-8935573-B2 · Jan 13, 2015 · US
US9697018B2 · US · B2
| Field | Value |
|---|---|
| Publication number | US-9697018-B2 |
| Application number | US-201514724958-A |
| Country | US |
| Kind code | B2 |
| Filing date | May 29, 2015 |
| Priority date | May 29, 2015 |
| Publication date | Jul 4, 2017 |
| Grant date | Jul 4, 2017 |
A practical reading order for non-experts. Skip the full description unless you need deep technical detail.
What the patent document calls the invention.
A short plain-language summary of the technical disclosure.
Who owns or filed the patent and who is credited as inventor.
Filing, priority, publication, and grant dates set the timeline.
The legal scope of protection — read this for what is actually claimed.
Technology tags used to group this patent with similar filings.
Prior art links and similar publications in this corpus.
Official abstract text for this publication.
A computer implemented method of preserving functionality in a computer program by generating customized mock inputs may include identifying a set of functionalities of the computer program, where a first functionality has a first input, and a second functionality has a second input. The method may also include determining a first and a second constraint respectively on the first and second inputs, where the first constraint defines a set of values of the first input which enables the first functionality, and the second constraint defines a set of values of the second input which enables the second functionality. The method may then include generating a constraint satisfaction problem including the first and second constraints, and determining whether a tuple of mock input values exists that satisfy the constraint satisfaction problem. The method may additionally include providing the tuple to the computer program as the customized mock inputs.
Opening claim text (preview).
What is claimed is: 1. A computer-implemented method for generating one or more customized mock inputs to a computer program to enable execution of a set of functionalities of the computer program when resources providing inputs that enable execution of the set of functionalities are unavailable, comprising: selecting the computer program from a database of candidate computer programs; during a test run of the selected computer program, determining when access to a first resource providing a first input is unavailable and when access to a second resource providing a second input is unavailable; identifying, by at least one processor, the set of functionalities, wherein a first functionality of the set of functionalities has the first input, and a second functionality of the set of functionalities has the second input; determining a first constraint on the first input, wherein the first constraint defines a set of values of the first input which enables the first functionality; determining a second constraint on the second input, wherein the second constraint defines a set of values of the second input which enables the second functionality; generating a first constraint satisfaction problem including the first constraint and the second constraint, wherein the first constraint and the second constraint are written as a logical expression including logical operators that combine the first constraint with the second constraint; determining that a first tuple of mock input values does not exist to satisfy the first constraint satisfaction problem; in response to determining that the first tuple does not exist, performing steps of: removing a constraint from the first constraint satisfaction problem; generating, in response to the removing, a new constraint satisfaction problem, the new constraint satisfaction problem having at least one fewer constraint than the first constraint satisfaction problem; determining whether a new tuple of mock input values exists and satisfies the new constraint satisfaction problem; in response to determining that the new tuple does not exist to satisfy the new constraint satisfaction problem, repeating steps of the removing the constraint, generating the new constraint satisfaction problem, and the determining of a new tuple existing to satisfy the new constraint satisfaction problem or all constraints are removed; and in response to determining that the new tuple exists to satisfy the new constraint satisfaction problem, integrating the new tuple of mock input values into the computer program by: determining modifiable segments of code from the computer program corresponding to one failure, the failure being associated with access to a resource providing the second input; modifying the segments of code within the computer program to hardcode the new tuple of mock input values and enable execution of the first functionality and the second functionality, when both the first resource and a second resource are unavailable; based on the modified code segments, generating a new computer executable code for the computer program; loading the new computer executable code within an execution system; executing the new computer executable code within an execution system; and when both the first resource and the second resource are unavailable during the execution, enabling both the first functionality and the second functionality by providing the new tuple of mock input values to execute the first functionality and the second functionality. 2. The method of claim 1 , wherein at least one of the first resource and the second resource is a hardware resource. 3. The method of claim 1 , wherein the modifying the segments of code within the computer program to hardcode the new tuple of mock input values includes: generating computer executable code to modify the segments of code to hardcode at least one element of the new tuple. 4. The method of claim 1 , wherein a solver indicates the constraint to remove from the first constraint satisfaction problem. 5. The method of claim 1 , wherein at least one of the first constraint and the second constraint is determined using a weakest precondition calculus. 6. The method of claim 1 , wherein the first input and the second input are a same input. 7. A computer system, comprising one or more processors, for preserving functionality in a computer program by generating one or more customized mock inputs, the one or more processors configured to: select the computer program from a database of candidate computer programs; during a test run of the selected computer program, determine when access to a first resource providing a first input is unavailable and when access to a second resource providing a second input is unavailable; identify a set of functionalities of the computer program, wherein a first functionality of the set of functionalities has the first input, and a second functionality of the set of functionalities has the second input; determine a first constraint on the first input, wherein the first constraint defines a set of values of the first input which enables the first functionality; determine a second constraint on the second input, wherein the second constraint defines a set of values of the second input which enables the second functionality; generate a first constraint satisfaction problem including the first and second constraints, wherein the first constraint and the second constraint are written as a logical expression including logical operators that combine the first constraint with the second constraint; determine that a first tuple of mock input values does not exist to satisfy the first constraint satisfaction problem; in response to determining that the first tuple does not exist, execute steps to: remove a constraint from the first constraint satisfaction problem; generate, in response to the removing, a new constraint satisfaction problem, the new constraint satisfaction problem having at least one fewer constraint than the first constraint satisfaction problem; determining whether a new tuple of mock input values exists and satisfies the new constraint satisfaction problem; in response to determining that the new tuple does not exist to satisfy the new constraint satisfaction problem, repeating steps of the removing the constraint, generating the new constraint satisfaction problem, and the determining of a new tuple existing to satisfy the new constraint satisfaction problem or all constraints are removed; and in response to determining that the new tuple exists to satisfy the new constraint satisfaction problem, integrating the new tuple of mock input values into the computer program by executing steps to: determine modifiable segments of code from the computer program corresponding to one failure, the failure being associated with access to a resource providing the second input; modify the segments of code within the computer program to hardcode the new tuple of mock input values and enable execution of the first functionality and the second functionality, when both the first resource and a second resource are unavailable; based on the modified code segments, generating a new computer executable code for the computer program; load the new computer executable code within an execution system; execute the new computer executable code within an execution system; and when both the first resource and the second resource are unavailable during execution, enable both the first functionality and the second functionality by providing the new tuple of mock input values to execute the first functionality and the second functionality. 8. The computer system of claim 7 , the computer system is further configured to: generate computer
Related publications grouped by family.
Answers are generated from the same data shown on this page.