Scenario: [1:5]
Find purchase order by ID
ms: 360
6
* def order = call read('classpath:features/store/CreateOrder.feature@createOrder')
187
>>
features.store.CreateOrder
175
6
Given url baseURL
0
02:31:07.706 karate.env system property was: cert
02:31:07.707 Base URL system property was: https://petstore.swagger.io/v2
7
And path '/store/order'
0
8
And request
0
{
"petId": 1,
"quantity": 1,
"shipDate": "2025-06-28T10:00:00.000+0000",
"status": "placed",
"complete": true
}
18
When method post
169
02:31:07.720 request:
1 > POST https://petstore.swagger.io/v2/store/order
1 > Content-Type: application/json; charset=UTF-8
1 > Content-Length: 100
1 > Host: petstore.swagger.io
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/17.0.17)
1 > Accept-Encoding: gzip,deflate
{"petId":1,"quantity":1,"shipDate":"2025-06-28T10:00:00.000+0000","status":"placed","complete":true}
02:31:07.887 response time in milliseconds: 166
1 < 200
1 < Date: Sun, 14 Dec 2025 02:31:07 GMT
1 < Content-Type: application/json
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < Access-Control-Allow-Origin: *
1 < Access-Control-Allow-Methods: GET, POST, DELETE, PUT
1 < Access-Control-Allow-Headers: Content-Type, api_key, Authorization
1 < Server: Jetty(9.2.9.v20150224)
{"id":8571504317507441385,"petId":1,"quantity":1,"shipDate":"2025-06-28T10:00:00.000+0000","status":"placed","complete":true}
19
Then status 200
0
20
* print response
1
02:31:07.888 [print] {
"id": 8571504317507441385,
"petId": 1,
"quantity": 1,
"shipDate": "2025-06-28T10:00:00.000+0000",
"status": "placed",
"complete": true
}
21
* match response.petId == '#number? _ == 1'
1
22
* assert response.petId == Math.floor(response.petId)
0
23
* match response.quantity == '#number? _ == 1'
1
24
* match response.status == '#string? _ == "placed"'
1
25
And def orderId = response.id
0
7
* def orderId = order.orderId
1
8
* match orderId == '#number'
1
9
* print orderId
1
02:31:07.896 [print] 8571504317507441385
10
Given url baseURL
0
11
And path '/store/order/'+orderId
1
12
When method get
169
02:31:07.899 request:
1 > GET https://petstore.swagger.io/v2/store/order/8571504317507441385
1 > Host: petstore.swagger.io
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/17.0.17)
1 > Accept-Encoding: gzip,deflate
02:31:08.065 response time in milliseconds: 166
1 < 200
1 < Date: Sun, 14 Dec 2025 02:31:08 GMT
1 < Content-Type: application/json
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < Access-Control-Allow-Origin: *
1 < Access-Control-Allow-Methods: GET, POST, DELETE, PUT
1 < Access-Control-Allow-Headers: Content-Type, api_key, Authorization
1 < Server: Jetty(9.2.9.v20150224)
{"id":8571504317507441385,"petId":1,"quantity":1,"shipDate":"2025-06-28T10:00:00.000+0000","status":"placed","complete":true}
13
Then status 200
0
14
And print response
1
02:31:08.067 [print] {
"id": 8571504317507441385,
"petId": 1,
"quantity": 1,
"shipDate": "2025-06-28T10:00:00.000+0000",
"status": "placed",
"complete": true
}
15
And match response.id == orderId
0