API Automation

Introduction

What is ZEST’s Automated Automation?

Often, developing Automation code is repetitive and time-consuming as similar automation execution and validation code should be developed for every API. To streamline this automation phase and alleviate the associated challenges, ZEST simplifies Automation and accomplishes the following,

  1. Auto-generation of test cases
  2. Automatic validation of test case results
  3. Automatic report generation

ZEST’s Automated Automation flow

1. Fetching dependent resource details

Based on the ZEST Specification File, the dependent resources are executed first as they are required for automation of current resources. If the dependent resource of the current resource has further dependent resources, then automation happens for those resources also. So, make sure you add the ZSPEC files of the dependent resources.

2. Test Case Generation

The Test Case Builder builds all the combinations of positive and negative use cases based on the attributes of <property> that you update in ZSPEC.

3. Execution

Based on the value of auto-sync attribute in the ZSPEC, synchronous or asynchronous execution of HTTP request will occur. The HTTPS responses are stored in the Data Manager.

Note: Once all dependency resources are executed and saved in data manager, the actual resource will get executed. i.e till step 3 the process works in a loop for all the dependent resources.

4. Validation of resources

Resource Validation happens based on the request category (CRUD). Resource Validator validates the READ operation and the Response Validator validates the other operations. The Input Validator validates the input of the API call with a callback verification to the same record.

Following are the default validations of ZEST.

  • Status Code - The status codes of API calls made during automation are validated against the expected status codes specified in the spec file.
  • Structure - The structure which includes the data type and values are validated against the expected structures specified in the spec file.
  • Input Validation - The possible values given in the spec are used to build multiple combinations of input and are validated.
  • Call back Verification - GET API calls mentioned in the spec are fired and the actions like Create, Update and Delete are verified.

5. Report Generation

The validation and execution details are used to build a detailed report for the automation. The report includes the following details - overview report, failed cases, success cases, and dependency cases.

Each test case comprises of the following details,

  • Satisfactory score - The score is a number ranging from 0 to 1, aiding in the selection of a <structure> from a list for validation against the received response. It is calculated by comparing a structure in the response of a test case to the corresponding structures outlined in the ZSPEC.
  • Case - A case in API automation validates an API’s functionality by sending requests with specific inputs and verifying the response status, headers, and body against expected outcomes.
  • HTTP request method - Defines the action to be performed on a resource, such as GET, POST, PUT, or DELETE.
  • Status code - A 3-digit number in the HTTP response indicating the result of the request, like 200 (OK) or 404 (Not Found).
  • Endpoint - The specific URL where the API request is sent.
  • Headers - Key-value pairs sent in the request or response providing metadata, such as authentication tokens or content type.
  • Params - Query string or URL parameters used to pass data in the request.
  • Request body - Data sent with the request, typically in POST or PUT, containing details like JSON or form data.
  • Response body - Data returned by the server in response to a request, often in JSON or XML format.

Last Updated 2025-05-30 16:54:59 +0530 +0530