Replies: 1 comment
-
Hi @datimms, The I'm not 100% sure but my guess is that Postman-to-K6 wrapper, catches the failed iteration silently. A tip could be to make your Postman tests more fault tolerant, which would make the K6 tests also more stable. // Set response object as internal variable
let jsonData = {};
try {jsonData = pm.response.json();}catch(e){console.log(e);}
pm.test("Some Property is returned", function () {
//ignore the fact this is a bad idea
pm.expect(jsonData.data.someProperty).to.exist;
}); Would this be a idea that could work for you? |
Beta Was this translation helpful? Give feedback.
-
Imagine I have a postman request with an expected response of:-
and I have a test as follows:-
When I run this in Postman, both tests pass. Postman doesn't throw any js errors.
When I convert and run this in k6, the first test passes and the second test is not reported and k6 itself stops the iteration, logging
level=error msg="TypeError: Cannot read property 'notThere' of undefined
. It then starts another iteration if available.The main issue really is that k6 fails silently.
Imagine now my system under test starts to fail under load and begins to respond with:-
In postman now both tests would fail.
In k6 both tests would not be reported, k6 would have failed silently then continue another iteration and at the end of the run report 100% pass all green. If you were diligent you would notice that the number of http_reqs didn't marry up to the number of iterations but that would be the only way to tell.
Is this expected behaviour of postman requests running in k6, compared to the way Postman handles it?
Beta Was this translation helpful? Give feedback.
All reactions