This document provides a detailed overview of the internal process workflow for using the Trafix API Testing Framework. It outlines the steps involved in defining test cases, preparing requests, sending them to the API, receiving and validating responses, and logging results. This guide is designed for internal users to understand how the framework operates at each stage of the API testing process.
The first step in the workflow is when the User interacts with the Trafix Testing Tool. In this step, users define the API test cases, specifying which API endpoints they need to test, the HTTP methods (GET, POST, PUT, DELETE), request parameters (headers, body), and the expected outcomes (status codes, response bodies, etc.).
For testing a GET
request on /api/products
:
200 OK
After the user has defined the test cases, the Trafix Testing Tool takes this input and prepares the actual API requests. The tool ensures that all necessary components, such as headers, body data, authentication tokens, and query parameters, are included based on the test case details.
For a POST
request to create a new product on /api/products
, the request might be prepared with:
Content-Type: application/json
{"name": "New Product", "price": 20.99}
POST
Once the request is prepared, Trafix sends it to the Target API Server for processing. The API server processes the request, performs the necessary operations (e.g., querying the database, modifying data), and sends a response back to Trafix. The response is then captured by Trafix for validation.
For a GET
request to /api/products
, the API might return:
200 OK
{"products": [{"id": 1, "name": "Product 1"}]}
Once the response is received, Trafix performs validation based on the test case criteria. This validation ensures that the response matches the expected values for status codes, response bodies, and headers. The results of the validation are logged, and the user is notified whether the test has passed or failed.
If the response from /api/products
matches the expected result:
200 OK
200 OK
{"products": [{"id": 1, "name": "Product 1"}]}
{"products": [{"id": 1, "name": "Product 1"}]}
The test passes and is marked as Pass.
If there's a discrepancy:
200 OK
404 Not Found
The test fails and is marked as Fail.
The entire Trafix API Testing Framework workflow is as follows: