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.
Claims19
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;
- building a request and response model for an operation of the API resource using the received definition for the API resource;
- 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 for the operation of the API resource;
- determining based at least on the request and response model that the particular input included in the API call that was received 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;
- and
- in response to determining based at least on the request and response model that the particular input included in the API call that was received 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 and based at least on the request and response model, a simulated response that matches the data type of the output from the operation of the API resource as defined in the definition;
- 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 a backend implementation code for the API resource instead of a simulated response.
A system for simulating an application programming interface (API), 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;
- building a request and response model for an operation of the API resource using the received definition for the API resource;
- 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 for the operation of the API resource;
- determining based at least on the request and response model that the particular input included in the API call that was received 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;
- and
- in response to determining based at least on the request and response model that the particular input included in the API call that was received 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 and based at least on the request and response model, a simulated response that matches the data type of the output from the operation of the API resource as defined in the definition;
- 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 a backend implementation code for the API resource instead of a simulated response.
A non-transitory computer-readable medium storing software for simulating an application programming interface (API) 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;
- building a request and response model for an operation of the API resource using the received definition for the API resource;
- 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 for the operation of the API resource;
- determining based at least on the request and response model that the particular input included in the API call that was received 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;
- and
- in response to determining based at least on the request and response model that the particular input included in the API call that was received 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 and based at least on the request and response model, a simulated response that matches the data type of the output from the operation of the API resource as defined in the definition;
- 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 a backend implementation code for the API resource instead of a simulated response.
Dependencies are inferred from the claim text.