4

I am trying to use PIT Mutation testing with maven for apache common math tests.

<plugin>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>0.29</version>
    <configuration>
        <targetClasses>
            <param>org.*</param>
        </targetClasses>
        <targetTests>
            <param>org.*</param>
        </targetTests>
    </configuration>
</plugin>

I added this to my pom.xml and mvn org.pitest:pitest-maven:mutationCoverage. I am able to run it but index files show Line Coverage and Mutation Coverage as 0%. I think I am not giving the parameters correctly. Moreover I need to mutate one test of apache-common-math For e.g. LUDecomposition.

Marcin Zajączkowski
  • 4,036
  • 1
  • 32
  • 41
Biparite
  • 203
  • 1
  • 2
  • 13
  • 0.29 is quite old - there were some bugs fixed. Use 1.1.0. Do you get any errors in the output? You can share the output with Gist or Pastebin. – Marcin Zajączkowski Oct 29 '14 at 09:48
  • http://pastebin.com/3pMyViti. I tried with version 1.1.0 that ends more abruptly. Here is the error with version 1.1.0 http://pastebin.com/wdXmig1h. – Biparite Oct 29 '14 at 10:10
  • `org.*` is very wide scope - PIT's classes also match (`org.pitest`). As I suggested in my answer you can just omit those 2 parameter for basic analysis or define it as `org.apache.commons.math3.*`. – Marcin Zajączkowski Oct 29 '14 at 10:16
  • What do you mean by "mutate one test of"? If you mean you only wish to create mutations for a specific class then set targetClasses to org.apache.commons.math3.linear.LUDecomposition and targetTests to org.apache.commons. – henry Oct 29 '14 at 12:57

1 Answers1

3

Before running of mutation testing analysis run mvn test to compile main and test classes (and by the way verify that all tests pass which may affect PIT results).

After mvn clean or on a freshly cloned repository PIT doesn't have any classes to mutate and you can get mentioned message.

By default PIT plugin for Maven takes groupId as a base package, so for commons-math it is ok to completely omit a configuration section. Also update PIT version to 1.1.0 (or newest when available) to not hit already fixed bugs.

Marcin Zajączkowski
  • 4,036
  • 1
  • 32
  • 41
  • http://pastebin.com/0N6NXe70 This is error I am running into after executing mvn test, and then running mutation analysis. How can I prevent memory heap space error. – Biparite Oct 29 '14 at 11:04
  • 1
    Use `jvmArgs` (PIT configuration) parameter to increase -Xmx. See [that](http://pitest.org/quickstart/commandline/) for the reference. – Marcin Zajączkowski Oct 29 '14 at 11:22