I have a question in regards in wanting to know how to select a random row within a CSV using Groovy.
Currently I have two groovy scripts (well actually three but the third one is not important for this question). One groovy script is called 'ReadData' where it reads the csv file and sets it to row one, and then there is another step called 'SetProperties' where like it states sets the property value to what ever the value is obtained form the CSV.
Now the scripts below works in finding the second row in the CSV file under the first column of the spreadsheet and setting it as a property value. My question is instead of selecting the second row, how can I select a random row from the spreadsheet (we don't select from the first row ever of the spreadsheet as that's our headers).
i did try replacing within SetProperties:
testRunner.testCase.setPropertyValue( "id", singleLineArray[0]))
with
testRunner.testCase.setPropertyValue('departureAirportId', String.valueOf((int)Math.random()*singleLineArray[0]))
but no luck as it errored.