How to print response on console????

Hi,

I am new to gatling…How to print response for each request on console…And how can I take some value from response and store into variable…And In other request I want to use that variable…I tried with saveAs method…but it doesn’t work for me…and I am unable to print the value on console…How to do this???can any one please explain with perfect example code…

Thanks

Here is the pattern I typically follow, though I have made some DSL of my own to make it more compact:

`
exec(
http( “Some Restful Service” )
.get( pathToService )
.check( jsonPath( “$” ).saveAs( “RESPONSE_DATA” ) )
)
.exec( session => {
println( “Some Restful Service:” )
println( session( “RESPONSE_DATA” ).as[String] )
session
})

`

If you are doing something other than a JSON web service, you might alter the .check call to be something more like:

`
.check( bodyString.saveAs( “RESPONSE_DATA” ) )

`

If you are just starting out, there is a lot to learn about Gatling. There is no way around it, you are going to have to learn the core principles. Start by reading the documentation: http://gatling.io/docs/2.0.2/

Awesome , this saved my time.

I have on one question ,

After extracting from json , How will I add it it to map, I have tried the following code,

var res:Map[String,String] = Map()
val res_all = res + (“key1” → ${extracted})
print (“Map res_al:” + res_all)

This says ${extracted} not found

Assuming that you wand to see the response for ALL of your requests you can also change the logger configuration

mvn -Dlogback.configurationFile=conf/logback-debug.xml -Dgatling.simulationClass=XXX gatling:test

whereas my “logback-debug.xml” looks like this

<?xml version="1.0" encoding="UTF-8"?> %d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx true