Tuesday, June 9, 2015

Give your tests mutant powers with PIT [Part 1]


Mutation Testing basics:  Can your tests survive the coming mutant apocalypse? (LinkedIn)




Mutation testing opens exciting possibilities. Let's start doing it.  Now, stop waiting and just do it.

PIT seems to be regarded as the tool of choice in the Java software development world.  PIT has a maven plugin which can help make it a part of your daily builds.  The tool also works with ant, gradle, and more.  There is even a Sonar plugin available to integrate the mutation testing reports will all your other coverage reports. After you read this post go to the PIT website (http://pitest.org/) and check out all it has to offer.

The cost of entry with the Maven plugin is low but it is not low enough for me,  There is configuration needed to get your project up and running with PIT and the documentation leaves a little be desired. However there is almost no cost to you to install the PIT Eclipse plugin. The plugin that lets you do all the same mutation magic but in eclipse without needing to update your projects pom file and saves you the trouble from running on the command-line. It allows you to limit the tests that are used for mutations very easily.  You can get this going in less than 10 minutes in the morning and be prepared to show it to people at the lunch table.

There are disadvantages to mutation test.  For example it is time consuming and resource intensive.  Which is all the more reason why you should ease into it and put your toes in the water with the eclipse plugin.  It will help you quickly see the value of it.

The plugin can be added via the eclipse market place by searching for the name "PitClipse".  If you need more information about it check out the marketplace website: https://marketplace.eclipse.org/content/pitclipse


The results can be seen in a tree structure in eclipse vs using the html report generated via the command line.





The html report can also been seen in eclipse but I personally feel the tree view is more usable.



Don't wait! Install the plugin and get started.  Once you see the mutations that survive from the unit tests you have told yourself are good enough you will be convinced that mutation testing is the way to go.




Give your tests mutant powers with PIT [Part 2]

1 comment:

  1. That provision was presumably added for the appearance of non-discriminatory even-handednesspublic defender case management software

    ReplyDelete