How to read the last line in CSV line in GATLING

Viewed 163

I use feeders from a csv file, and i want to read always the last line in this file:

val actors= csv("./src/test/resources/Data/ksp-acteurs.csv").circular


      .feed(actors)
  .exec(http("K_actors")
    .get("https://URL/ksp-acteurs/${Col1}")    //need to extract the last value in this column    
    .header("Authorization","Bearer ${jwtoken}")
    .check(status is 200))
1 Answers

You could just do something like this:

val feeder = csv("./src/test/resources/Data/ksp-acteurs.csv")
val lastLine = feeder.readRecords.last.values

but the important thing is that you call readRecords before you call circular, because in this case readRecord will not be able to find last line and test will fail with out-of-memory exception.

Related