Sandbox Testing
Was this helpful?
Was this helpful?
Sandbox testing in digiRunner enables developers to simulate API operations safely, ensuring functionality and service quality without impacting live services. It supports parallel development for frontend and backend teams using mock data, reducing delays and improving efficiency.
In the mock configuration section, fill in Mock Status Code, Mock Headers Key, Mock Headers Value, and Mock Body to simulate the API response during testing.
Mock Status Code: Specify the HTTP status code the API should return during the mock test, such as 200
for success, 404
for not found, 500
for server error.
Mock Headers Key: Specify the custom header keys to include in the mock response. These headers provide additional information, such as content type, authorization, or caching policies.
Mock Headers Value: Specify the corresponding values for the custom headers defined in the Mock Headers Key field. For example, for a Content-Type
header, you could assign the value application/json
.
Mock Body: Specify the simulated response body in JSON format. For example:
Go to API Test.
Use the Mock Test feature to send a request to the API and verify that the system returns the mock data configured previously.
Follow the steps below to call mock data set in digiRunner using an external tool like Postman.
Select the appropriate HTTP method (e.g., GET, POST) based on the API you are testing.
Fill in the URL of the API endpoint for testing.
Launch Postman, and go to the Headers tab (as shown in the image).
Add a new header with the key dgr_mock_test
, and set its value to true
(refer to steps 2 and 3 in the image). This informs digiRunner that you want to use mock data for the request.
Add any additional required headers, such as Content-Type
or Authorization
, according to the API specifications.
Once the mock headers are set up, send the request.
The response should include the mock data you configured in digiRunner, including the mock status code, headers, and body.
Go to API Management, and click on theicon to update the API you want to test.