Outbounde Exception the second time that I try to read an Excel with SoapUI
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Outbounde Exception the second time that I try to read an Excel with SoapUI
Hello everybody.
I'm trying to read the datas of an excel with the objects
wb = Workbook.getWorkbook(new File('C:/Users/Franciscog/Desktop/papageno1.xls'))
It works fine the first time that I use, but the second time, I get this message:
java.lang.ArrayIndexOutOfBound.Exception:0error at line: 12
I have to add new rows and columns to the excel in order to make it works again. Any idea of why is it?
Thanks a lot in advance
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is simple way to achieve the same differently.
Create a .csv file for valid values for odometer as shown below:
odometer.csv - contents of the file
odometer
Miles
Hours
Kilometres
Download xlson library and its dependency
For more details about xlson library, visit github
Here is the script which reads the above csv file and selects one of values randomly
import static com.xlson.groovycsv.CsvParser.parseCsv //Provide the file path of odometer csv def data = parseCsv(new File('/tmp/odometer.csv').text) def odometerUnits = data*.values.flatten() //Randomly selects def selectedValue = odometerUnits[new Random().nextInt(odometerUnits.size())] log.info "Current selection: $selectedValue"
Regards,
Rao.

- « Previous
-
- 1
- 2
- Next »
- « Previous
-
- 1
- 2
- Next »