Search code examples
javakotlinmutation-testingpitest

Pitest mutation testing execute over kotlin files only


I arrived to a legacy project where multiple files are developed in Java and many others in Kotlin. I have be able to configure Pitest to execute the mutation test and i have a correct report.

Now I would like to execute the mutation test only over the Kotlin files.

I tried to use the <targetClasses> but the param expresion is able to include certain packages, but I didn't discover a way to include certain types of files only.

I also tried to use the <excludedClasses> to add there a Java identificator that exclude this type of files, but again it doesn't work.

Do you know a way to use the targetClasses or the excludedClasses to let the kotlin files only in the scope of the Pitest execution?

Thank you in advance.


Solution

  • There is no built in way to limit mutation to only kotlin files. You would need to implement an mutation interceptor.

    https://pitest.org/quickstart/advanced/

    Or use the exclusions functionality provided by the arcmutate extentions to ignore files with a .java extension.

    https://docs.arcmutate.com/docs/exclusions.html