Summary| Tags| Feature: features/users.feature| Sample API test with Karate
Scenario: [1:7] Get user details by ID
ms: 557
>>
Background:
5
* url 'https://jsonplaceholder.typicode.com'
32
8
Given path 'users', 1
412
9
When method GET
111
10:50:14.109 request: 1 > GET https://jsonplaceholder.typicode.com/users/1 1 > Host: jsonplaceholder.typicode.com 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/21.0.8) 1 > Accept-Encoding: gzip,deflate 10:50:14.213 response time in milliseconds: 101 1 < 200 1 < Date: Sun, 26 Oct 2025 17:50:14 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < Cache-Control: max-age=43200 1 < etag: W/"1fd-+2Y3G3w049iSZtw5t1mzSnunngE" 1 < expires: -1 1 < nel: {"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1} 1 < pragma: no-cache 1 < report-to: {"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=Xv%2FlxKH%2BYnK5E285wJILxtCUDiypNYTf4kJD6wUEOZI%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1760120265"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=Xv%2FlxKH%2BYnK5E285wJILxtCUDiypNYTf4kJD6wUEOZI%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1760120265" 1 < Server: cloudflare 1 < vary: Origin, Accept-Encoding 1 < via: 2.0 heroku-router 1 < x-content-type-options: nosniff 1 < x-powered-by: Express 1 < x-ratelimit-limit: 1000 1 < x-ratelimit-remaining: 999 1 < x-ratelimit-reset: 1760120301 1 < Age: 10850 1 < cf-cache-status: HIT 1 < Server-Timing: cfCacheStatus;desc="HIT" 1 < Server-Timing: cfEdge;dur=10,cfOrigin;dur=0 1 < CF-RAY: 994bcb7a5e9d22a2-SJC 1 < alt-svc: h3=":443"; ma=86400 { "id": 1, "name": "Leanne Graham", "username": "Bret", "email": "Sincere@april.biz", "address": { "street": "Kulas Light", "suite": "Apt. 556", "city": "Gwenborough", "zipcode": "92998-3874", "geo": { "lat": "-37.3159", "lng": "81.1496" } }, "phone": "1-770-736-8031 x56442", "website": "hildegard.org", "company": { "name": "Romaguera-Crona", "catchPhrase": "Multi-layered client-server neural-net", "bs": "harness real-time e-markets" } }
10
Then status 200
0
11
And match response.id == 1
3
Scenario: [2:13] Invalid user should return 404
ms: 771
>>
Background:
5
* url 'https://jsonplaceholder.typicode.com'
1
14
Given path 'users', 9999
416
15
When method GET
352
10:50:14.114 request: 1 > GET https://jsonplaceholder.typicode.com/users/9999 1 > Host: jsonplaceholder.typicode.com 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/21.0.8) 1 > Accept-Encoding: gzip,deflate 10:50:14.457 response time in milliseconds: 339 1 < 404 1 < Date: Sun, 26 Oct 2025 17:50:14 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < Cache-Control: max-age=43200 1 < etag: W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8" 1 < expires: -1 1 < nel: {"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1} 1 < pragma: no-cache 1 < report-to: {"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=kY1C5O22P3eL1MRMYze1V8wxJYBXFoVZG0K4OExcVWM%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501014"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=kY1C5O22P3eL1MRMYze1V8wxJYBXFoVZG0K4OExcVWM%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501014" 1 < Server: cloudflare 1 < vary: Origin, Accept-Encoding 1 < via: 2.0 heroku-router 1 < x-content-type-options: nosniff 1 < x-powered-by: Express 1 < x-ratelimit-limit: 1000 1 < x-ratelimit-remaining: 985 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: MISS 1 < Server-Timing: cfCacheStatus;desc="MISS" 1 < Server-Timing: cfEdge;dur=25,cfOrigin;dur=215 1 < CF-RAY: 994bcb7a7d2a1746-SJC 1 < alt-svc: h3=":443"; ma=86400 {}
16
Then status 404
0