Use test data in test cases
Test data in Tosca Cloud helps you build a broad range of test scenarios in less time. This topic explains how to link your test data to your tests. It also has information on how to reuse test data and how to update test data during test runs.
Before you start
Before you can start using test data in a test case, you need to have the following things:
-
A test case with a designed test sequence. You'll link your test data to specific test actions, so you can't link to an empty test case.
-
At least one data set in Tosca Cloud. You can also link to subsets, so if that's your plan, have your subsets ready.
Note that by default, Tosca Cloud supports one row of data from the same data source per test case. However, there are options if you want to use multiple rows in the same test case.
Link your test data
To use test data in a test case, you need to link the two:
-
In your test case, hover over the Value column of the line where you want to use test data. Then, select the
icon.
Let's say your test case steers a text box called First name, and you want Tosca Cloud to enter test data into this text box at runtime. In this case, hover over the Value column of First name.
-
In the subsequent dialog, select Prefill expression values. Then, define the data you want to link:
-
Specify your data set or subset, as well as the column that contains the data.
-
Select Prefill values.
-
-
To finalize the link, select Apply.
And that's it! Your test data is now linked to this particular test action.
Use multiple data rows in the same test case
By default, you can use one row from the same data source within one test case. If you have a large data set and want to use multiple rows in the same test case, choose one of the following options:
-
Create subsets. Tosca Cloud uses one row per subset in the same test case.
-
Use the standard module called Test data - Find and provide item. With this module, you define conditions the data must meet. At runtime, Tosca Cloud returns all matching rows and stores the first one under an alias of your choice. To use the alias data, simply reference the alias in a test step.
You can add the module as many times as you like to define multiple rows of data in the same test case.
Reuse test data
Each time you run a test case, Tosca Cloud consumes the data and marks the row as used. This is true for both types of test runs: trial runs and actual test runs.
By default, Tosca Cloud blocks rows from being used more than once.
-
If the row comes from a subset, Tosca Cloud blocks the row in the subset and in the parent data set.
-
If the row comes from a data set that has subsets, Tosca Cloud blocks the row in the data set and all its subsets.
You can see the status of your test data on the Test data page.
If you want to reuse a row in future test runs, choose one of the following options:
-
Reset the status manually after the test run. This is useful if you're still in the debugging phase and mostly working with trial runs.
To manually reset, right-click the status of a row and select Reuse data from the context menu. You can also use the checkboxes to select more than one row at a time.
-
Stop rows from being marked as used in the first place. This is our recommended option for production, because it keeps post-run maintenance to a minimum.
To stop rows from being marked, use the standard module called Test data - Update item in your test case.
Update data during test runs
You can edit data sets and edit subsets directly from the Test data page, at any point.
In some cases, you may want to edit the row you're consuming during a test run. For example:
-
If you want to reuse the row, but with a different value in the defined column.
-
If you want to keep a permanent record of an outcome, such as an order number, by writing it directly to your test data.
To edit data during a test run, use the standard module called Test data - Update item in your test case.
What's next
You've just linked your test data to your test case. Well done!
Next up: do a test case trial run. Trial runs help you find and fix issues, so you can make your tests as stable and reliable as possible.
Once you're happy with your test case, pack it into a playlist, so you can run your tests in earnest.