Professor X: For someone who hates mutants... you certainly keep some strange company.
William Stryker: Oh, they serve their purpose... as long as they can be controlled.
For an introduction to mutation testing and Stryker's features, see stryker-mutator.io. Looking for mutation testing in JavaScript or .NET?
For the quickstart, see our quickstart. See our sample projects for examples on how to add stryker to your project.
Stryker4jvm is a mutation testing framework for jvm-languages, currently supporting Scala and Kotlin. It allows you to test your tests by temporarily inserting bugs.
Depending on your project setup, there are multiple ways to get started with Stryker4jvm.
Stryker4jvm provides a sbt plugin for easy use within sbt projects. To install the plugin, add the following line to plugins.sbt
:
addSbtPlugin("io.stryker-mutator" % "sbt-stryker4jvm" % stryker4jvmVersion)
After adding the plugin, Stryker4jvm can be used by running sbt stryker
in the root of your project.
Multi-module projects are not yet fully supported. However, there is a workaround you can use while we work on a better solution. Set the base-directory to the correct directory of the submodule with the base-dir
configuration setting. Then you can run sbt "project yourSubmoduleNameHere" stryker
to set the active project and run Stryker.
The Maven plugin can be added as follows in pom.xml
under <plugins>
<plugin>
<groupId>io.stryker-mutator</groupId>
<artifactId>stryker4jvm-plugin-maven</artifactId>
<version>${stryker4jvm.version}</version>
</plugin>
You can then run Stryker4jvm with the command mvn stryker4jvm:run
. Note that this is different than the command for the sbt plugin.
We also publish SNAPSHOT versions of each commit on master. To use a pre-release, add the following setting to your plugins.sbt
:
resolvers += Resolver.sonatypeRepo("snapshots")
See the configuration page for setting up your stryker4jvm.conf
file (optional).
Stryker4jvm supports different mutators depending on the language it is being run on.
For Scala the mutators can be found here. Do you have a suggestion for a (new) mutator? Feel free to create an issue!
An always up-to-date reference is also available in the MutantMatcher source.
See the releases page for all the latest changes made.
Want to contribute? That's great! Please have a look at our contributing guide.