Vanilla k6 over K6chaijs

Hi @zakirefai your (now closed) issue related to the 504 errors reminded me of this issue.

I also wanted to suggest consider switching to the k6chaijs library for error handling and other advantages. This is relevant to both the iteration and the specific request.

By chaining the expects (chai checks) in a logical order, it will reduce the # of expects which are run. No extra code involved. For example, test the response status code before attempting to test the JSON response body.

Also: if a specific describe (chai group) fails, the test execution of that iteration will continue outside of that describe.

More information: Using chai with k6
and: https://grafana.com/docs/k6/latest/javascript-api/jslib/k6chaijs/error-handling/

1 Like