0

I am using PIT mutation testing (1.6.7) and a maven build system. There is information on which test killed the mutants. But, what I need is whether the mutants were killed by JUnit assertion violation or by any implicit checks or run-time system? Is it possible by PIT?

2 Answers2

0

If by 'implict checks' you mean a compile time error, then this is not possible under PIT. Unlike some earlier systems it will not produce mutants that are not viable.

The only way in which a mutant can be killed is if an uncaught exception is thrown while running a test. PIT does not distinguish between AssertionFailedErrors and other types of exception, so it is not possible to tell if the test failed or errored.

henry
  • 5,923
  • 29
  • 46
  • Can I ask another question? I found that during across several tests, the set of generated mutants are not the same. How to keep the generated mutants the same across all runs? Please note that, I am modifying my test suite, and running mutation testing, so I want the set to be the same, so that I can do some valid comparisons across the runs. – middle-mood Aug 25 '21 at 16:55
  • Pitest will always generate the same mutants when given the same input. If this is not what you're seeing then something strange is going on. – henry Aug 26 '21 at 15:03
0

I implemented such an extension that differentiates between assertion failures and implicitly thrown exceptions a couple of years ago. Though, the code was not merged back to Pitest.

You can still find the branch here: https://github.com/hcoles/pitest/compare/master...nrainer:pitest:features/categorizeTestFailure

To get meaningful results, you will need to generate a full mutation matrix (for each mutation, executing all tests that cover it, without stopping when the first test case kills the mutation). This means that the mutation "kill type" depends on mutation and test case.

nrainer
  • 2,542
  • 2
  • 23
  • 35