Conditional/Environmental Test Data

Learn how environment-specific test data can make your tests more dynamic.

Creating Environment-Specific Test Data

In Rainforest, you can use tailor test data to the environment. Embed {{rainforest.environment_id}} into an existing dynamic datadynamic data - Values that you define in a comma-separated values (CSV) file and upload to Rainforest. Dynamic data allows you to assign each tester a unique value, such as login credentials. placeholder to specify the data to use for each environment. When the test runs, the placeholder is replaced with the environment ID.

This feature is useful when you require dynamic data that changes based on the environment your test runs on. Without this feature, you’d have to replicate the test for each environment.

How It Works

This is best illustrated by providing a demonstration.

1. Find the environment ID.

Navigate to Settings > Sites and hover over an environment to reveal its ID.

Looking up your environment ID.Looking up your environment ID.

Looking up your environment ID.

2. Specify the environment IDs in each column header.

In your dynamic data CSV, include the environment ID in the header for each column you want to associate with an environment. You can place the ID anywhere in the column title, as long as it’s consistent throughout.

In the following example, column B is associated with environment 557.

A dynamic data CSV file.A dynamic data CSV file.

A dynamic data CSV file.

3. Upload your dynamic data CSV file.

Once the file has been uploaded, a preview appears, showing you the placeholders for each environment.

A preview showing placeholders and environment IDs.A preview showing placeholders and environment IDs.

A preview showing placeholders and environment IDs.

4. Add your conditional data to a test step.

  • When you write your test, use {{rainforest.environment_id}} to specify the environment ID for the run.
  • In the example below, the column var_{{rainforest.environment_id}} is called inside the test_conditional_vars placeholder file by writing:


Specifying the environment ID.Specifying the environment ID.

Specifying the environment ID.

Rainforest uses the column tied to the environment specified in the column header when you run your test. In this example, environment “5098” was used and returned a value of “4c.”

The returned value is “4c.”The returned value is “4c.”

The returned value is “4c.”

If you have any questions, reach out to us at [email protected] or via the chat bubble below.

Did this page help you?