0

I am using Gatling ver. 2.1.7. I want to iterate IDs which I got from sql query. Below SQL statement will fetch 100 IDs, I want to iterate those 100 IDs. How do I do that?

here is the code,

    val dbStatement = System.getProperty("dbStatement", """SELECT ID_ aID FROM MYTable WHERE ID_ IN(some query) LIMIT 100""")
    val dbQuery = jdbcFeeder("jdbc:mysql://" + dbUrl +":3306/test", dbUsername, dbPassword, dbStatement)

    val scn = scenario("Get Total assets")
        .feed(dbQuery)
        .exec(http("Fetching tests using IDs")
        .get("""/api/assets/${aID}/test""")
        )
sathya
  • 1,982
  • 1
  • 20
  • 37
Peter
  • 855
  • 2
  • 15
  • 35

1 Answers1

1

I am assuming that dbquery is a stack similarly udpate the below to use the collection you have and get it worked through :-

asLongAs(session => dbQuery.length > 0) {
  exec { session =>
    var val= dbQuery.pop();
    var length = jobsQue.length
       }
 }  
user666
  • 1,104
  • 12
  • 20