Summary| Tags| Feature: feature/REST_GET.feature| GET Samples
Scenario: [1:7] Simple GET
ms: 1016
>>
Background:
4
* url 'https://reqres.in/api'
82
5
* header Accept = 'application/json'
6
8
Given url 'https://reqres.in/api/users?page=2'
1
9
When method GET
908
23:55:07.736 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:55:08.203 response time in milliseconds: 466 1 < 200 1 < Date: Fri, 11 Aug 2023 23:55:08 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: 2606 1 < Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=6I8cbO40S3UY68dgP7MpkGPLrFXk7TIo6Gc%2FLEOCXvkCpePYkQS3Y601czq5wyS38k9D3tJvAwFMwDVD84tdCL3nEaYEczQDdA%2BNL0H2ZeevJPV4mnCbsBHJjg%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: 7f54686029cf358d-DFW {"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
19
23:55:08.231 [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: 994
>>
Background:
4
* url 'https://reqres.in/api'
84
5
* header Accept = 'application/json'
0
14
Given path '/users'
0
15
And param page = 2
16
16
When method GET
893
23:55:07.739 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:55:08.199 response time in milliseconds: 460 1 < 200 1 < Date: Fri, 11 Aug 2023 23:55:08 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: 6717 1 < Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=yCsezTUUGWVT%2FPHPiJfhtC62Sc3OZ6gnnp%2Bru6O62iDOA6GfpD73aYkaDK87hnf6fWmI23U4F2Uk3M9FqGFu3MoqmiKBNKkZVuibuKE2fnWHBy40%2Brv0DVwwZA%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: 7f54686019b74689-DFW {"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: 1049
>>
Background:
4
* url 'https://reqres.in/api'
82
5
* header Accept = 'application/json'
1
20
Given path '/users/2'
0
21
When method GET
909
23:55:07.746 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:55:08.198 response time in milliseconds: 450 1 < 200 1 < Date: Fri, 11 Aug 2023 23:55:08 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: 144 1 < Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=YFV8S4k2tqRHU%2BK8PGKYBCx5qc38G4XG83KMrrIHuKjfyHd2xJqfDQT%2BwR3C64mYo0o2UGv%2BE%2BbTUpsbhZ7YCwkxgCCRtCTdquvX4dYUlK%2F2mHUHwjS6WU463w%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: 7f54686018d745e4-DFW {"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
1
24
And print 'id is ' + id
19
23:55:08.231 [print] id is 2
25
And match response.data.id == 3
35
23:55:08.279 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