What is it?

A data-driven task (a.k.a. parameterized task) is a task designed to accept one or more parameters that are used in the task . It is expected that the task will be run multiple times and each iteration will be provided different values for the parameters. The parameters are typically used to vary the user inputs and to check the output.

Using MuseIDE, there are two steps from a single (working) task to set of tasks driven by a set of data values:

  1. Parameterize the task
  2. Build the data table
  3. Create a parameterized task suite

Parameterize the task

Even if a task will not be used with multiple input/output values, parameterizing a task also serves to document what user inputs go into the workflow and what values are expected as output from the system.

So in the Wikipedia search task, I want to parameterize the search term giraffe and the expected page title. First step is to replace those constants with variable references:

test1-parameterized.png

After this change, the task will lookup variables named search_term and expected_page_title and use them in the user input and page title verification steps.

If I ran the task now, it would fail because those variables would be undefined. So now I will define default parameters for the task . These will be injected into variables when the task starts. You can do this on the Parameters tab in the task editor:

test1-parameters.png

Now when the task runs, these values will be injected into variables that can be accessed in task steps. Try running the task . If you examine the event log, you will find events as the variables are set at the beginning of the task and as the variables are resolved when steps reference them.

Build the data table

In order to drive multiple task runs with multiple sets of data, MuseIDE needs a data table. These can be created in any spreadsheet program that can output a standard CSV file (comma-separated values). For example:

test1-data-spreadsheet.png

Note that the first row contains column names while the remaining rows contain data. The column names I used match the parameter names expected by the task.

Put the CSV file into the project folder and then restart MuseIDE so that it will recognize the new project resource. The first row of the CSV file is used as column names. The remaining rows are considered data to be used in tasks. As rows are used by a parameterized task suite, a set of variables is created from each row. The name of the variable is the column name; the value is the value of that column from the current row.

test1-datatable-resource.png

Create a parameterized task suite

The last step is to create a parameterized task suite. This combines a task with a data table - running the task once with each row of data in the table. Variables injected from a parameterized test suite override the default values for those variables that are configured in the task.

Here I created a parameterized task suite named test1-suite and configured it to run task test1 with values from the searches data table.

test1-paramsuite.png

MuseIDE cannot currently execute a parameterized suite — you must use the Muse command-line tools to run the task (shown below) or run them in your CI server.

muse run test1-suite

Return to Tutorials page