Endpoint cases
The concept of Endpoint case is unique to Apidog.
Unlike many API testing tools like Postman, the data in Apidog is organized based on API specifications rather than Collections. This organizational structure aligns more closely with the habits of API development teams.
This distinction results in Apidog having a different information structure compared to Postman. In a Postman Collection, each element represents a Request and includes the key-value pairs for each parameter.
In Apidog, the smallest unit in API spec is the Endpoint spec, which describes the endpoint, including the schema and keys but not the actual values sent in the request.
To store these values and actual requests, Apidog adds an additional level below the endpoint, known as the Endpoint case.
An Endpoint case corresponds to a request in Postman.
Create an endpoint case
When you send a request or debug in the Run tab of an Endpoint, if you want to save the request permanently, you can click on Save as case
. This action will preserve the request as an Endpoint case within the endpoint's structure.
You can name the Endpoint case and choose whether to save the response simultaneously.
What is saved in endpoint cases
As mentioned earlier, the endpoint specification is saved within the endpoint, while the values are stored in the endpoint case. Specifically, an endpoint case includes the following data:
- Request parameter values, covering path parameters, query parameters, header parameters, and body parameters in form-data format.
- Body content in formats like RAW, JSON, XML, etc.
- Pre and post-request processors.
- Received response details.
- Response validation settings, indicating whether validation is enabled and specifying which response to validate against.
Therefore, if you modify the specification of a parameter in the endpoint spec, the endpoint case will be updated in real-time.
Reference endpoint case as an automated test step
Endpoint cases can be referenced as test steps in automated test scenarios. When referenced, the request parameters in the endpoint case will be applied directly to the test step. You can see a clear notification that any changes made to the endpoint case will automatically update all test steps that reference it.
Click the referencing icon at the top-right corner to view which test scenarios reference the endpoint case and the total number of test scenarios that use it. This gives you an overview of how it is used in automated test.
Clicking a test scenario takes you to the scenario detail page, where related steps using the case are highlighted for easy viewing.
Clicking a test step that references the endpoint case will notify you that any changes will sync with the original case.
Best practices for using endpoint cases
- Define API specifications thoroughly.
- Create multiple endpoint cases for each endpoint to cover different conditions.
- For each endpoint case, write assertions or other pre and post-request processors.
- Reference endpoint cases in automated tests to compose test scenarios.
- If there are updates to the API specifications, both the endpoint cases and test scenarios can be synchronized. You can choose to update test scenarios manually or set them to update automatically.