Looping over CSV file data and driving tests with Groovy
Whether it is for loading test data or writing reports, using external data files can be a key part of automated testing. Typically, you might need to read test data from a file and loop over some test steps until there is no more data. In this recipe, we see how this can be achieved easily using several reusable Groovy TestSteps
.
Getting ready
For example, let's say we have a small CSV file of invoice data that we want to use to drive our tests:
1,comp1,100.0,2014-12-01 00:00:00 2,comp2,200.0,2014-12-02 00:00:00 3,comp3,300.0,2014-12-03 00:00:00
You can find this data in <chapter2 samples>/invoice.csv
.
We will read each line and extract the values into properties, for example, to do something ...
Get SoapUI Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.