Skip to content
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.Flowcharts is retired. Current docs
Get Free Trial
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.

Loop over Dataset

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

Dataset can be created in two ways:

  1. From Automate Dialog
  2. From Node

Let us create a simple Dataset.

  1. Open the Automate dialog.

  2. Navigate to the Data tab.

  3. Click on the plus icon to create new dataSet.

    Create New Data Source

  4. Set the Data Source name to user_details.csv.

  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.

  7. Type the values for the attributes below the attribute names.

    Set Dataset Values

  8. Click on Save.

  1. On the flowchart page, right click on the Node for which dataset needs to be created.

  2. Click on Dataset Loop.

  3. In the Dataset Loop dialog box, click on plus icon, to create new dataSet.

    Create Dataset from Node

  4. The Edit Dataset dialog opens up. Enter the required data and save.

  1. Enter the plaintext password values in the cells beneath the corresponding attribute names.

    Unencrypted Password

  2. Right-click the desired cells and select Encrypt from the context menu. The plaintext password will be converted into an encrypted string.

    Encrypted Password

  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.

    Show Dataset

  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.

  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.

    Path Level Single Dataset-row Report

  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.
  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.

    Flowchart level dataset report

  • Lets take another example where the flowchart verifies the cart total for books purchase.

    Flowchart for shopping cart with books

  • The Add $books and Verify $cart total keyword will be automated and extracted as follows:

    Add $books and  Verify $cart total Keyword automation

  1. Click on Add $books and Verify $cart total node and choose Dataset Loop from the menu.

  2. Choose the Data Source and Dataset or Create a new one.

    Set Data Source for the Node

  3. Data source and dataset may be set from a variable as well.

    Set Data Source and Dataset from variable

    Set Data Source only from variable

    Set Dataset only from variable

  4. The keyword in the Node will be run in a loop over all rows of the dataset.

  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.

    Node level dataset report with Data Loop

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.

  • Lets take the above example but split the keyword Add $books and Verify $cart total into two nodes.

    • Flowchart for shopping cart with books

    • The Add $books and Verify $cart total keywords will be automated and extracted individually as follows:

      Add $books Keyword automation

      Verify $cart total Keyword automation

    1. Select Add $books node and Verify $cart total node and choose Dataset Loop from the menu to attach the dataset books.csv with the node.

    2. Since two nodes are selected, Add $books node act as starting point of the dataset loop and Verify $cart total node act as ending point of the dataset loop.

      Data loop Boudary on Node

    • When executed, the whole flow will be executed once but within that flow the set of nodes within the data loop boundary will be executed multiple times to exercise each row of the dataset.
    1. Open the report by clicking on the Reports button/option.

    2. The detailed report shows the path execution with the used dataset row details. The keywords Add $books and Verify $cart total both have executed three times.

      Report with Data loop Boundary

    Datasets can be overridden to use different data in different environments.
    For example, to use different data for default, QA and production environments.

    • Create a new dataset as shown here.

    • Open the Edit Dataset dialog.

      Open dataset for editing

      • To create new environment, click on the drop-down near Env and select Add New.

        Adding new environment

      • Enter the env name in the prompt.

      • This will clear the Edit Dataset dialog and a new folder with given env name will be created under datasets folder of the project.

        New env folders created

      • Enter the required data and save.

    • To set the environment of execution, set sahi_env variable in External Variables under Advanced Run Settings section of Run Settings dialog before running.
      Data will be picked from data file of given environment instead of the default dataset.

      Setting environment for run

    Next: Flowchart Paths & Branches