Search code examples
javamavenclasspathmutation-testingpitest

Issues running a custom PIT Mutation Engine Plugin


I'm writing a custom Mutation Engine for PIT, but I'm having troubles getting PIT to find it. My guess is that I'm failing to put the package with my own engine in the right classpath when running PIT using a project. To test my engine I'm using this code and I'm running PIT using the Maven plugin. In the pom.xml file I wrote the name of the custom engine and even its path inside an additionalClassPathElements tag. Nothing seems to work. PIT keeps saying it can't find the engine. Which is the best way to safely verify if it is a classpath issue? or Which is the simplest to make PIT find my package and be able to use the plugin?

Thanks in advance,


Solution

  • It's been a while since this question was posted. The plugin was not being found due to the way PIT was searching for external components. The issue as been solved already in version 1.2.1. Current version is 1.4.9.

    Your plugin should include a META_INF/MANIFEST.MF declaring the following fields: Implementation-Vendor-Id and Implementation-Title. In a Maven Project, the groupId would go to the former and artifactId to the latter, so you don't really have to do anything special.

    Originally, PIT used Implementation-Vendor which, by default would contain the organization name declared in the pom.xml. In my case, this value was not the same as the groupId and therefore PIT was not able to find the plugin.

    As said in the comments the pitest-plugin repository provides great examples on how to create your own plugins. pitest-descartes and pitest-evosuite-plugin are other two examples that might be helpful as well.