Summary| Tags| Feature: features/PostRequest.feature| Testing POST API As a QA, I want to validate the API is meet the requirement
Scenario: [1:26] Tha API response should be HTTP 201 Created
ms: 6354
>>
Background:
8
* def defaultHeader =
65
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
3
23
And path "/posts"
2
27
Given headers defaultHeader
4
28
And request defaultPayload
182
29
When method POST
6098
10:50:12.685 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 58 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 {"userId":12,"title":"recommendation","body":"motorcycle"} 10:50:12.955 response time in milliseconds: 268 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:12 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 84 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"54-guyfh1GBRGEJVEsIwiIzWJqpZa0" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=4Y7MwUu%2Fjh6%2FkvH4W4u4tzAadp5%2Bn42eZqZG53ZzK%2Fo%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501012"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=4Y7MwUu%2Fjh6%2FkvH4W4u4tzAadp5%2Bn42eZqZG53ZzK%2Fo%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501012" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 997 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=4,cfOrigin;dur=69 1 < CF-RAY: 994bcb720b180fd4-LAX 1 < alt-svc: h3=":443"; ma=86400 { "userId": 12, "title": "recommendation", "body": "motorcycle", "id": 101 }
30
Then status 201
0
Scenario: [2:33] The API response body matches the JSON Schema
ms: 211
>>
Background:
8
* def defaultHeader =
4
{ "Content-Type": "application/json" }
14
* def defaultPayload =
2
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
1
23
And path "/posts"
2
34
* def expectedSchema = read("../helper/PostSchema.json")
202
10:50:06.846 classpath:features/PostRequest.feature:34 * def expectedSchema = read("../helper/PostSchema.json") js failed: >>>> 01: read("../helper/PostSchema.json") <<<< org.graalvm.polyglot.PolyglotException: java.io.FileNotFoundException: C:\Users\PANKAJ KUMAR SAO\poc\karate-api-test\build\resources\test\features\..\helper\PostSchema.json (The system cannot find the path specified) - com.intuit.karate.resource.FileResource.getStream(FileResource.java:98) - com.intuit.karate.core.ScenarioFileReader.readFileAsStream(ScenarioFileReader.java:99) - com.intuit.karate.core.ScenarioFileReader.readFileAsString(ScenarioFileReader.java:95) - com.intuit.karate.core.ScenarioFileReader.readFile(ScenarioFileReader.java:54) - com.intuit.karate.core.ScenarioEngine.lambda$new$0(ScenarioEngine.java:124) - <js>.:program(Unnamed:1) classpath:features/PostRequest.feature:34
35
Given headers defaultHeader
0
36
And request defaultPayload
0
37
When method POST
0
38
Then match response == expectedSchema
0
Scenario: [3.1:49] The userId value is accept positive Integer
ms: 6173
>>
Background:
8
* def defaultHeader =
1
{ "Content-Type": "application/json" }
14
* def defaultPayload =
2
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
0
23
And path "/posts"
1
42
Given headers defaultHeader
1
43
And request {"title":"recommendation","body":"motorcycle","userId":12}
10
44
When method POST
6154
10:50:12.677 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 58 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 {"title":"recommendation","body":"motorcycle","userId":12} 10:50:13.044 response time in milliseconds: 366 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:12 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 84 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"54-3s8W8w2GxPo0WXYdWfItyVF0+Ng" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=4Y7MwUu%2Fjh6%2FkvH4W4u4tzAadp5%2Bn42eZqZG53ZzK%2Fo%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501012"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=4Y7MwUu%2Fjh6%2FkvH4W4u4tzAadp5%2Bn42eZqZG53ZzK%2Fo%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501012" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=11,cfOrigin;dur=70 1 < CF-RAY: 994bcb71af016d29-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "recommendation", "body": "motorcycle", "userId": 12, "id": 101 }
45
Then match response.userId == "#number"
5
Scenario: [3.2:50] The userId value is accept negative Integer
ms: 5935
>>
Background:
8
* def defaultHeader =
1
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
1
23
And path "/posts"
9
42
Given headers defaultHeader
1
43
And request {"title":"recommendation","body":"motorcycle","userId":-12}
1
44
When method POST
5918
10:50:12.684 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 59 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 {"title":"recommendation","body":"motorcycle","userId":-12} 10:50:13.169 response time in milliseconds: 477 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:12 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 85 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"55-3NJFE9qzyrbuIKNESN7DIOtgrK8" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=4Y7MwUu%2Fjh6%2FkvH4W4u4tzAadp5%2Bn42eZqZG53ZzK%2Fo%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501012"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=4Y7MwUu%2Fjh6%2FkvH4W4u4tzAadp5%2Bn42eZqZG53ZzK%2Fo%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501012" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 998 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=4,cfOrigin;dur=70 1 < CF-RAY: 994bcb71d82c88f5-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "recommendation", "body": "motorcycle", "userId": -12, "id": 101 }
45
Then match response.userId == "#number"
3
Scenario: [3.3:51] The userId value is accept zero Integer
ms: 5576
>>
Background:
8
* def defaultHeader =
1
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
1
23
And path "/posts"
0
42
Given headers defaultHeader
1
43
And request {"title":"recommendation","body":"motorcycle","userId":0}
1
44
When method POST
5569
10:50:12.678 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 57 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 {"title":"recommendation","body":"motorcycle","userId":0} 10:50:12.954 response time in milliseconds: 274 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:12 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 83 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"53-DGBqLqe1PVM4UFDXmJ4453l+cUs" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=4Y7MwUu%2Fjh6%2FkvH4W4u4tzAadp5%2Bn42eZqZG53ZzK%2Fo%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501012"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=4Y7MwUu%2Fjh6%2FkvH4W4u4tzAadp5%2Bn42eZqZG53ZzK%2Fo%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501012" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 996 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=19,cfOrigin;dur=72 1 < CF-RAY: 994bcb71fde2ce58-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "recommendation", "body": "motorcycle", "userId": 0, "id": 101 }
45
Then match response.userId == "#number"
3
Scenario: [4.1:65] The API response body has a valid key value as inputed payload
ms: 5677
>>
Background:
8
* def defaultHeader =
6
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
1
23
And path "/posts"
0
55
Given headers defaultHeader
1
56
And request {"title":"recommendation","body":"motorcycle","userId":12}
1
57
When method POST
5560
10:50:12.678 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 58 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 {"title":"recommendation","body":"motorcycle","userId":12} 10:50:13.002 response time in milliseconds: 323 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:12 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 84 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"54-3s8W8w2GxPo0WXYdWfItyVF0+Ng" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=4Y7MwUu%2Fjh6%2FkvH4W4u4tzAadp5%2Bn42eZqZG53ZzK%2Fo%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501012"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=4Y7MwUu%2Fjh6%2FkvH4W4u4tzAadp5%2Bn42eZqZG53ZzK%2Fo%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501012" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 995 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=11,cfOrigin;dur=73 1 < CF-RAY: 994bcb7229cccf1e-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "recommendation", "body": "motorcycle", "userId": 12, "id": 101 }
58
* def expectedValue = {"title":"recommendation","body":"motorcycle","userId":12}
1
59
Then match response.title == "#string? _ == expectedValue.title"
22
60
And match response.body == "#string? _ == expectedValue.body"
49
61
And match response.userId == "#number? _ == expectedValue.userId"
37
Scenario: [4.2:66] The API response body has a valid key value as inputed payload
ms: 446
>>
Background:
8
* def defaultHeader =
13
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
1
23
And path "/posts"
2
55
Given headers defaultHeader
0
56
And request {"title":"new","body":"movie","userId":123}
0
57
When method POST
366
10:50:12.997 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 43 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 {"title":"new","body":"movie","userId":123} 10:50:13.357 response time in milliseconds: 358 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:13 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 69 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"45-NKbawMk6zWMAIJix/0d0h5aFDOc" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501013"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501013" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 993 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=8,cfOrigin;dur=71 1 < CF-RAY: 994bcb73bd5f2289-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "new", "body": "movie", "userId": 123, "id": 101 }
58
* def expectedValue = {"title":"new","body":"movie","userId":123}
1
59
Then match response.title == "#string? _ == expectedValue.title"
6
60
And match response.body == "#string? _ == expectedValue.body"
5
61
And match response.userId == "#number? _ == expectedValue.userId"
50
Scenario: [4.3:67] The API response body has a valid key value as inputed payload
ms: 411
>>
Background:
8
* def defaultHeader =
11
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
1
23
And path "/posts"
1
55
Given headers defaultHeader
0
56
And request {"title":"information","body":"hello world","userId":-12}
0
57
When method POST
321
10:50:12.998 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 57 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 {"title":"information","body":"hello world","userId":-12} 10:50:13.312 response time in milliseconds: 308 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:13 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 83 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"53-tD0lbiWhYPD5uSpBibig/HjqrWs" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501013"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501013" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 994 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=5,cfOrigin;dur=69 1 < CF-RAY: 994bcb73ad867c86-LAX 1 < alt-svc: h3=":443"; ma=86400 { "title": "information", "body": "hello world", "userId": -12, "id": 101 }
58
* def expectedValue = {"title":"information","body":"hello world","userId":-12}
1
59
Then match response.title == "#string? _ == expectedValue.title"
9
60
And match response.body == "#string? _ == expectedValue.body"
59
61
And match response.userId == "#number? _ == expectedValue.userId"
6
Scenario: [4.4:68] The API response body has a valid key value as inputed payload
ms: 336
>>
Background:
8
* def defaultHeader =
1
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
1
23
And path "/posts"
1
55
Given headers defaultHeader
0
56
And request {"title":"12345","body":"12345","userId":0}
0
57
When method POST
318
10:50:13.069 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 43 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 {"title":"12345","body":"12345","userId":0} 10:50:13.382 response time in milliseconds: 310 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:13 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 69 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"45-I0FS5b/d/x1IIYxgdw46r8se9eA" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501013"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501013" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 992 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=5,cfOrigin;dur=75 1 < CF-RAY: 994bcb740c45e4ec-LAX 1 < alt-svc: h3=":443"; ma=86400 { "title": "12345", "body": "12345", "userId": 0, "id": 101 }
58
* def expectedValue = {"title":"12345","body":"12345","userId":0}
1
59
Then match response.title == "#string? _ == expectedValue.title"
4
60
And match response.body == "#string? _ == expectedValue.body"
4
61
And match response.userId == "#number? _ == expectedValue.userId"
5
Scenario: [4.5:69] The API response body has a valid key value as inputed payload
ms: 508
>>
Background:
8
* def defaultHeader =
1
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
1
23
And path "/posts"
2
55
Given headers defaultHeader
0
56
And request {"title":"!@#$%^&*()_+","body":"!@#$%^&*()_+","userId":0}
1
57
When method POST
491
10:50:13.147 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 57 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 {"title":"!@#$%^&*()_+","body":"!@#$%^&*()_+","userId":0} 10:50:13.622 response time in milliseconds: 473 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:13 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 83 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"53-t2m0R+DogNESs6TTf8mqeazD+7M" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501013"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501013" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 990 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=6,cfOrigin;dur=208 1 < CF-RAY: 994bcb7568b3152b-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "!@#$%^&*()_+", "body": "!@#$%^&*()_+", "userId": 0, "id": 101 }
58
* def expectedValue = {"title":"!@#$%^&*()_+","body":"!@#$%^&*()_+","userId":0}
1
59
Then match response.title == "#string? _ == expectedValue.title"
2
60
And match response.body == "#string? _ == expectedValue.body"
6
61
And match response.userId == "#number? _ == expectedValue.userId"
3
Scenario: [4.6:70] The API response body has a valid key value as inputed payload
ms: 404
>>
Background:
8
* def defaultHeader =
66
{ "Content-Type": "application/json" }
14
* def defaultPayload =
7
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
5
23
And path "/posts"
1
55
Given headers defaultHeader
0
56
And request {"title":"abc123!@#","body":"abc123!@#","userId":0}
83
57
When method POST
202
10:50:13.431 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 51 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 {"title":"abc123!@#","body":"abc123!@#","userId":0} 10:50:13.609 response time in milliseconds: 176 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:13 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 77 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"4d-RzOwwKCBQe/13wOKUFFvkrvTWgE" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501013"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501013" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 991 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=8,cfOrigin;dur=72 1 < CF-RAY: 994bcb762e05cee5-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "abc123!@#", "body": "abc123!@#", "userId": 0, "id": 101 }
58
* def expectedValue = {"title":"abc123!@#","body":"abc123!@#","userId":0}
1
59
Then match response.title == "#string? _ == expectedValue.title"
9
60
And match response.body == "#string? _ == expectedValue.body"
8
61
And match response.userId == "#number? _ == expectedValue.userId"
21
Scenario: [5.1:97] The "title" value accept "non-empty" String and "body" value accept "non-empty" String
ms: 296
>>
Background:
8
* def defaultHeader =
1
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
0
23
And path "/posts"
0
74
Given headers defaultHeader
2
75
And request {"title":"recommendation","body":"motorcycle","userId":12}
4
76
When method POST
277
10:50:13.447 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 58 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 {"title":"recommendation","body":"motorcycle","userId":12} 10:50:13.713 response time in milliseconds: 264 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:13 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 84 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"54-3s8W8w2GxPo0WXYdWfItyVF0+Ng" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501013"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501013" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 988 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=7,cfOrigin;dur=70 1 < CF-RAY: 994bcb765a8915da-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "recommendation", "body": "motorcycle", "userId": 12, "id": 101 }
77
* def payload = {"title":"recommendation","body":"motorcycle","userId":12}
1
78
* def supportFunction = read("../helper/CheckEmptyValue.js")
10
10:50:13.727 classpath:features/PostRequest.feature:78 * def supportFunction = read("../helper/CheckEmptyValue.js") js failed: >>>> 01: read("../helper/CheckEmptyValue.js") <<<< org.graalvm.polyglot.PolyglotException: java.io.FileNotFoundException: C:\Users\PANKAJ KUMAR SAO\poc\karate-api-test\build\resources\test\features\..\helper\CheckEmptyValue.js (The system cannot find the path specified) - com.intuit.karate.resource.FileResource.getStream(FileResource.java:98) - com.intuit.karate.core.ScenarioFileReader.readFileAsStream(ScenarioFileReader.java:99) - com.intuit.karate.core.ScenarioFileReader.readFileAsString(ScenarioFileReader.java:95) - com.intuit.karate.core.ScenarioFileReader.readFile(ScenarioFileReader.java:58) - com.intuit.karate.core.ScenarioEngine.lambda$new$0(ScenarioEngine.java:124) - <js>.:program(Unnamed:1) classpath:features/PostRequest.feature:78
79
* def expectedValue =
0
{ title:"#(supportFunction(payload.title, 'non-empty'))", body:"#(supportFunction(payload.body, 'non-empty'))" }
86
* def actualValue =
0
{ title:"#(supportFunction(response.title, 'non-empty'))", body:"#(supportFunction(response.body, 'non-empty'))" }
93
Then match actualValue == expectedValue
0
Scenario: [5.2:98] The "title" value accept "empty" String and "body" value accept "non-empty" String
ms: 257
>>
Background:
8
* def defaultHeader =
2
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
11
23
And path "/posts"
0
74
Given headers defaultHeader
0
75
And request {"title":"","body":"motorcycle","userId":12}
0
76
When method POST
230
10:50:13.448 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 44 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 {"title":"","body":"motorcycle","userId":12} 10:50:13.671 response time in milliseconds: 221 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:13 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 70 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"46-ovtbfVARM/g/iOESCM/jD+sCP+k" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501013"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501013" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 989 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=11,cfOrigin;dur=72 1 < CF-RAY: 994bcb764ff2cf2e-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "", "body": "motorcycle", "userId": 12, "id": 101 }
77
* def payload = {"title":"","body":"motorcycle","userId":12}
1
78
* def supportFunction = read("../helper/CheckEmptyValue.js")
11
10:50:13.684 classpath:features/PostRequest.feature:78 * def supportFunction = read("../helper/CheckEmptyValue.js") js failed: >>>> 01: read("../helper/CheckEmptyValue.js") <<<< org.graalvm.polyglot.PolyglotException: java.io.FileNotFoundException: C:\Users\PANKAJ KUMAR SAO\poc\karate-api-test\build\resources\test\features\..\helper\CheckEmptyValue.js (The system cannot find the path specified) - com.intuit.karate.resource.FileResource.getStream(FileResource.java:98) - com.intuit.karate.core.ScenarioFileReader.readFileAsStream(ScenarioFileReader.java:99) - com.intuit.karate.core.ScenarioFileReader.readFileAsString(ScenarioFileReader.java:95) - com.intuit.karate.core.ScenarioFileReader.readFile(ScenarioFileReader.java:58) - com.intuit.karate.core.ScenarioEngine.lambda$new$0(ScenarioEngine.java:124) - <js>.:program(Unnamed:1) classpath:features/PostRequest.feature:78
79
* def expectedValue =
0
{ title:"#(supportFunction(payload.title, 'empty'))", body:"#(supportFunction(payload.body, 'non-empty'))" }
86
* def actualValue =
0
{ title:"#(supportFunction(response.title, 'empty'))", body:"#(supportFunction(response.body, 'non-empty'))" }
93
Then match actualValue == expectedValue
0
Scenario: [5.3:99] The "title" value accept "non-empty" String and "body" value accept "empty" String
ms: 298
>>
Background:
8
* def defaultHeader =
1
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
0
23
And path "/posts"
0
74
Given headers defaultHeader
0
75
And request {"title":"recommendation","body":"","userId":12}
0
76
When method POST
287
10:50:13.442 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 48 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 {"title":"recommendation","body":"","userId":12} 10:50:13.720 response time in milliseconds: 264 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:13 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 74 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"4a-flxma8OuO1yJOD0OBCpqUEOpwoY" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501013"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501013" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 987 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=3,cfOrigin;dur=70 1 < CF-RAY: 994bcb766ce0152b-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "recommendation", "body": "", "userId": 12, "id": 101 }
77
* def payload = {"title":"recommendation","body":"","userId":12}
2
78
* def supportFunction = read("../helper/CheckEmptyValue.js")
7
10:50:13.733 classpath:features/PostRequest.feature:78 * def supportFunction = read("../helper/CheckEmptyValue.js") js failed: >>>> 01: read("../helper/CheckEmptyValue.js") <<<< org.graalvm.polyglot.PolyglotException: java.io.FileNotFoundException: C:\Users\PANKAJ KUMAR SAO\poc\karate-api-test\build\resources\test\features\..\helper\CheckEmptyValue.js (The system cannot find the path specified) - com.intuit.karate.resource.FileResource.getStream(FileResource.java:98) - com.intuit.karate.core.ScenarioFileReader.readFileAsStream(ScenarioFileReader.java:99) - com.intuit.karate.core.ScenarioFileReader.readFileAsString(ScenarioFileReader.java:95) - com.intuit.karate.core.ScenarioFileReader.readFile(ScenarioFileReader.java:58) - com.intuit.karate.core.ScenarioEngine.lambda$new$0(ScenarioEngine.java:124) - <js>.:program(Unnamed:1) classpath:features/PostRequest.feature:78
79
* def expectedValue =
0
{ title:"#(supportFunction(payload.title, 'non-empty'))", body:"#(supportFunction(payload.body, 'empty'))" }
86
* def actualValue =
0
{ title:"#(supportFunction(response.title, 'non-empty'))", body:"#(supportFunction(response.body, 'empty'))" }
93
Then match actualValue == expectedValue
0
Scenario: [5.4:100] The "title" value accept "empty" String and "body" value accept "empty" String
ms: 250
>>
Background:
8
* def defaultHeader =
29
{ "Content-Type": "application/json" }
14
* def defaultPayload =
1
{ userId: 12, title: "recommendation", body: "motorcycle" }
22
Given url "https://jsonplaceholder.typicode.com"
0
23
And path "/posts"
0
74
Given headers defaultHeader
1
75
And request {"title":"","body":"","userId":12}
0
76
When method POST
206
10:50:13.684 request: 1 > POST https://jsonplaceholder.typicode.com/posts 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 34 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 {"title":"","body":"","userId":12} 10:50:13.882 response time in milliseconds: 196 1 < 201 1 < Date: Sun, 26 Oct 2025 17:50:13 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Content-Length: 60 1 < Connection: keep-alive 1 < access-control-allow-credentials: true 1 < access-control-expose-headers: Location 1 < Cache-Control: no-cache 1 < etag: W/"3c-K8w83+gMlJGIE3NiyO93atJjzK8" 1 < expires: -1 1 < location: https://jsonplaceholder.typicode.com/posts/101 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=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1761501013"}],"max_age":3600} 1 < reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=ylw%2FDkM8EKyCC7j1Vpy%2FXvVVy5pjXaA%2BPIBD7qU1x00%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1761501013" 1 < Server: cloudflare 1 < vary: Origin, X-HTTP-Method-Override, 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: 986 1 < x-ratelimit-reset: 1761501055 1 < cf-cache-status: DYNAMIC 1 < Server-Timing: cfCacheStatus;desc="DYNAMIC" 1 < Server-Timing: cfEdge;dur=7,cfOrigin;dur=74 1 < CF-RAY: 994bcb77da29169e-SJC 1 < alt-svc: h3=":443"; ma=86400 { "title": "", "body": "", "userId": 12, "id": 101 }
77
* def payload = {"title":"","body":"","userId":12}
4
78
* def supportFunction = read("../helper/CheckEmptyValue.js")
9
10:50:13.899 classpath:features/PostRequest.feature:78 * def supportFunction = read("../helper/CheckEmptyValue.js") js failed: >>>> 01: read("../helper/CheckEmptyValue.js") <<<< org.graalvm.polyglot.PolyglotException: java.io.FileNotFoundException: C:\Users\PANKAJ KUMAR SAO\poc\karate-api-test\build\resources\test\features\..\helper\CheckEmptyValue.js (The system cannot find the path specified) - com.intuit.karate.resource.FileResource.getStream(FileResource.java:98) - com.intuit.karate.core.ScenarioFileReader.readFileAsStream(ScenarioFileReader.java:99) - com.intuit.karate.core.ScenarioFileReader.readFileAsString(ScenarioFileReader.java:95) - com.intuit.karate.core.ScenarioFileReader.readFile(ScenarioFileReader.java:58) - com.intuit.karate.core.ScenarioEngine.lambda$new$0(ScenarioEngine.java:124) - <js>.:program(Unnamed:1) classpath:features/PostRequest.feature:78
79
* def expectedValue =
0
{ title:"#(supportFunction(payload.title, 'empty'))", body:"#(supportFunction(payload.body, 'empty'))" }
86
* def actualValue =
0
{ title:"#(supportFunction(response.title, 'empty'))", body:"#(supportFunction(response.body, 'empty'))" }
93
Then match actualValue == expectedValue
0