Patent ID: 8627296

Claim:
A method of testing a unit of computer program code that has a dependency on an object described by the computer program code, comprising: generating a capture object based on the object described by the computer program code, a method of the capture object corresponding to a method of the object described by the computer program code; calling the method of the capture object, the capture object interacting with the method of the object described by the computer program code responsive the method of the capture object being called; capturing interactions with the method of the object described by the computer program code as the capture object interacts with the method of the object described by the computer program code; responsive to the captured interactions, automatically generating mock code for creating a mock object that mimics the captured interactions; and executing testing code having at least some the computer program code and the mock code, wherein executing the testing code comprises: determining whether to perform a unit test or an integration test; responsive to determining to perform the unit test, using the mock code to mimic the captured interactions during execution of the testing code; and responsive to determining to perform the integration test, using the object described by the computer program code to perform interactions with the method of the object described by the computer program code during execution of the testing code.