Scenario: [4:45]Create a New Person
ms: 453
>>
Background:
1
Given url 'http://localhost:8081/'
2
14:28:36.199 karate.env system property was:
2
Given path 'persons'
2
3
And request
2
{
"firstName": "abc",
"lastName": "Singh",
"age" : 23,
"address": "G-1",
"phoneNumbers": "9823232323"
}
4
When method POST
429
14:28:36.617 request:
1 > POST http://localhost:8081/persons
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Content-Length: 91
1 > Content-Type: application/json; charset=UTF-8
1 > Host: localhost:8081
1 > User-Agent: Apache-HttpClient/4.5.12 (Java/1.8.0_271)
{"firstName":"abc","lastName":"Singh","age":23,"address":"G-1","phoneNumbers":"9823232323"}
14:28:36.689 response time in milliseconds: 69.89
1 < 201
1 < Access-Control-Allow-Credentials: true
1 < Access-Control-Expose-Headers: Location
1 < Cache-Control: no-cache
1 < Connection: keep-alive
1 < Content-Length: 124
1 < Content-Type: application/json; charset=utf-8
1 < Date: Fri, 18 Dec 2020 08:58:36 GMT
1 < ETag: W/"7c-d/s47nyL2kh8olhBTyL5bpAjkgw"
1 < Expires: -1
1 < Keep-Alive: timeout=5
1 < Location: http://localhost:8081/persons/15
1 < Pragma: no-cache
1 < Vary: Origin, X-HTTP-Method-Override, Accept-Encoding
1 < X-Content-Type-Options: nosniff
1 < X-Powered-By: Express
{
"firstName": "abc",
"lastName": "Singh",
"age": 23,
"address": "G-1",
"phoneNumbers": "9823232323",
"id": 15
}
5
Then status 201
0
6
* def personId = response.id
5
7
Given path 'persons/'+personId
3
8
When method get
10
14:28:36.700 request:
2 > GET http://localhost:8081/persons/15
2 > Accept-Encoding: gzip,deflate
2 > Connection: Keep-Alive
2 > Host: localhost:8081
2 > User-Agent: Apache-HttpClient/4.5.12 (Java/1.8.0_271)
14:28:36.708 response time in milliseconds: 7.78
2 < 200
2 < Access-Control-Allow-Credentials: true
2 < Cache-Control: no-cache
2 < Connection: keep-alive
2 < Content-Length: 124
2 < Content-Type: application/json; charset=utf-8
2 < Date: Fri, 18 Dec 2020 08:58:36 GMT
2 < ETag: W/"7c-d/s47nyL2kh8olhBTyL5bpAjkgw"
2 < Expires: -1
2 < Keep-Alive: timeout=5
2 < Pragma: no-cache
2 < Vary: Origin, Accept-Encoding
2 < X-Content-Type-Options: nosniff
2 < X-Powered-By: Express
{
"firstName": "abc",
"lastName": "Singh",
"age": 23,
"address": "G-1",
"phoneNumbers": "9823232323",
"id": 15
}
9
Then status 200
0