Loop over Dataset

abstract Datasets allow running the same path with multiple sets of data. This is useful for:
  • Data setup
  • Verifying against calculations

info Verifying against calculations: Some test cases verify the state of an application. For example, can a product be created correctly, can it be edited, can it be searched, can it be deleted etc. In these tests, the input just needs to be valid data. It does not matter what the specific value is. This can be accomplished using Data Generators.

However, in some flows, we may need to verify a calculation that is performed on a particular attribute. For example, we may want to check if a coupon discount is applied correctly to the cart total. To test this, we will need to set up the product price (say $100) and the discount value (say 10%) to known values so that the discounted cart total ($90 here) can be verified. Since these values are on different entities it is not possible to use data generators here. We need to explicitly specify the values via datasets.

Create Dataset

Dataset can be created in two ways:
  1. From Automate Dialog
  2. From Node

From Automate Dialog

Let us create a simple Dataset.
  1. Open the Automate dialog.
  2. Navigate to the Data tab.
  3. Click on the drop-down arrow for Data Source and select Create New.
  4. Set the Data Source name to user_details.csv.
    info The Data Source is where the data will be stored. Currently supports csv files.
    A single Data Source can contain multiple Datasets. So all datasets pertaining to user may be clubbed into a single Data Source of user_details.csv.
    These files reside in <sahipro>/userdata/scripts/flowchartsdata/<project_name>/datasets folder.
  5. Enter a dataset identifier in the Dataset. (If not provided, it will be default).
  6. Choose the attribute from Add Columns drop-down. Eg. $user.firstname, $user.lastname.
    infoWe need to provide values for these attributes.
    For other attributes which are not specified in the dataset, data generators will be used.
  7. Type the values for the attributes below the attribute names.
  8. Click on Save.

From Node

  1. On the flowchart page, right click on the Node for which dataset needs to be created.
  2. Click on Data Loop.
  3. In the Attach Datadet dialog box, under Data Dource drop-down, select Create.
  4. The Edit Dataset dialog opens up. Enter the required data and save.

Run Dataset

Path Level

  1. On the Automate dialog, go to Data tab
  2. Select the Data Source and a Dataset(group name) to associate it with the Path.
  3. Select the dataset row to run by default when run from Automate dialog.
  4. Click on Run button on Automate dialog.
  5. On the Run Settings dialog, select the Run Normal Path and click on Run button.
  6. The flow executes one time and uses the select dataset row.
View Report
  1. Open the report by clicking on the Reports button/option either from the Automate dialog or from the flowcharts page.
  2. The detailed report shows the execution with the used dataset row details.

Flowchart level/Project Level

  1. Click on Run button on the flowchart page or the project page.
  2. On the Run Settings dialog, select the Run Normal Path and click on Run button.
  3. The flow will be run multiple times to exercise each row of the dataset. For each row in the dataset, an individual target website browser will open and the steps will be carried out.
View Report
  1. Open the report by clicking on the Reports button/option.
  2. The detailed report shows the multiple path execution with the used dataset row details.

Node level

  1. Click on Add $books and Verify $cart total node and choose Data/Loop from the menu.
  2. Choose the Data Source and Dataset or Create a new one.
  3. Data source and dataset may be set from a variable as well.
  4. The keyword in the Node will be run in a loop over all rows of the dataset.
View Report
  1. Open the report by clicking on the Reports button/option.
  2. The detailed report shows the multiple path execution with the used dataset row details. The keyword Add $books and Verify $cart total has executed thrice.

Data / Loop Boundary

The start and end boundaries can be defined for the dataset attached to a node.
The Keywords in the Nodes inside the start and end boundaries will be run in a loop over all rows of the dataset.