TestRail integration

Hi, I’ve currently written a JS script that takes the output from k6, parses it, and creates a TestRail run as a result, but it would be much easier if this part of k6.

At a minimum, it would need to:

  1. Fail the test in TestRail if thresholds fail
  2. Capture the k6 report in TestRail
  3. Capture the options settings and environment variables used when the test was run
  4. Need its own switches for the TestRail host URL, token, test id etc.

I’d like to give this a go as a side project. Would it be possible to build this as a k6 extension (i.e. would I be able to get the k6 report data)? Or would it need to be a feature - where’s the best place to start?

Hi @sstratton,

I am pretty sure you can do all of those (to varying degrees) with a handleSummary callback. It will be called with all the things you care about when the test finishes and you can definitely get 1,2 and 3(I remember there were some corner cases, but I can’t any reference currently). 4. is fine as long as you are okay with environmental variables … as there is no way to add flags from the handleSummary.

If not, support for output extensions through xk6 are about to be released in v0.31.0 (next week, hopefully :crossed_fingers: ). That should then be sufficient, but you will probably need to generate the k6 report from the grounds up … which shouldn’t be that hard :man_shrugging: . Documentation on how to write an output will be written in the following days/week, hopefully :crossed_fingers:

You can open a feature request on the issue tracker if you want to discuss actually adding it to k6.

I personally prefer this to be a handleSummary callback that is just JS code people can import from a URL akin to others in jslib. If it turns out to be an output … that is exactly what output extensions are being added for - letting people write custom outputs that they support and can develop without following the k6 release cycle.

Hope this helps you :slight_smile:

2 Likes