How to extract response data in Gatling

I'm new with gatling and I have problem that I can't resolve by myself. I have to send request and after that I have to catch data from response. I can send request using get method, but I don't have idea how to extract data from response. Do you have any ideas how to do this? Thanks for your help.

1 answer

  • answered 2017-11-13 17:35 user666

    I did this using check clause

              http("Poll")
                    .get(Configuration.URL )
                    .queryParam("applicationId", Configuration.APPLICATION_ID)
                    .check(status.is(200))
                    .check(status.saveAs("statusCode"))                     
                    .check(xpath("//myRunTimeInfo").saveAs("runtimeInfoStatus"))                    
                    .check(xpath("//status").saveAs("responseStatus")))
                  .pause(Configuration.THINK_TIME second)
    

    xpath : will do a search in your response using xpath specifications