Skip to main content
Beta. API simulation wrappers are a beta feature and may change.
An API simulation wrapper calls an HTTP endpoint before each simulation in a test set. Values from the JSON response become available as template variables in the test case’s Simulation Input. Use an API simulation wrapper when a scenario needs fresh data at runtime, such as a test customer, account identifier, quote, reservation, or session. The wrapper is configured once for the test set. Saving the test set applies the same configuration to every test case in it, while the endpoint is called separately before each simulation.

Configure an API call

1

Open a test set

Open Test Sets, then select the test set you want to configure.
2

Select the API wrapper

In Simulation setup, select API and click Add Pre-Simulation API Call.
3

Configure the request

Enter the endpoint URL, HTTP method, timeout, and any optional JSON request body or headers.
4

Reference the response

Add {{sim_wrapper.api.*}} variables to your test case inputs using the response examples below.
5

Save the test set

Save to apply the configuration to every test case in the test set.

Request settings

Use test data and scoped credentials. Do not place production secrets or real sensitive customer data in test set configuration or endpoint responses.

Use an object response

For a JSON object response, fields are available directly under sim_wrapper.api. For example, if the endpoint returns:
Use these values in a scenario:

Use an array response

For a JSON array response, the complete array is available under sim_wrapper.api.response. Use bracket notation to select an item. For example, if the endpoint returns:
Use the nested values in a scenario:
Property names are case-sensitive and must match the JSON response exactly. For example, phoneNumber and phone_number are different properties.

Troubleshooting

  • Confirm the endpoint is publicly reachable from Coval and returns a successful HTTP status.
  • Confirm the response body is valid JSON.
  • Check that every property name and array index in the template matches the response.
  • Increase the timeout if the endpoint regularly needs more than 30 seconds.
  • Test the endpoint with non-sensitive sample data before running the full test set.
If a referenced value is unavailable, the template cannot be resolved in the simulation input.