> For the complete documentation index, see [llms.txt](https://qabunch.gitbook.io/qaautomater/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qabunch.gitbook.io/qaautomater/api-automation/mock-repository-page.md).

# Mock Repository Page

The Mock Repository page is utilized to configure the response data for API test scripts. This ensures that when a test script is called as a dependent API script and executed for Unit Testing, the predefined responses set on this page will be employed.

<figure><img src="https://423756580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqEc3xHBB1F9T2KOd6mX7%2Fuploads%2FpUVF4FHnIm71hKDVN7gS%2Fimage.png?alt=media&amp;token=8db85650-0dc9-4f1e-be2e-2d8fab5e5a43" alt=""><figcaption></figcaption></figure>

The Mock Repository page contains three sections.

1. Choose API Scripts
2. Mock Response Header
3. Mock Response Body

**Choose API Scripts**

This section is employed to choose an existing API test script. Once the component is selected, you can further choose the Test ID for which you wish to set a mock response.

<figure><img src="https://423756580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqEc3xHBB1F9T2KOd6mX7%2Fuploads%2FDIJ2BaJb4QeWLn4cMSvH%2Fimage.png?alt=media&amp;token=4a4cc33e-6446-4ca3-a8e0-8ee7e64d9d61" alt=""><figcaption></figcaption></figure>

Do you want the mock response data to be overridden by real data after script execution : If this value is true, the mock response data will be overridden by real data after script execution whenever the test script passes

**Mock Response Header**

If we require any response in the header, we can add a header name and specify its value in this section. For example, here I am adding "Host."

<figure><img src="https://423756580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqEc3xHBB1F9T2KOd6mX7%2Fuploads%2FzccEwZEAwT9AhmT1cxIj%2Fimage.png?alt=media&amp;token=bb8ed528-c153-402c-89f0-6545966aa954" alt=""><figcaption></figcaption></figure>

**Mock Response Body**

In the Mock Response Body, you can set your mock response data and define the response format. For example, I am adding {"email":"","flightnumber":""}.

<figure><img src="https://423756580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqEc3xHBB1F9T2KOd6mX7%2Fuploads%2FVER7I59bWBxsjP5bIPi5%2Fimage.png?alt=media&amp;token=3cfd6f00-fdaf-4b4a-aa6b-8f9fadf182b2" alt=""><figcaption></figcaption></figure>

After clicking the Dynamic Data button, we can set the appropriate data key.

<figure><img src="https://423756580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqEc3xHBB1F9T2KOd6mX7%2Fuploads%2FEdckFx7qSeZ9u8rrJpWC%2Fimage.png?alt=media&amp;token=ef692a21-8802-4594-8b3f-a62619a4df28" alt=""><figcaption></figcaption></figure>

Once you click the save button, the mock response for the selected test script will be set. Whenever the test script is called, it will return the response as per our selected mock configuration.

<figure><img src="https://423756580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqEc3xHBB1F9T2KOd6mX7%2Fuploads%2FyCNsm6IT6aCn4DkTdGvH%2Fimage.png?alt=media&amp;token=e701b809-e242-4a39-ab87-c2e51ecead0c" alt=""><figcaption></figcaption></figure>

**Example**

Now, let's assume this test script is called in a predependent test script for another script.

<figure><img src="https://423756580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqEc3xHBB1F9T2KOd6mX7%2Fuploads%2Fg3K0H2loiSb30CtsXTNw%2Fimage.png?alt=media&amp;token=fbf5d431-f69b-45e8-a614-7a5e1212f5fd" alt=""><figcaption></figcaption></figure>

Now, when you debug and run the test script, our mock response will be utilized.

<figure><img src="https://423756580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqEc3xHBB1F9T2KOd6mX7%2Fuploads%2F3c5JxjDMZrV0JFZmepH7%2Fimage.png?alt=media&amp;token=fc968787-35f8-4887-8605-98e598e2c15b" alt=""><figcaption></figcaption></figure>
