HsacAcceptanceTests.SlimTests.HttpTest.PollingTests.JsonByPathTest


We retry a call until a json path expression on the response is a certain value.

Setup server


script mock xml server setup
add response {body:"0 response"} with status 200
add response {body:"1 response"} with status 201
add response {body:"2 response"} with status 200
add response {body:"3 response"} with status 203
add response {body:"4 response"} with status 202
add response {body:"5 response"} with status 201
add response {body:"6 response"} with status 299
add response {body:"7 response"} with status 300
add response {body:8} with status 200
add response {body:"9 response"} with status 300
add response {body:"10 response"} with status 300
$url<-[http://127.0.0.1:8000/FitNesseMock] get mock server url


script json http test
set repeat interval to 50 milliseconds
repeat at most 2 times
post 0 request to $url->[http://127.0.0.1:8000/FitNesseMock]
repeat until json path body is 0 response
check response status 200
check json path body 0 response
check repeat count 0
post 1 request to $url->[http://127.0.0.1:8000/FitNesseMock]
repeat until json path body is 2 response
check response status 200
check json path body 2 response
check repeat count 1
get from $url->[http://127.0.0.1:8000/FitNesseMock]
repeat until json path body is 5 response
check response status 201
check json path body 5 response
check repeat count 2
put 6 request to $url->[http://127.0.0.1:8000/FitNesseMock]
check response status 299
repeat until json path body is 8
check response status 200
check json path body 8
check repeat count 2
repeat at most 1 times
delete $url->[http://127.0.0.1:8000/FitNesseMock]
reject repeat until json path body is does not happen
check response status 300
check json path body 10 response
check repeat count 1
check time spent repeating 51>= 50







Stop Server

table: Mock Server Message Report
Expected and received 11 requests
1

request

0 request

response

{body:"0 response"}
2

request

1 request

response

{body:"1 response"}
3

request

1 request

response

{body:"2 response"}
4

request

GET: /FitNesseMock

response

{body:"3 response"}
5

request

GET: /FitNesseMock

response

{body:"4 response"}
6

request

GET: /FitNesseMock

response

{body:"5 response"}
7

request

6 request

response

{body:"6 response"}
8

request

6 request

response

{body:"7 response"}
9

request

6 request

response

{body:8}
10

request

DELETE: /FitNesseMock

response

{body:"9 response"}
11

request

DELETE: /FitNesseMock

response

{body:"10 response"}

script mock xml server setup
stop