junit5
junit5 copied to clipboard
Can't transform to a Result of type javax.xml.transform.stax.StAXResult
When I try to use the new Open Test report format of JUnit 5.9.0 this warning is displayed on console when starting tests:
javax.xml.transform.TransformerException: Can't transform to a Result of type javax.xml.transform.stax.StAXResult at org.apache.xalan.transformer.TransformerIdentityImpl.createResultContentHandler(TransformerIdentityImpl.java:302) at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:330) at org.junit.platform.reporting.shadow.org.opentest4j.reporting.events.api.DefaultDocumentWriter.append(DefaultDocumentWriter.java:115)
The XML report file is created, but it does not contain anything in the events section.
I tried to reproduce it with the JUnit 5 sample project "junit5-jupiter-starter-gradle", but there it works as expected, meaning no warnings are printed to the console when starting the test and the created XML file contains entries in the events section.
I configured Open Test reporting it as it is described in the official guide.
Our project uses Gradle with multiple submodules and testFixtures, I am not sure if that is somehow related to the issue.
Am I doing anything wrong probably or is there maybe a bug existing?
This is the full stacktrace:
createResultContentHandler:302, TransformerIdentityImpl (org.apache.xalan.transformer) transform:330, TransformerIdentityImpl (org.apache.xalan.transformer) append:115, DefaultDocumentWriter (org.junit.platform.reporting.shadow.org.opentest4j.reporting.events.api) append:42, DefaultDocumentWriter (org.junit.platform.reporting.shadow.org.opentest4j.reporting.events.api) reportInfrastructure:127, OpenTestReportGeneratingListener (org.junit.platform.reporting.open.xml) testPlanExecutionStarted:114, OpenTestReportGeneratingListener (org.junit.platform.reporting.open.xml) lambda$testPlanExecutionStarted$12:75, CompositeTestExecutionListener (org.junit.platform.launcher.core) accept:-1, 1737729180 (org.junit.platform.launcher.core.CompositeTestExecutionListener$$Lambda$263) lambda$notifyEach$19:95, CompositeTestExecutionListener (org.junit.platform.launcher.core) accept:-1, 1212677653 (org.junit.platform.launcher.core.CompositeTestExecutionListener$$Lambda$265) forEach:1259, ArrayList (java.util) notifyEach:93, CompositeTestExecutionListener (org.junit.platform.launcher.core) testPlanExecutionStarted:75, CompositeTestExecutionListener (org.junit.platform.launcher.core) execute:89, EngineExecutionOrchestrator (org.junit.platform.launcher.core) lambda$execute$0:55, EngineExecutionOrchestrator (org.junit.platform.launcher.core) accept:-1, 1989509342 (org.junit.platform.launcher.core.EngineExecutionOrchestrator$$Lambda$256) withInterceptedStreams:102, EngineExecutionOrchestrator (org.junit.platform.launcher.core) execute:54, EngineExecutionOrchestrator (org.junit.platform.launcher.core) execute:114, DefaultLauncher (org.junit.platform.launcher.core) execute:86, DefaultLauncher (org.junit.platform.launcher.core) execute:86, DefaultLauncherSession$DelegatingLauncher (org.junit.platform.launcher.core) execute:53, SessionPerRequestLauncher (org.junit.platform.launcher.core) processAllTestClasses:99, JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor (org.gradle.api.internal.tasks.testing.junitplatform) access$000:79, JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor (org.gradle.api.internal.tasks.testing.junitplatform) stop:75, JUnitPlatformTestClassProcessor (org.gradle.api.internal.tasks.testing.junitplatform) stop:61, SuiteTestClassProcessor (org.gradle.api.internal.tasks.testing) invoke0:-1, NativeMethodAccessorImpl (sun.reflect) invoke:62, NativeMethodAccessorImpl (sun.reflect) invoke:43, DelegatingMethodAccessorImpl (sun.reflect) invoke:498, Method (java.lang.reflect) dispatch:36, ReflectionDispatch (org.gradle.internal.dispatch) dispatch:24, ReflectionDispatch (org.gradle.internal.dispatch) dispatch:33, ContextClassLoaderDispatch (org.gradle.internal.dispatch) invoke:94, ProxyDispatchAdapter$DispatchingInvocationHandler (org.gradle.internal.dispatch) stop:-1, $Proxy19 (com.sun.proxy) run:193, TestWorker$3 (org.gradle.api.internal.tasks.testing.worker) executeAndMaintainThreadName:129, TestWorker (org.gradle.api.internal.tasks.testing.worker) execute:100, TestWorker (org.gradle.api.internal.tasks.testing.worker) execute:60, TestWorker (org.gradle.api.internal.tasks.testing.worker) execute:56, ActionExecutionWorker (org.gradle.process.internal.worker.child) call:133, SystemApplicationClassLoaderWorker (org.gradle.process.internal.worker.child) call:71, SystemApplicationClassLoaderWorker (org.gradle.process.internal.worker.child) run:69, GradleWorkerMain (worker.org.gradle.process.internal.worker) main:74, GradleWorkerMain (worker.org.gradle.process.internal.worker)
@pandoras-toolbox Which version of Java are you running with?
One of the submodules with tests still has to use Java 8, the other submodules use Java 11. I checked my test setup for "junit5-jupiter-starter-gradle", Java 11 is configured there. So it works with Java 11. And I configured Java 8 for "junit5-jupiter-starter-gradle", that also worked.
I added integration tests for running on Java 8 in https://github.com/junit-team/junit5/commit/e1283332882f7060b4a90e371c9834aec13e0683.
Could you please provide more details? What's the exact Java version you experienced this with? A minimal reproducer would be much appreciated.
It should have been this version:
openjdk version "1.8.0_332" OpenJDK Runtime Environment (Zulu 8.62.0.19-CA-macosx) (build 1.8.0_332-b09) OpenJDK 64-Bit Server VM (Zulu 8.62.0.19-CA-macosx) (build 25.332-b09, mixed mode)
I will try to repeat it and try to provide something reproducable.
@pandoras-toolbox Did you manage to reproduce it?
I can still reproduce it on the actual closed real life source project where I am working on but could not manage to reproduce it otherwise given the time I can spend.
We have a test project which contains several Gradle subprojects inside it and using testFixtures of Gradle and also Allure. One of them is using Java 8, and this is the one which produces the errors mentioned here. Another subproject uses Java 11, but in this subproject no open test reports were generated at all, although I applied the same configuration for open test reports.
I was curious to use it, but given the time I would have to spend in order to make it work in our project and given that it is purely an optional feature, it is not justifiable to do so, I am sorry.
Maybe there is a comorbidity in our Gradle configuration causing this, maybe the new feature is not robust enough to deal with all sorts of Gradle projects. I just skip the feature for now.
Thank you anyway for trying to find a solution.
@pandoras-toolbox Thanks for reporting back. Would it be possible to extract a standalone reproducer project from that real life project?
I can try this, hopefully it can be reproduced without all the things I have to remove for this, but please give me a little time.
If you would like us to be able to process this issue, please provide the requested information. If the information is not provided within the next 3 weeks, we will be unable to proceed and this issue will be closed.
Closing due to lack of requested feedback. If you would like to proceed with your contribution, please provide the requested information and we will re-open this issue.