Apollo Datapool Guide

The RFT Data Pool

The RFT data pool mechanism was designed to deliver data to RFT scripts as they iterated over a set of test data. The mechanism was typically loaded from a CSV file, which then translated it into the proprietary IBM format.

Inside the script's main loop either dpString() or getCell() were used to bring values from the dataset row into the test. The data pooling mechanism in RFT is a complex set of classes and methods that implements pools and their iterators. Selenium does not provide any direct equivalent datapool functionality.

It is therefore necessary to use one of two options to achieve data pool eqivalency. One option is to revert existing data pools functions back to direct CSV access. Another option is to use a product that provides that functionality, like TAFPro Data Management.

This is the method required to migrate from data pools back to CSV files.

Using java file io

The simplest way to read any comma separated file in java is to read the file line by line. Then, with each line, split the comma separated text into a simple String array. Process the iteration of the test using the values in the array. The loop stops when there are no more lines to read.

BufferedReader csvReader = new BufferedReader(new FileReader(pathToCsv));
while ((row = csvReader.readLine()) != null) {
    String[] data = row.split(",");
    // do something with the data
}
csvReader.close();

Whilst there are numerous more complicated methods for reading a CSV file, this method suites the majority of scenarios.

CSV Files

Simple CSV files with text based values and unambiguous comma separation is very common. Where data, such an address, may include it's own use of the comma character, the value is surrounded with double quotes.

Other libraries

There are open source libraries that can also be downloaded such as OpenCSV. These provide a ready made set of functionality for handling more complex file structures.

A sample CSVUtils

An example CSVUtils can be found at mkyong.com sample