> For the complete documentation index, see [llms.txt](https://docs.simplifyqa.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.simplifyqa.ai/service-virtualization.md).

# Service Virtualization

Service Virtualization in **SimplifyQA** allows testers to simulate APIs and services that may be unavailable, expensive, or difficult to access during testing. By creating **mock services**, users can continue validating test scenarios without relying on live systems.

### Enabling Service Virtualization

Service Virtualization must first be enabled by the **Admin**:

1. Log in amd switch to **Admin**.
2. Navigate to **Project Settings → Roles and Services**.
3. Under **Test Management**, locate **Service Virtualization**.
   1. Enable the required privileges.
   2. Save the enabled privileges.

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FSQevKI7MdudadtIOvxnR%2Fservice%20virtualization.png?alt=media&amp;token=493030af-4c67-4413-9e11-f52b049e1612" alt=""><figcaption></figcaption></figure>

4. Switch back to the **User account**.
5. A new topic **Service Virtualization** will now be visible under **Test Management**.

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FCEjmPdxoguf7vp3kmNsE%2Fservice%20virtualization%20under%20test%20management.png?alt=media&amp;token=a11d95d4-8192-4415-8cec-4e67e8793796" alt=""><figcaption></figcaption></figure>

###

### Creating a Mock Service

1. Go to **Test Management → Service Virtualization**.
2. Click +**Mock Service** to create a new service.
3. Enter the following details:
   * **Mock API Name** – A unique name for the mock service.
   * **Request Type** – Select HTTP method (GET, POST, PUT, DELETE).
   * **Endpoint URL** – Paste the target endpoint to be mocked.
4. **Add Responses**:
   * Click the **Add (+) icon** to create one or more responses for the API.
5. **Add Rules** (optional):
   * Define rules to simulate different conditions or behaviors.
6. Click **Save** to create the mock service.

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FqFiPJKJZVXrKGPWwa5Ym%2Fmock%20api.png?alt=media&amp;token=4a62bbaf-1345-47df-8a68-31058e763c48" alt=""><figcaption></figcaption></figure>

### Using Mock APIs in Test Cases

1. Create a new API test case or open an existing one.
2. Replace the endpoint with the **Mock API URL**.
3. In the **Headers** section, add:
   * **Key:** `x-mock-token`
   * **Value:**&#x20;
     * Navigate to **Settings → Security → Create & Manage API Token**.
     * Click **Generate Token**, name your token, and click **Save**.
     * Copy the generated API key and paste it into the field.
4. Save the test case.
5. Run the test case to execute against the mock service.

### Key Benefits

* **Unblocks testing early** – no need to wait for dependent services.
* **Cost-efficient** – avoids hitting paid or rate-limited APIs.
* **Flexible simulation** – supports multiple responses and rules.
* **Seamless integration** – works with both new and existing API test cases.

### Conclusion

Service Virtualization in **SimplifyQA** empowers teams to test faster and with fewer dependencies by simulating APIs and services. Whether services are unavailable, costly, or under development, mock services provide a reliable way to validate functionality. With support for multiple responses, rules, and seamless integration into test cases, Service Virtualization ensures robust and flexible API testing.
