Search code examples
scalagatling

Gatling - how to achieve feeders to pick a new value in loop


In Gatling, I am using feeders to pass the values of the coordinates in a request, below is the code. I want on each repeat a new value from the feeder to be picked up. I am get the following error -- /mapping/v2/: Failed to build request: No attribute named 'map 30 (100.0%) x' is defined

Could someone please advice how this can be achieved. thanks.

    val mapfeeder   = csv(fileName = "data/cordinates.csv").circular


object PDP {
    val pdp = group("ABC_01_DetailsPage") {
            exec(http("PropertyDetailsPage")
                .get("/abc/property/detail.html?propertyId=12345&index=0&q=${address_json6}&qt=address&_qt=address&offset=1&sort=address&limit=20&view=property&mode=&radius=1.0Km&landuse=All")
                .check(substring("Change in Median Price")))
            }

    .pause(duration = 1)
    
    .feed(mapfeeder) //this works but only take the fist value and repeats it 30 times
    
    .group("ABC_02_DetailsPage_MAP") {
              repeat(30) {
                feed(mapfeeder) // this one fails with the error mentioned in the post
                exec(http("/mapping")
             .get(uri22 + "?mapTypeId=1006&x=${mapx}&y=${mapy}&z=19&access_token=${maptoken}"))
        }
        
val scn = scenario("RecordedSimulation")
            .feed(SearchFeeder)
            .exec(Homepage.homepage, Login.login, SearchLink.search, SearchEntry.searchentry, PDP.pdp, Logout.logout)

setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)

Solution

  • You're missing a dot to attach your feed and the following exec, so only the result of the last instruction (the exec) is passed to the repeat method.

    It should be:

    repeat(30) {
      feed(mapfeeder)
      .exec(
        http("/mapping") // <== HERE, DOT WAS MISSING
          .get(uri22 + "?mapTypeId=1006&x=${mapx}&y=${mapy}&z=19&access_token=${maptoken}")
      )
    }