Java – JUnit test passed, but pit indicates that the suite is not green

When trying to run pit mutation test, I received the following error:

When I do the normal test build, the tests run well, but when I run the mutation test phase, they are said to fail, but they don't provide any details I have understood the reasons for the listing of pit testing FAQ, but I still don't know it may be wrong

I tried:

Add the - dthreads = 1 option to the rule of any multithreading problem > no system properties can be found. The only failed tests are not ignored in normal operation

What other things should I try? Or other ways to debug what might happen here?

Solution

The common causes of test failure in the coverage phase are

>Pit receiving test does not include excluding in normal test configuration > test depends on environment variables or other attributes set in test configuration, but not set in pitest configuration > test has hidden order dependencies that are not displayed during normal test run > pit doesn't like things in your technology stack - it may be a JUnit test runner

Sounds like you've eliminated 1 & leaves 3 and 4

Test order dependencies can be difficult to find If either answer is yes, you may have one

Does your code base contain variable static? (e.g. single person) will your test occur in the database (memory or other means) and the state persists between tests? Does your test modify files on disk?

There may be many other reasons

If you are convinced that dependencies in your code base are impossible, these specific tests will have problems

It's hard to guess that this may be without some code Can you release a simplified version of a test that still fails?

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>