Simulated testing of API
AssigneeGoogle Inc.
InventorsPrabhat Jha, Scott Ganyo, Mohsen Azimi, Ed Anuff, A. Marsh Gardiner
Life of this patent
Estimating the term…
Abstract
A definition for the API is received. A request and response model is built for each defined operation of the API resource using the received definition. A simulated response for each defined operation of the API resource is generated in an API development environment according to the request and response model.
Claims20
A method of simulating an application programming interface (API), comprising:
- receiving a definition for an API resource that defines an expected data type of an input into an operation of the API resource and a data type of an output from the operation of the API resource in response to input of the expected data type;
- receiving a request to enable a simulation mode for the API resource;
- receiving, from a client application and after the API resource is placed in the simulation mode in response to the request to enable the simulation mode for the API resource, an API call request for the operation of the API resource, where the API call request includes particular input that matches the expected data type of an input into the operation of the API resource as defined in the definition for the API resource that was received;
- providing to the client application in response to the request, a simulated response that matches the data type of the output from the operation of the API resource as defined in the definition;
- generating an implementation code template for the API resource based on the definition for the API resource that was used to provide the simulated response, wherein the implementation code template includes application code that (i) implements functionality of the API resource to access services of a backend service, (ii) is generated based on the definition for the API resource that was used to provide the simulated response, and (iii) is executed for the API resource after the simulation mode for the API resource is disabled;
- receiving a request to disable the simulation mode for the API resource;
- receiving, from the client application and after receiving the request to disable the simulation mode for the API resource, a second API call request for the operation of the API resource;
- and
- providing the client application a response according to execution of the application code in the implementation code template for the API resource instead of a simulated response.
A system comprising:
- one or more computers and one or more storage devices storing instructions that are operable, when executed by the one or more computers, to cause the one or more computers to perform operations comprising:
- receiving a definition for an API resource that defines an expected data type of an input into an operation of the API resource and a data type of an output from the operation of the API resource in response to input of the expected data type;
- receiving a request to enable a simulation mode for the API resource;
- receiving, from a client application and after the API resource is placed in the simulation mode in response to the request to enable the simulation mode for the API resource, an API call request for the operation of the API resource, where the API call request includes particular input that matches the expected data type of an input into the operation of the API resource as defined in the definition for the API resource that was received;
- providing to the client application in response to the request, a simulated response that matches the data type of the output from the operation of the API resource as defined in the definition;
- generating an implementation code template for the API resource based on the definition for the API resource that was used to provide the simulated response, wherein the implementation code template includes application code that (i) implements functionality of the API resource to access services of a backend service, (ii) is generated based on the definition for the API resource that was used to provide the simulated response, and (iii) is executed for the API resource after the simulation mode for the API resource is disabled;
- receiving a request to disable the simulation mode for the API resource;
- receiving, from the client application and after receiving the request to disable the simulation mode for the API resource, a second API call request for the operation of the API resource;
- and
- providing the client application a response according to execution of the application code in the implementation code template for the API resource instead of a simulated response.
A non-transitory computer-readable medium storing software comprising instructions executable by one or more computers which, upon such execution, cause the one or more computers to perform operations comprising:
- receiving a definition for an API resource that defines an expected data type of an input into an operation of the API resource and a data type of an output from the operation of the API resource in response to input of the expected data type;
- receiving a request to enable a simulation mode for the API resource;
- receiving, from a client application and after the API resource is placed in the simulation mode in response to the request to enable the simulation mode for the API resource, an API call request for the operation of the API resource, where the API call request includes particular input that matches the expected data type of an input into the operation of the API resource as defined in the definition for the API resource that was received;
- providing to the client application in response to the request, a simulated response that matches the data type of the output from the operation of the API resource as defined in the definition;
- generating an implementation code template for the API resource based on the definition for the API resource that was used to provide the simulated response, wherein the implementation code template includes application code that (i) implements functionality of the API resource to access services of a backend service, (ii) is generated based on the definition for the API resource that was used to provide the simulated response, and (iii) is executed for the API resource after the simulation mode for the API resource is disabled;
- receiving a request to disable the simulation mode for the API resource;
- receiving, from the client application and after receiving the request to disable the simulation mode for the API resource, a second API call request for the operation of the API resource;
- and
- providing the client application a response according to execution of the application code in the implementation code template for the API resource instead of a simulated response.
Dependencies are inferred from the claim text.