i am new to gatling and my task is to test the REST services?
any suggetions greatly appreciated.
use can pass json string like below.
.body(StringBody(""" “”")).asJSON
Thank you for your response.
But by POSTing parameters(JSON string and two other) like that,it is not sending any request to REST
i got 415 error…
so please tell me how to POST parameters using POST
my parameters are
param1=user1
param2=1
param3=5
param4=[{“level”:“levelname1”,“number”:“two”},{“level”:“levelname2”,“number”:“three”}]
note: param4 is JSON string
by sending those parameters in POST, i want to test my REST…
in my case response also as JSON only…
Given:
.body(StringBody(""" {“offerId”: “123”, “membershipId”: “123”, “osName”: “iOS”, “osVersion”: “8.02”} “”")).asJSON
can I parameterize membershipId like this:
.body(StringBody(""" {“offerId”: “123”, “membershipId”: “${memberID}”, “osName”: “iOS”, “osVersion”: “8.02”} “”")).asJSON
given a .csv file with contents:
memberID
123
123
123
123
and given
val scn = scenario(“Scenario”)
.feed(csv(“membershipId.csv”).random)
.
.
.
Magnus
Again: yes, that’s exactly what StringBody is intended for…
You’d have to first store a “dateVar” attribute in the session, and then use the proper Gatling EL syntax in your template (${dateVar} instead of $dateVar).
Check the documentation.