Summary| Tags| Feature: feature/REST_GET.feature| GET Samples
Scenario: [1:7] Simple GET
ms: 911
>>
Background:
4
* url 'https://reqres.in/api'
66
5
* header Accept = 'application/json'
1
8
Given url 'https://reqres.in/api/users?page=2'
0
9
When method GET
827
23:37:49.884 request: 1 > GET https://reqres.in/api/users?page=2 1 > Accept: application/json 1 > Host: reqres.in 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_382) 1 > Accept-Encoding: gzip,deflate 23:37:50.299 response time in milliseconds: 406 1 < 200 1 < Date: Fri, 11 Aug 2023 23:37:50 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Powered-By: Express 1 < Access-Control-Allow-Origin: * 1 < Etag: W/"406-ut0vzoCuidvyMf8arZpMpJ6ZRDw" 1 < Via: 1.1 vegur 1 < Cache-Control: max-age=14400 1 < CF-Cache-Status: HIT 1 < Age: 4636 1 < Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=sWRjepttk73f91aQCRms38xEVzC%2FHUxSyDPhT4EMVt4IL3pvcGb69NVvekyVqbpHAf%2Fzuod8gVZRiZYp81zOpGqGs7NPe3EM%2FvaOgoJvqOmPjEhSP0TjrP%2FL5A%3D%3D"}],"group":"cf-nel","max_age":604800} 1 < NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800} 1 < Vary: Accept-Encoding 1 < Server: cloudflare 1 < CF-RAY: 7f544f091fa90813-IAD {"page":2,"per_page":6,"total":12,"total_pages":2,"data":[{"id":7,"email":"michael.lawson@reqres.in","first_name":"Michael","last_name":"Lawson","avatar":"https://reqres.in/img/faces/7-image.jpg"},{"id":8,"email":"lindsay.ferguson@reqres.in","first_name":"Lindsay","last_name":"Ferguson","avatar":"https://reqres.in/img/faces/8-image.jpg"},{"id":9,"email":"tobias.funke@reqres.in","first_name":"Tobias","last_name":"Funke","avatar":"https://reqres.in/img/faces/9-image.jpg"},{"id":10,"email":"byron.fields@reqres.in","first_name":"Byron","last_name":"Fields","avatar":"https://reqres.in/img/faces/10-image.jpg"},{"id":11,"email":"george.edwards@reqres.in","first_name":"George","last_name":"Edwards","avatar":"https://reqres.in/img/faces/11-image.jpg"},{"id":12,"email":"rachel.howell@reqres.in","first_name":"Rachel","last_name":"Howell","avatar":"https://reqres.in/img/faces/12-image.jpg"}],"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}}
10
Then status 200
0
11
And print response
16
23:37:50.335 [print] { "page": 2, "per_page": 6, "total": 12, "total_pages": 2, "data": [ { "id": 7, "email": "michael.lawson@reqres.in", "first_name": "Michael", "last_name": "Lawson", "avatar": "https://reqres.in/img/faces/7-image.jpg" }, { "id": 8, "email": "lindsay.ferguson@reqres.in", "first_name": "Lindsay", "last_name": "Ferguson", "avatar": "https://reqres.in/img/faces/8-image.jpg" }, { "id": 9, "email": "tobias.funke@reqres.in", "first_name": "Tobias", "last_name": "Funke", "avatar": "https://reqres.in/img/faces/9-image.jpg" }, { "id": 10, "email": "byron.fields@reqres.in", "first_name": "Byron", "last_name": "Fields", "avatar": "https://reqres.in/img/faces/10-image.jpg" }, { "id": 11, "email": "george.edwards@reqres.in", "first_name": "George", "last_name": "Edwards", "avatar": "https://reqres.in/img/faces/11-image.jpg" }, { "id": 12, "email": "rachel.howell@reqres.in", "first_name": "Rachel", "last_name": "Howell", "avatar": "https://reqres.in/img/faces/12-image.jpg" } ], "support": { "url": "https://reqres.in/#support-heading", "text": "To keep ReqRes free, contributions towards server costs are appreciated!" } }
Scenario: [2:13] Simple GET with background
ms: 878
>>
Background:
4
* url 'https://reqres.in/api'
67
5
* header Accept = 'application/json'
0
14
Given path '/users'
0
15
And param page = 2
26
16
When method GET
785
23:37:49.872 request: 1 > GET https://reqres.in/api/users?page=2 1 > Accept: application/json 1 > Host: reqres.in 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_382) 1 > Accept-Encoding: gzip,deflate 23:37:50.303 response time in milliseconds: 431 1 < 200 1 < Date: Fri, 11 Aug 2023 23:37:50 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Powered-By: Express 1 < Access-Control-Allow-Origin: * 1 < Etag: W/"406-ut0vzoCuidvyMf8arZpMpJ6ZRDw" 1 < Via: 1.1 vegur 1 < Cache-Control: max-age=14400 1 < CF-Cache-Status: HIT 1 < Age: 5732 1 < Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=NuS%2BRQvHCg1wuIu3vwCiAFr49n0kVmLnl0gNiGrVKDScdpK8%2B51pMKyF2nBle%2BKdHXOf8FvaSjSqQyShxiJaAwwbfwwo4i7msGSpvJr%2FMlY2JEsgCm7%2FN7bQhw%3D%3D"}],"group":"cf-nel","max_age":604800} 1 < NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800} 1 < Vary: Accept-Encoding 1 < Server: cloudflare 1 < CF-RAY: 7f544f093a5157ee-IAD {"page":2,"per_page":6,"total":12,"total_pages":2,"data":[{"id":7,"email":"michael.lawson@reqres.in","first_name":"Michael","last_name":"Lawson","avatar":"https://reqres.in/img/faces/7-image.jpg"},{"id":8,"email":"lindsay.ferguson@reqres.in","first_name":"Lindsay","last_name":"Ferguson","avatar":"https://reqres.in/img/faces/8-image.jpg"},{"id":9,"email":"tobias.funke@reqres.in","first_name":"Tobias","last_name":"Funke","avatar":"https://reqres.in/img/faces/9-image.jpg"},{"id":10,"email":"byron.fields@reqres.in","first_name":"Byron","last_name":"Fields","avatar":"https://reqres.in/img/faces/10-image.jpg"},{"id":11,"email":"george.edwards@reqres.in","first_name":"George","last_name":"Edwards","avatar":"https://reqres.in/img/faces/11-image.jpg"},{"id":12,"email":"rachel.howell@reqres.in","first_name":"Rachel","last_name":"Howell","avatar":"https://reqres.in/img/faces/12-image.jpg"}],"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}}
17
Then status 200
0
Scenario: [3:19] Simple GET with background and validate response
ms: 939
>>
Background:
4
* url 'https://reqres.in/api'
66
5
* header Accept = 'application/json'
0
20
Given path '/users/2'
0
21
When method GET
800
23:37:49.887 request: 1 > GET https://reqres.in/api/users/2 1 > Accept: application/json 1 > Host: reqres.in 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_382) 1 > Accept-Encoding: gzip,deflate 23:37:50.301 response time in milliseconds: 411 1 < 200 1 < Date: Fri, 11 Aug 2023 23:37:50 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Powered-By: Express 1 < Access-Control-Allow-Origin: * 1 < Etag: W/"118-pbdwwFo9SKNhD3Lx5iHJyngpq00" 1 < Via: 1.1 vegur 1 < Cache-Control: max-age=14400 1 < CF-Cache-Status: HIT 1 < Age: 4432 1 < Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=oDMlVy5jJgLS9%2FmWhploIe0A1doM2ykFNkKSCRQiqsd1eIJX%2BlchdKMP6xZPNKRune0t8o%2BhKoF3NV3vT8hqB1tQpmfnnjP4p6%2F3vZRO8JPKDnIBg2ovxNy07A%3D%3D"}],"group":"cf-nel","max_age":604800} 1 < NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800} 1 < Vary: Accept-Encoding 1 < Server: cloudflare 1 < CF-RAY: 7f544f090f3a0766-IAD {"data":{"id":2,"email":"janet.weaver@reqres.in","first_name":"Janet","last_name":"Weaver","avatar":"https://reqres.in/img/faces/2-image.jpg"},"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}}
22
Then status 200
0
23
* def id = response.data.id
26
24
And print 'id is ' + id
15
23:37:50.342 [print] id is 2
25
And match response.data.id == 3
31
23:37:50.374 classpath:feature/REST_GET.feature:25 And match response.data.id == 3 match failed: EQUALS $ | not equal (NUMBER:NUMBER) 2 3 classpath:feature/REST_GET.feature:25