Comments (14)
If you put together a minimal executable project that reproduces the issue, I can take a look.
from pitest.
If you put together a minimal executable project that reproduces the issue, I can take a look.
Hi @hcoles
Here's is the project : https://github.com/AjithGowda/pitSample
Branch : master
steps :
- Clean build the project
- Run the test from gradle task ( Executes successfully )
- Run pitest task ( failed to execute)
Looking forward for your response ,
Thank you
from pitest.
Thanks for the minimal project.
The problem is that this project is using the module path, while pitest is still using the old style classpath. This is a known issue which need resolving.
If you update the project to use the latest version of pitest and the junit plugin, the problem becomes clearly visible in the log
pitest{
pitestVersion = '1.15.3'
targetClasses=["com.*"]
junit5PluginVersion = '1.2.1'
verbose=true
}
13:59:45 PIT >> INFO : MINION : at com.org.sample.Renderer.<init>(Renderer.java:10)
13:59:45 PIT >> INFO : MINION : at com.org.sample.RendererTest.CustomizeCellRenderer(RendererTest.groovy:19)
13:59:45 PIT >> INFO : MINION : Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make static java.awt.Graphics javax.swing.JComponent.safelyGetGraphics(java.awt.Component) accessible: module java.desktop does not "opens javax.swing" to unnamed module @15994b0b
You can work round it for now by opening any necessary modules in the pitest config.
pitest{
pitestVersion = '1.15.3'
targetClasses=["com.*"]
junit5PluginVersion = '1.2.1'
verbose=true
jvmArgs.add("--add-opens=java.base/java.lang=ALL-UNNAMED")
jvmArgs.add("--add-opens=java.desktop/javax.swing=ALL-UNNAMED")
}
from pitest.
Thanks for the minimal project.
The problem is that this project is using the module path, while pitest is still using the old style classpath. This is a known issue which need resolving.
If you update the project to use the latest version of pitest and the junit plugin, the problem becomes clearly visible in the log
pitest{ pitestVersion = '1.15.3' targetClasses=["com.*"] junit5PluginVersion = '1.2.1' verbose=true }13:59:45 PIT >> INFO : MINION : at com.org.sample.Renderer.<init>(Renderer.java:10) 13:59:45 PIT >> INFO : MINION : at com.org.sample.RendererTest.CustomizeCellRenderer(RendererTest.groovy:19) 13:59:45 PIT >> INFO : MINION : Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make static java.awt.Graphics javax.swing.JComponent.safelyGetGraphics(java.awt.Component) accessible: module java.desktop does not "opens javax.swing" to unnamed module @15994b0b
You can work round it for now by opening any necessary modules in the pitest config.
pitest{ pitestVersion = '1.15.3' targetClasses=["com.*"] junit5PluginVersion = '1.2.1' verbose=true jvmArgs.add("--add-opens=java.base/java.lang=ALL-UNNAMED") jvmArgs.add("--add-opens=java.desktop/javax.swing=ALL-UNNAMED") }
Thanks for the prompt response.
Is there a workaround to fix this issue via command line as well ?
from pitest.
@AjithGowda I'm not sure what you mean. If you update the build file as suggested, it will work when running gradle from the commandline.
from pitest.
@AjithGowda I'm not sure what you mean. If you update the build file as suggested, it will work when running gradle from the commandline.
Sorry if i had not conveyed it right , What i mean is
Can we add the jvm params ( jvmArgs.add("--add-opens=java.base/java.lang=ALL-UNNAMED"), when we run using org.pitest.mutationtest.commandline.MutationCoverageReport
?
If yes , could you help us with that ?
from pitest.
If you are doing something custom calling MutationCoverageReport programatically, I'm afraid I'm not able to offer free consultancy. Paid consultancy is available via arcmuate.com
from pitest.
If you are doing something custom calling MutationCoverageReport programatically, I'm afraid I'm not able to offer free consultancy. Paid consultancy is available via arcmuate.com
@hcoles Thanks for the input will try it out via configuration ,Have one more question.
I see there are difference in report when we run pitest using old and new pitest versions. when we run pitest with old pit version ( 1.11.6) with junit plugin (1.1.2) then most of the mutants are reported under killed or survived and only less under no coverage. where as if i run the same code and test with pitest version (1.15.3) and junit plugin (1.2.1), then most of the mutants are under no coverage section. May i know why there is difference ?
from pitest.
Hi @AjithGowda
The sample project has only one mutant marked as no coverage, this is in an else branch that is never executed by a test.
If you are seeing mutants marked as no coverage which you believe are covered by a test, I can take a look if you upload a minimal executable project that reproduces the issue.
from pitest.
Hi @AjithGowda
The sample project has only one mutant marked as no coverage, this is in an else branch that is never executed by a test.
If you are seeing mutants marked as no coverage which you believe are covered by a test, I can take a look if you upload a minimal executable project that reproduces the issue.
Hi @hcoles ,
will work on the minimal executable project.
Also the workaround you suggested above --jvmArgs.add("--add-opens=java.base/java.lang=ALL-UNNAMED") --jvmArgs.add("--add-opens=java.desktop/javax.swing=ALL-UNNAMED")
, is it specific to the project we sent or this will fix for all the issues of this type error ?
from pitest.
Hi @AjithGowda
The sample project has only one mutant marked as no coverage, this is in an else branch that is never executed by a test.
If you are seeing mutants marked as no coverage which you believe are covered by a test, I can take a look if you upload a minimal executable project that reproduces the issue.Hi @hcoles ,
will work on the minimal executable project.
Also the workaround you suggested above
--jvmArgs.add("--add-opens=java.base/java.lang=ALL-UNNAMED") --jvmArgs.add("--add-opens=java.desktop/javax.swing=ALL-UNNAMED")
, is it specific to the project we sent or this will fix for all the issues of this type error ?
@hcoles Could you help us with the above query please ?
from pitest.
Can you provide a little more detail about your project? It appears to be a mutation testing plugin for Intelij. Is it open source?
from pitest.
Can you provide a little more detail about your project? It appears to be a mutation testing plugin for Intelij. Is it open source?
Hi @hcoles
Its not open source . Its a light project building for small set of people to run via command line.
We would like to know , the workaround you suggested to add the jvmargs is it specific to the minimal executable project
i sent to you or will it fix all similar kind of issues.
Also could this be resolved in latest releases to piTest ?
from pitest.
You can read about add-opens and the module path in the oracle java 9 migration guide
https://docs.oracle.com/en/java/javase/17/migrate/migrating-jdk-8-later-jdk-releases.html
As for whether this will be fixed for you in a future release of pitest. If you are calling MutationCoverReport programatically it's not possible to say as it will depend on what your code does. Future releases of pitest will however look at module path support when run via maven or gradle.
from pitest.
Related Issues (20)
- Command Line API Documentation Improvements
- Minions die to `RUN_ERROR`s in records with annotations HOT 1
- Duplicate org.pitest pitest-maven in both build and reporting sections
- QuarkusTest passes outside PIT, fails when run in PIT HOT 5
- Fewer mutations generated with version 1.15.4 HOT 3
- argLine problems since 1.15.4 HOT 19
- Bad side effects of Pitest HOT 2
- Vulnerabilities in Latest Release of Plugin HOT 6
- Getting Unrecognized field "killingTests" (class org.pitest.aggregate.MutationXml) + Mutation Plugin 1.15.0 / JDK 21 HOT 2
- Pitest config allows only whole Test class execution, but it would be good to have option to run single test method from class
- does not allow performance optimization in logic HOT 1
- creation of mutable collection consider as can be avoided HOT 11
- Copy of array(collections) to protect data from changes HOT 1
- Support targeting different JUnit TestEngines using PIT HOT 3
- PIT cannot detect tests and classes when package starts with "com" HOT 11
- code might be less elegant if chained call of cast to type is present
- Mutating non-existing lines in Kotlin HOT 3
- Issue in build pulling in old version of java HOT 1
- Conditionals with `isDebugEnabled`
- `avoidCallsTo` not working for internal classes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pitest.