-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pitest doesn't recognize exception thrown by assert keyword by default #1322
Comments
I think it would make most sense to raise this against https://github.com/szpak/gradle-pitest-plugin The -ea flag is not set by default when running tests via maven or other tools. So setting it within pitest itself would potentially cause code to fail that ran green from those tools. |
Ah okay I wasn't aware that Maven is not using this option by default. Okay I will raise this in the gradle Plugin. (I hope I have more success than with my other recent pull requests there, the project seems to have been very inactive for some time) |
You just prompted me to check my assumptions. While I'm pretty sure that the maven surefire plugin never used to set -ea, I've just run a test with a recent version and the assertion failed. So setting this by default in pitest does now make sense. |
released in 1.16.0 |
Issue
Unit tests using the keyword "assert" (or the assert function of stdlib in Kotlin) fail when executed with Gradle but doesn't fail (and therefore produce false-positive survived mutations) when executed with Pitest.
This is a known behavior (see #442).
Unfortunately for developers this can be really hard to analyze as it is not commonly known that Gradle obviously is implicitly execution the unit tests with the "-ea" option.
So this issue is to discuss if it is possible to add the "-ea" option to Pitest execution by default?
Workaround
Manually add the "-ea" option when running Pitest, e.g. in Gradle by setting
jvmArgs.add("-ea")
The text was updated successfully, but these errors were encountered: