A first-class tool like PIT deserves a better integration with a first-class dashboard like the Stryker Mutator Dashboard!
That's why today, I am introducing a much cleaner and simpler approach: the Stryker Mutator Dashboard reporter for PIT.
Here's how it works:
- It collects mutation testing results from PIT.
- It converts the collected mutation testing results into the format that the Stryker Mutator Dashboard expects.
- It uploads the converted report to the Stryker Mutator Dashboard.
How to use it?
I've tried to make it as simple as possible to use the reporter.
As a prerequisite, make sure there is an environment variable
STRYKER_DASHBOARD_API_KEY with the API key that you got when you set up your project.
Now, follow these four steps:
Find the place in your pom.xml where you define the pitest-maven plugin.
Add a dependency to this plugin declaration:
Configure PIT to use the new output format:
- Alternatively, if
<configuration>is already there, add the
- Similarly, if
<outputFormats>is already there, add (or replace) with
- Alternatively, if
Important If you are working on a multi-module Maven project, add the following to the
This will ensure the mutation testing results of the various Maven modules will not mix up in the report. You should not do this if you have a single-module Maven project!
For all the other things, the reporter will autoconfigure itself, given your build runs on any of the following environments:
- GitHub Actions
If your builds run in another environment, please feel free to open an issue.
That's all - you're done! Kick off a fresh build, wait a few minutes and enjoy the online report!
Credit where credit is due: this reporter would not exist without this tremendous work by Wouter Aarts. His reporter contains all the complex mapping from PIT results to mutation-testing-elements' JSON format.
I have a slightly longer version of this blog (including some historical background) on my personal blog.