[k6-to-junit] Junit xml output

I have a k6 tests that are to be triggered from a Azure devops build pipeline.

was wondering if K6 has any way of exporting the results of ‘checks’ to a junit.xml such that ‘Publish test results’ tasks in a pipeline can read the file and display the number of checks that has gone fine as ‘Passed’ and other as ‘failed’ ?

Note this is when I try to run K6 tests as a functional test with just 1 vus and 1 iteration.

Hey there!

I believe the k6-to-junit repository in GitHub - grafana/awesome-k6: A curated list of resources on automated load- and performance testing using k6 🗻 is doing exactly what you are looking for.

Out of interest: can you elaborate a little on your functional testing with k6? This is an area we are thinking about expanding. Which features would you like to see in k6 that are related to functional testing?


1 Like

Hi @pawel thanks for the quick reply. I will check it out.

The idea is very simple, we have a list of apis that has to be tested (be it with many input data, or negative tests or a simple functional tests). And considering each .js file as a testcase (say for example has 5 checks).
If it is run with 1 vus and 1 iteration, print the filename as testcase name and if all the checks are ok, report the test case as pass.

As a functional test, i would really like to see a PASS/FAIL status rather than thresholds/checks.

Thanks for the description of your use case!

Do you think that the proposed abort() JavaScript API would be helpful in your use case? See this issue for details: Provide an API to exit a test · Issue #1001 · grafana/k6 · GitHub

Would you mind copy-pasting one of your tests here (after anonymizing it)? It’s valuable for us to see how k6 is used “in the wild”.

1 Like

@jeevananthank may be k6-junit can help with your case.