Learn how to add information to your test steps that changes from run to run.
Using dynamic data in your test steps, you can inject information that changes from run to run. Define a list of values in a CSV file and upload it to Rainforest. Add a placeholder to a test step. When the test executes, the placeholder is replaced with a value from the list.
In this article, we cover:
- How to create dynamic data and upload it to Rainforest
- The number of values you must define
- How dynamic data is assigned
- How to add dynamic data into a test step
- Common use cases
Note: Variables are now called test data.
Creating Your Dynamic Data
- Define the test data you want to upload to Rainforest and save it in a CSV file.
For more information, see Calculating the Required Number of Data Rows.
In this example, we create two dynamic data placeholders:
- Open the Test Data settings page and click the Add New button in the Dynamic Data section.
Key in a name for your dynamic data group, consisting of letters, numbers, and underscores. Spaces and special characters are not supported.
Key in a description for your dynamic data placeholder so members of your team can understand at a glance the placeholder’s purpose.
Click the Choose File button to select the CSV file. When uploaded, each row is converted to a placeholder in the format
Now you can update your dynamic data as needed by clicking Edit or Delete on the right-hand side of any item in the list.
Note: To avoid disrupting your test runs, you must provide sufficient data for the run to complete. We cover this in the next section.
Calculating the Required Number of Data Rows
Automation Test Runs
When an automated run executes, each test run will use one unique row of dynamic data. To ensure you have sufficient data, use the following calculation:
(Tests x Browsers or Platforms x # of Retries) x 2 automation agents
- Tests: The number of tests in a single run.
- Browsers or Platforms: The number of browsers or platforms for each test, typically we recommend one test per browser/platform.
- # of Retries: determined in your global settings as the number of times the automated test will retry if it fails.
- Automation Agents: The maximum number of automation test agents that will retry if there's an error.
Tester Community Test Runs
For tests run using the tester community, each tester will receive one unique row of dynamic data. To ensure you have sufficient data, use the following calculation:
(Tests x Browsers or Platforms) x 6 Testers
- Tests: The number of tests in a single run.
- Browsers or Platforms: The number of browsers or platforms for each test.
- Testers: The maximum number of testers for each test.
Example Data Row Calculation
To successfully run 2 login tests using 3 browsers with the Tester Community, the minimum number of required data rows is 36:
(2 Tests x 3 Browsers or Platforms) x 6 Testers
- If you don’t have enough data rows for the test, Rainforest displays an error; the test cannot run.
- If you created the required number of data rows, but more are needed, the test halts with an error.
How We Assign Dynamic Data
Dynamic data is randomly assigned. Values do not repeat during a test run unless you mark them as reusable.
Reusable Dynamic Data
Marking dynamic data as reusable can significantly impact your test result time. Reusing data creates a gate system of “One out, one in” for your dynamic data.
For example, say you have two rows of login data and three tests. The third test will not be kicked off until one of the other testa has finished. In terms of efficiency, it’s always better to add more data rows rather than mark something as reusable.
Previewing steps in the Visual Editor that use reusable data will use one of the rows until the browser tab is closed or the VM times out.
Adding Dynamic Data to a Test Step
- In the step editor, click Insert Test Data to bring up the test data menu.
- Click any of the dynamic data groups to reveal the choices.
- Select the placeholder you want to insert.
Common Use Cases
The most common use case for dynamic data is assigning unique login credentials to each tester. Doing so helps to avoid shared state issues arising from actions on the same set of credentials.
Once you’re familiar with how dynamic data works, you can use it to provide values such as:
- Login credentials
- Unique account information
- Product category codes
- Educational course names
We’re here to help. Reach out to us if you’re not sure how to take advantage of dynamic data.
If you have any questions, reach out to us at [email protected].
Updated 18 days ago