Hello,
I am using postman-to-k6 conversion tool to generate k6_script.
One of the test 6.4 p0 performance public/game/list Response time is less than 200ms
is failing due to slow response time. I am having issue debugging only failed test request
How can I print header “Correlationid” only for failed tests ?
postman test
pm.expect(pm.response.responseTime).to.be.below(200);
});
k6 converted code as follows
postman[Request]({
name: "6.4 p0 performance public/game/list",
id: "3e6a4fce-04e7-4aba-b022-d164c10037ef",
method: "GET",
address: "{{catalogueurl}}/public/game/list?limit=20",
post(response) {
pm.test(
"6.4 p0 performance public/game/list test for 200 response code public/game/list",
function() {
pm.response.to.have.status(200);
}
);
pm.test(
"6.4 p0 performance public/game/list Response time is less than 200ms",
function() {
pm.expect(pm.response.responseTime).to.be.below(200);
}
);
}
});
In order to debug failed test request I am using –http-debug option for k6 but it prints out all request info rather than only failed ones.
This is how I am running the k6 command
k6 run -vu 20 --iterations 100 --out influxdb=http://influx:8086/mydevk6db k6_script.js --http-debug="X-Correlationid"
sample debug info:
Request:
GET /public/game/list?limit=20 HTTP/1.1
Host: catalogueurl
User-Agent: k6/0.26.2 (https://k6.io/)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip
Response:
HTTP/2.0 200 OK
Content-Length: 64644
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
Date: Fri, 12 Jun 2020 04:46:33 GMT
Etag: W/"fc84-aLmj2GeK2EE8KYCmLlO06jz3FYs"
X-Correlationid: 7eae9735-3f88-49c3-9c29-226d9555f5ef
X-Frame-Options: SAMEORIGIN
X-Requestid: 401212d6-9a2d-4b67-967f-3b1cfb31ef50
done [==========================================================] 100 / 100
✓ 6.4 p0 performance public/game/list response should be okay to process
✓ 7.1 p1 public/category/read Status code is 200
✓ 7.8 p0 performance public/news/list test 200 for rss service public/news/list
✓ test for 200 response code public/comment/latest
✓ 3.1 p1 public/banner Status code is 200
✓ 6.4 p0 performance public/game/list test for 200 response code public/game/list
✓ 6.4 p0 performance public/game/list Body matches string
✗ 6.4 p0 performance public/game/list Response time is less than 200ms**
↳ 25% — ✓ 25 / ✗ 75
✓ 7.5 p0 performance public/news/read test 200 for rss service public/news/read
✓ 5.1 p1 public/result/page/settings Status code is 200
checks.....................: 92.50% ✓ 925 ✗ 75
data_received..............: 9.4 MB 2.0 MB/s
data_sent..................: 236 kB 49 kB/s
http_req_blocked...........: avg=9.4ms min=0s med=0s max=184.64ms p(90)=36.03ms p(95)=45.92ms
http_req_connecting........: avg=1.73ms min=0s med=0s max=29.66ms p(90)=9.3ms p(95)=13.37ms
http_req_duration..........: avg=117.36ms min=7.78ms med=29.04ms max=1.28s p(90)=336.32ms p(95)=514.44ms
http_req_receiving.........: avg=16.49ms min=25µs med=63µs max=935.93ms p(90)=12.8ms p(95)=20.55ms
http_req_sending...........: avg=76.14µs min=37µs med=58µs max=2.19ms p(90)=123.1µs p(95)=146µs
http_req_tls_handshaking...: avg=7.6ms min=0s med=0s max=169.99ms p(90)=24.05ms p(95)=29.34ms
http_req_waiting...........: avg=100.79ms min=7.2ms med=27.38ms max=1.09s p(90)=307.06ms p(95)=424.01ms
http_reqs..................: 700 145.017249/s
iteration_duration.........: avg=897.86ms min=198.99ms med=710.61ms max=2.26s p(90)=1.97s p(95)=2.23s
iterations.................: 100 20.71675/s
vus........................: 20 min=20 max=20
vus_max....................: 20 min=20 max=20