How can I perform mutation testing of my Java program?

Can anyone suggest tools that can be used to create mutations in a Java program at the source code (rather than bytecode) level? I need to enter the source code with errors. I would prefer a GUI application if one exists.

+6
source share
7 answers

I found a PIT Mutation Testing tool that I really like. With MuJava, I have exceptions caused by @Override annotations. It doesn't seem to support Java 5/6.

+4
source

When I took the software development class when testing at GMU, we used Mu Java , for one of the chapters, NTN

+3
source

This is the method used by the Jester open source testing tool. A look at this source can be useful if you cannot find a suitable tool and want to build it yourself.

+3
source

If your requirement is valid for mutating the source code, then the options that I know about

Jester - Provides a limited number of mutation operators that are rather unstable. Jeff Offutt described this as a very expensive way to apply industry testing. I believe that you can define your own operators, so this is probably not entirely true.

Mu Java - Doesn't Support Java 5

Judy - I donโ€™t know much about it, except that it exists

Lava - Sounds pretty solid, and I don't think it supports java 5

In the answer below, I see that you are now using PIT. I think that there is truly a lot of choice (I wrote it, so it can have a certain bias), but this is a byte code mutation system.

+3
source

"It has little use in the real world." I do not agree, I will contract with a very large media company in the UK and PIT ( http://pitest.org/ ) is extremely useful for testing mutations. Most CI assemblies are discarded without 85% PIT mutation testing. Re: "replacing some random characters ..." A mutation should not mean this. PIT mutations are limited to compiled changes.

+2
source

Here is the mark:

MฮผClipse only supports JUnit 3 and is no longer supported. The jester, as for him, is laborious and requires a complex configuration; plus is no longer supported. The best tool I could find is Javalanche I wrote an entire article about it!

+1
source

Basic mutation framework ( Main site ) provides a compiler-integrated mutator and mutation analyzer for JUnit tests.

The main mutator is integrated into the Java 7 compiler. It provides several mutation operators and supports two options for modifying the source code:

  • Generate and insert all mutants at compile time
  • Generate mutants and export modified source files
+1
source

Source: https://habr.com/ru/post/891411/


All Articles