CSV files

In many cases, data is stored in the CSV file format. CSV files have been used in automated testing for storing test data, environment data, mappings, and so on. The format is simple, and the data can be read using simple Java methods as outlined here:

/**
* extractData_CSV - method to extract CSV file data for use in testing
*
* @param csvFile - the CSV file to read
* @param rowID - The rowID to parse
* @return List<String>
* @throws Exception
*/
public static List<String> extractData_CSV(String csvFile,
String rowID)
throws Exception {

List<String> rows = new ArrayList<String>();

BufferedReader reader = new BufferedReader(new FileReader(csvFile));
String line = "";

while
( (line = reader.readLine()) != null ) {
if ( line.startsWith(rowID)) {
rows.add(line);
}
}

reader.close();
return rows
;
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.38.3