Designer defined mocking service behavior
Assigneesalesforce.com, inc.
InventorMartin Battaglia
Life of this patent
Estimating the term…
Abstract
A mocking service generates a mock implementation of an API based on a API specification. Request and response behavior of the mock implementation of the API may be controlled by a separate API behavior file. The API behavior file may be parsed by the mocking service to generate behavior logic. When an API request is transmitted to the mock implementation of the API, the behavior logic is invoked and may control execution of the mock implementation of the API and the details of a generated response. Behaviors defined in the API behavior file may be global or resource specific and may include, for example, time delays, error rates, error codes, conditions, response overrides, etc.
Claims19
A method for testing an application programming interface (API) at a server, comprising:
- parsing, in memory of the server, an API specification for the API to determine a parsed model for the API specification, an API behavior file being linked to the API specification;
- generating a mock implementation of the API based at least in part on the parsed model for the API specification;
- running, in the memory of the server, the mock implementation of the API;
- detecting, at the server, a modification of the API behavior file;
- receiving, from a user device, a request message indicating the mock implementation of the API;
- and
- returning a response to the request message to the user device according to the modified API behavior file and the mock implementation of the API that is maintained in the memory of the server after the API behavior file is modified.
An apparatus for testing an application programming interface (API) at a server, comprising:
- a processor, memory in electronic communication with the processor;
- and instructions stored in the memory and executable by the processor to cause the apparatus to:
- parse, in memory of the server, an API specification for the API to determine a parsed model for the API specification, an API behavior file being linked to the API specification;
- generate a mock implementation of the API based at least in part on the parsed model for the API specification;
- run, in the memory of the server, the mock implementation of the API;
- detect, at the server, a modification of the API behavior file;
- receive, from a user device, a request message indicating the mock implementation of the API;
- and
- return a response to the request message to the user device according to the modified API behavior file and the mock implementation of the API that is maintained in the memory of the server after the API behavior file is modified.
A non-transitory computer-readable medium storing code for testing an application programming interface (API) at a server, the code comprising instructions executable by a processor to:
- parse, in memory of the server, an API specification for the API to determine a parsed model for the API specification, an API behavior file being linked to the API specification;
- generate a mock implementation of the API based at least in part on the parsed model for the API specification;
- run, in the memory of the server, the mock implementation of the API;
- detect, at the server, a modification of the API behavior file;
- receive, from a user device, a request message indicating the mock implementation of the API;
- and
- return a response to the request message to the user device according to the modified API behavior file and the mock implementation of the API that is maintained in the memory of the server after the API behavior file is modified.
Dependencies are inferred from the claim text.