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.
The simplest way to read any comma separated
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.
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.
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.
An example CSVUtils can be found at mkyong.com sample