# 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="/files/eQ5IvzDYHacDOYaNkMNq" 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="/files/d0bDryDfY7rjEb5uZkdy" 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="/files/obHqHAQ8CDjCC8dIFOd0" 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.


---

# Agent Instructions: 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:

```
GET https://docs.simplifyqa.ai/service-virtualization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
