In data-driven testing, you will typically want to test deterministic scenarios that verify the application under test always produces the same output given a specific set of inputs (e.g. 12 + 30 = 42). Nevertheless, there may also be situations in which you wish to test non-deterministic scenarios using random values. You can use random values with mabl datatables in the following way.
In the following datatable example, we have two variables and seven scenarios for each variable. The
randomString variable is assigned a string template value for each scenario while the
staticString variable has just static values.
mabl datatable using random string templates
When you run a test using the randomString variable from that datatable, mabl will assign a different random value to that variable according to the string template specified for the scenario.
You can use random variables from a datatable in the same way as using any other datatable variable. Simply, associate the datatable with your test and use the mabl Trainer to enter the variable value into an input field in your application or assert against it.
If things are working correctly, mabl should input a random value generated based on the specified string template for the variable in the datatable.
Note that only the first datatable scenario variable values are used when replaying steps in the Trainer. Run the test as a part of a plan to see test results from all data-driven scenarios.
Running data-driven test scenarios as part of a plan.
To verify that everything works, review the test results for one of the scenarios in the plan. You should see the generated random values in the run results.
Test results showing the generated random value for the randomString variable
Updated 3 months ago
|Adding and using variables|
|Creating DataTables for your tests|
|Associating and running journeys with a DataTable|