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

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.
  9. Select the Data Source and Dataset(group name) to associate it with the Path. This will also display the currently used dataset.
    infoWhen running the flowchart, this path will be run with all rows of the Dataset.
  10. Select the dataset row to run by default when run from Automate dialog.
    info This row will be used only while interactively working on automation from the Automate dialog.
    This selection is ignored when run from flowcharts level.
  11. You can change the dataset or click Edit to edit the dataset

Run a Path with Single Dataset Row

  1. Click on Run button on Automate dialog.
  2. On the Run Settings dialog, select the Run Normal Path and click on Run button.
  3. The OpenCart website opens and the values automatically get populated for the user registration. Only the selected Dataset row is run.
  4. Once the Run process is complete, the browser with OpenCart website closes automatically.

Run the Flowchart with all Dataset Rows

  1. Click on Run button on the top of the flowchart.
  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.

View Report

  1. Click on Reports button on Automate dialog.
  2. The Script Summary is displayed.
    -Click on the path name.
  3. The Suite Report is displayed. The same path gets executed multiple times based on the data present in the dataset.
    Here the path executed twice as there were two rows of data in the dataset.
    Click on the Path name link to view the script report.
  4. The Script Report is displayed.
  5. You can see all the details of running of each keyword along with the data used.

Dataset at Node level

Datasets can also be attached to a Node.
  1. Click on any Node and choose Data/Loop from the menu.
  2. Choose the Data Source and Dataset or Create a new one.
The keywords in the Node will be run in a loop over all rows of the dataset.