Skip to content
You're viewing the v2 docs. Looking for v1?Go to v1 docs
Docs
Testsigma
Popular questions
↑↓ to navigate↵ to selectesc to close
Book a demo

Mock servers

A mock server returns simulated API responses during a run, so a test does not have to call the real backend service. Mock servers work in dry runs, test plan executions, and local executions.

  1. Go to Test Data > Mock Servers. The Endpoints page of the Mock Server application opens.

  2. Click Create Endpoint.

  3. Enter a subdomain for the endpoint on the Create New Endpoint page.

  4. Click Create.

The Create New Endpoint page of the mock server application, with the subdomain and Create

  1. Go to Create Tests > Test Cases and open the test case.

  2. Click Run in the action panel.

  3. In the Ad-Hoc Run overlay, configure Test Lab, Machine, and Environment.

  4. Expand Additional Settings and select the server from the Mock Server dropdown.

    Selecting a mock server in the Ad-Hoc Run overlay

  5. Click Run Now.

  1. Go to Test Plans and open the plan.

  2. Go to Test Plan Settings.

  3. Select the server from the Mock Server dropdown under Additional Settings.

  4. Click Update, or Create for a new plan.

  5. Click Run Now.

After a run, open the results page, click More Details, go to Machine Details, and select the mock server used. The Mock Server History section lists the rules that matched.

The Mock Server History section on the run results page

A mock rule decides which API calls the server intercepts and what it returns. Rules are created from the calls a real run made, so run the test once first.

  1. Open the test case results page and click More Details.

  2. Go to Machine Details and select the mock server used.

  3. Find the API call you want to mock in the API Results table, and click Create Rule in its Action column.

  4. Update the rule details in the Mock Rules dialog.

  5. Click Save.

The server returns the configured response for matching calls from the next execution onward.

Was this page helpful?