> For the complete documentation index, see [llms.txt](https://docs.tpi.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tpi.dev/get-started/sandbox-testing.md).

# Sandbox Testing

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.

<figure><img src="https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/PYN9aEGbAz0EJHURFMDp/sandbox_testing_1.png" alt=""><figcaption></figcaption></figure>

## Configuring Sandbox Testing

### Access API Management

Go to **API Management**, and click on the![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/VzgSX5zowPh0AbKVdhn6/16.png)icon to update the API you want to test.

<figure><img src="https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/BfXbxeI8yaBi7JWlWGu2/image.png" alt=""><figcaption></figcaption></figure>

### Specify Mock Test Values

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.

<figure><img src="https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/Ykv6XIGiMo7ovyGr10tf/sandbox_testing_2.png" alt=""><figcaption></figcaption></figure>

* **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:

  ```json
  {
      "name": "john",
      "salary": 150000
  }
  ```

### Run Mock Test

1. Go to **API Test**.
2. Use the **Mock Test** feature to send a request to the API and verify that the system returns the mock data configured previously.

<figure><img src="https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/yNGunmhk2H9AByE7S6DZ/image.png" alt=""><figcaption></figcaption></figure>

## Calling Mock Data with External Tool

Follow the steps below to call mock data set in digiRunner using an external tool like Postman.

### Set Request Type and URL

1. Select the appropriate HTTP method (e.g., GET, POST) based on the API you are testing.
2. Fill in the URL of the API endpoint for testing.

### Add Headers for Mock Testing

1. Launch Postman, and go to the **Headers** tab (as shown in the image).
2. 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.
3. Add any additional required headers, such as `Content-Type` or `Authorization`, according to the API specifications.

<figure><img src="https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/3YnlsSz44q36RV0V3ISd/sandbox_testing_3.png" alt=""><figcaption></figcaption></figure>

### Send the Request

1. Once the mock headers are set up, send the request.
2. The response should include the mock data you configured in digiRunner, including the mock status code, headers, and body.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tpi.dev/get-started/sandbox-testing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
