Data-Driven Testing in RVL

Let's start from RVL mode first. With RVL you can delegate low-level complex automation tasks to a developer team and focus on testing scenarios and data used to fill forms and tables.

Embedded Data

First, define data schema. In the Flow column of RVL spreadsheet choose Map.

Then hit TAB on the keyboard and Rapise will generate a template for the data table.

Give this new map a name and define columns and initial set of rows with values.

In our example the map has name Data and it has three columns: FirstName, LastName and Company. It also has two rows with data values.

Now in our test we can just use the map and refer to it's columns by name.

Data becomes one of parameter types.

And when Data is selected as a parameter type then column names are available in the drop down.

Now our RVL looks like this.

Execution of the test produces the report. The test simply prints first line of the data table.

The data table we just created is an object in Rapise object repository and it has actions. With actions one can manipulate active row and column index and read arbitrary data from the table.

For the detailed description of actions one can do upon data tables refer to Rapise Help File.

Let's advance to next row in our table before printing values.

After execution the report displays data from the second row.

External Data

Now we are ready to put data into external spreadsheet. Let's create one. In the Files view right click Scripts folder and choose Create > Spreadsheet...

We'll go with default options.

Rapise has built-in spreadsheet editor and you do not need Excel to be installed on the machine.

Let's bind to this spreadsheet in RVL. Insert a line below Data map we created in previous section. In the Flow column choose Map and then set map type to Range.

Give the map same name Data and make sure that it references Data.xlsx which we just created.

Running the test. Now data is taken from the Data.xlsx. Notice that in Data.xlsx we named columns same way as in the previous section.

If we'll do a loop with Data map Rapise will iterate through all lines on execution.

The test we created for this chapter is attached to the article. So you can download it and run.


Data-Driven Testing in JavaScript

One can read data from a spreadsheet in JavaScript mode as well.  There is a global Spreadsheet object that is available in every test. Here is an example of Spreadhseet API usage.

Spreadsheet.DoAttach('Calc.xls', 'Calc Data');
    Tester.Assert( '' + Spreadsheet.GetCell("Item1") + 
                   Spreadsheet.GetCell("Operation") + 
                   Spreadsheet.GetCell("Item2") + '=' + Spreadsheet.GetCell("Result"),  CheckResult(Spreadsheet.GetCell("Result")));

Description of all Spreadsheet actions and properties is available in the Rapise Help File.

Open UsingSpreadsheet sample test to see a working example.

Below find references to other data-driven and spreadsheet related articles and a demo video.