Question: How does responses works?
i have workflow: several queries one by one. Once i got responce from 1st query, i want fire next one. So i try to play with "response" section and with no success (
so my 1st request:
{
"command":"auth",
"udid":"${udid}"
}
and i got response:
{"response":"auth","data":{"player":{"__v":0,"nick":"Player_58423","_id":"52f4a76a7f83343908e93a30","invites_sent":[],"invites_recived":[],"blackList":[],"friends":[],"games":[],"play_units":10,"rating":1000,"date_created":"2014-02-07T09:29:14.577Z","lang":"ru","udid":["pseudo_udid_489405"]},"is_new":true}}
- How does pattern looks? so i expect, the pattern i looking for is "auth" - should works great, right?
- how response section (i read the documentation, but still dont get it) what i should to do - place this pattern to 1st sampler, or 2nd, or maybe both?
- now i waiting trigger from server, which came after random time, like this
{"response":"opponentFound",
"_id":"XXXX"}
and i going to answer him "ok, i take this opponent" how? Should i create 3th sampler with big response-timeout and place "opponentFound" in response-section, and then create 4th sampler with answer-request, right?
You are right your approach should work
- Response pattern is a regular expression but in you case you could just use this:
"response":"auth"
- This is sequantial workflow so the same sampler which sends a authenticationrequest should capture a auth response
- Take opponent would be a second sampler; you can set a long response timeout and let the sampler wait for a server response. The response pattern could look like this
"response":"opponentFound"
...and 3rd sampler will respond to opponentFound.
And thanks for sharing your problems, I will keep this in mind when developing the plugin further.
Great, thank you for your (quite fast!) answer!
Response doesnt work for me ( 1st sampler: http://take.ms/JCROS answer - http://take.ms/1K3Lb finding works fine, but sampler wait whole response time before fire next sampler, does not fire immediately on response as i expect.
Have a look at the View Results Tree -> Sampler Result there should be a detaild breakdown of all actions and how long did it take for the response to arrive.
response from the server come immediately, but sampler took all 5sec (or more, depends on response-timeout-section) looks like it doesn't recognise the pattern.
Now i have one more strange behavior! If i have some samplers, and set in 1st response-pattern this:
"response"
and leave other blank (!), all samplers fired immediately as recived a response from server.
Whats going on?)
same behaviour when i leave first sampler blank
Could be something to do with regular expression processing. Maybe escaping special characters with \ would help