Mis3
4 years agoFrequent Contributor
Groovy Script to read a CSV
My Groovy script has a loop to read an CSV file and to execute the testcases one by one. It is working but I like to improve its efficiency. If the CSV has blank lines, the testcase would still exe...
- 4 years agoOk.
Instead of data[0].charAt[0], try using
if (rowdata.startsWith('3')) {
// do all the processing here
} - 4 years ago
Thanks, nmrao.
I used your code but modified it a bit. I also added a continue statement so to ignore the rest of the code like testcase, etc.
if ( !rowdata.startsWith('302') )
{
log.info " Seq="+i+ " " + data[0]+" Invalid line"
report << "\n"+ sdf.format(log_date)+" Seq="+i+ " " + data[0] +" Invalid line"
continue
}