bazel-contrib / bazel-contrib/rules_jvm
java.lang.IllegalStateException: Unexpected test organization for test Case: TestIdentifier
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 54
- Forks
- 98
- Avg merge
- 6d 2h
- Merged PRs (30d)
- 7
Description
I am currently using your java_junit5_test to set up Cucumber/Gherkin test that are build using Bazel. Although the tests operate like they should, they both give me a warning displayed in the strack trace below:
$ bazel test //... --test_output=all
INFO: Analyzed 2 targets (0 packages loaded, 0 targets configured).
INFO: From Testing //:calculator_test:
==================== Test output for //:calculator_test:
Jul 04, 2024 2:04:29 PM com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener matchTestCasesToSuites_locked
WARNING: Unexpected test organization for TestIdentifier [uniqueId = [engine:junit-platform-suite]/[suite:hellocucumber.RunCucumberTest]/[engine:cucumber]/[feature:classpath%3Ahellocucumber%2FCalculator.feature]/[scenario:3]/[examples:10]/[example:12], parentId = [engine:junit-platform-suite]/[suite:hellocucumber.RunCucumberTest]/[engine:cucumber]/[feature:classpath%3Ahellocucumber%2FCalculator.feature]/[scenario:3]/[examples:10], displayName = 'Example #1.1', legacyReportingName = 'Example #1.1', source = ClasspathResourceSource [classpathResourceName = 'hellocucumber/Calculator.feature', filePosition = FilePosition [line = 12, column = 5]], tags = [], type = TEST]
Jul 04, 2024 2:04:29 PM org.junit.platform.launcher.core.CompositeTestExecutionListener lambda$notifyEach$19
WARNING: TestExecutionListener [com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener] threw exception for method: executionFinished(TestIdentifier [uniqueId = [engine:junit-platform-suite], parentId = null, displayName = 'JUnit Platform Suite', legacyReportingName = 'JUnit Platform Suite', source = null, tags = [], type = CONTAINER], TestExecutionResult [status = SUCCESSFUL, throwable = null])
java.lang.IllegalStateException: Unexpected test organization for test Case: TestIdentifier [uniqueId = [engine:junit-platform-suite]/[suite:hellocucumber.RunCucumberTest]/[engine:cucumber]/[feature:classpath%3Ahellocucumber%2FCalculator.feature]/[scenario:3]/[examples:10]/[example:12], parentId = [engine:junit-platform-suite]/[suite:hellocucumber.RunCucumberTest]/[engine:cucumber]/[feature:classpath%3Ahellocucumber%2FCalculator.feature]/[scenario:3]/[examples:10], displayName = 'Example #1.1', legacyReportingName = 'Example #1.1', source = ClasspathResourceSource [classpathResourceName = 'hellocucumber/Calculator.feature', filePosition = FilePosition [line = 12, column = 5]], tags = [], type = TEST]
at com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener.matchTestCasesToSuites_locked(BazelJUnitOutputListener.java:139)
at com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener.output(BazelJUnitOutputListener.java:204)
at com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener.outputIfTestRootIsComplete(BazelJUnitOutputListener.java:197)
at com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener.executionFinished(BazelJUnitOutputListener.java:189)
at org.junit.platform.launcher.core.CompositeTestExecutionListener.lambda$executionFinished$10(CompositeTestExecutionListener.java:69)
at org.junit.platform.launcher.core.CompositeTestExecutionListener.lambda$notifyEach$19(CompositeTestExecutionListener.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.launcher.core.CompositeTestExecutionListener.notifyEach(CompositeTestExecutionListener.java:93)
at org.junit.platform.launcher.core.CompositeTestExecutionListener.executionFinished(CompositeTestExecutionListener.java:69)
at org.junit.platform.launcher.core.ExecutionListenerAdapter.executionFinished(ExecutionListenerAdapter.java:56)
at org.junit.platform.launcher.core.DelegatingEngineExecutionListener.executionFinished(DelegatingEngineExecutionListener.java:46)
at org.junit.platform.launcher.core.OutcomeDelayingEngineExecutionListener.reportEngineOutcome(OutcomeDelayingEngineExecutionListener.java:69)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at com.github.bazel_contrib.contrib_rules_jvm.junit5.ActualRunner.run(ActualRunner.java:121)
at com.github.bazel_contrib.contrib_rules_jvm.junit5.JUnit5Runner.main(JUnit5Runner.java:39)
Failures: 0
================================================================================
INFO: Found 2 test targets...
INFO: Elapsed time: 4.029s, Critical Path: 1.89s
INFO: 3 processes: 1 internal, 2 linux-sandbox.
INFO: Build completed successfully, 3 total actions
PASSED: //:friday_test (see /home/tycho/.cache/bazel/_bazel_tycho/6a0935b69a66316620b388686b51b4d5/execroot/_main/bazel-out/k8-fastbuild/testlogs/friday_test/test.log)
INFO: From Testing //:friday_test
==================== Test output for //:friday_test:
Jul 04, 2024 1:53:12 PM com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener matchTestCasesToSuites_locked
WARNING: Unexpected test organization for TestIdentifier [uniqueId = [engine:junit-platform-suite]/[suite:hellocucumber.RunCucumberTest]/[engine:cucumber]/[feature:classpath%3Ahellocucumber%2FFriday.feature]/[scenario:3]/[examples:8]/[example:16], parentId = [engine:junit-platform-suite]/[suite:hellocucumber.RunCucumberTest]/[engine:cucumber]/[feature:classpath%3Ahellocucumber%2FFriday.feature]/[scenario:3]/[examples:8], displayName = 'Example #1.7', legacyReportingName = 'Example #1.7', source = ClasspathResourceSource [classpathResourceName = 'hellocucumber/Friday.feature', filePosition = FilePosition [line = 16, column = 5]], tags = [], type = TEST]
Jul 04, 2024 1:53:12 PM org.junit.platform.launcher.core.CompositeTestExecutionListener lambda$notifyEach$19
WARNING: TestExecutionListener [com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener] threw exception for method: executionFinished(TestIdentifier [uniqueId = [engine:junit-platform-suite], parentId = null, displayName = 'JUnit Platform Suite', legacyReportingName = 'JUnit Platform Suite', source = null, tags = [], type = CONTAINER], TestExecutionResult [status = SUCCESSFUL, throwable = null])
java.lang.IllegalStateException: Unexpected test organization for test Case: TestIdentifier [uniqueId = [engine:junit-platform-suite]/[suite:hellocucumber.RunCucumberTest]/[engine:cucumber]/[feature:classpath%3Ahellocucumber%2FFriday.feature]/[scenario:3]/[examples:8]/[example:16], parentId = [engine:junit-platform-suite]/[suite:hellocucumber.RunCucumberTest]/[engine:cucumber]/[feature:classpath%3Ahellocucumber%2FFriday.feature]/[scenario:3]/[examples:8], displayName = 'Example #1.7', legacyReportingName = 'Example #1.7', source = ClasspathResourceSource [classpathResourceName = 'hellocucumber/Friday.feature', filePosition = FilePosition [line = 16, column = 5]], tags = [], type = TEST]
at com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener.matchTestCasesToSuites_locked(BazelJUnitOutputListener.java:139)
at com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener.output(BazelJUnitOutputListener.java:204)
at com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener.outputIfTestRootIsComplete(BazelJUnitOutputListener.java:197)
at com.github.bazel_contrib.contrib_rules_jvm.junit5.BazelJUnitOutputListener.executionFinished(BazelJUnitOutputListener.java:189)
at org.junit.platform.launcher.core.CompositeTestExecutionListener.lambda$executionFinished$10(CompositeTestExecutionListener.java:69)
at org.junit.platform.launcher.core.CompositeTestExecutionListener.lambda$notifyEach$19(CompositeTestExecutionListener.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.launcher.core.CompositeTestExecutionListener.notifyEach(CompositeTestExecutionListener.java:93)
at org.junit.platform.launcher.core.CompositeTestExecutionListener.executionFinished(CompositeTestExecutionListener.java:69)
at org.junit.platform.launcher.core.ExecutionListenerAdapter.executionFinished(ExecutionListenerAdapter.java:56)
at org.junit.platform.launcher.core.DelegatingEngineExecutionListener.executionFinished(DelegatingEngineExecutionListener.java:46)
at org.junit.platform.launcher.core.OutcomeDelayingEngineExecutionListener.reportEngineOutcome(OutcomeDelayingEngineExecutionListener.java:69)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at com.github.bazel_contrib.contrib_rules_jvm.junit5.ActualRunner.run(ActualRunner.java:121)
at com.github.bazel_contrib.contrib_rules_jvm.junit5.JUnit5Runner.main(JUnit5Runner.java:39)
Failures: 0
================================================================================
//:friday_test (cached) PASSED in 1.7s
//:calculator_test PASSED in 1.8s
Executed 1 out of 2 tests: 2 tests pass.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
The MCVE that has been build in this project can be found in this github repo: https://github.com/Tych7/junit5_bazel_java_test
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the warning with bazel test //... --test_output=all using the linked MCVE. Start at BazelJUnitOutputListener.java:139 and follow output and executionFinished; done means the Cucumber/Gherkin tests still pass without the unexpected test-organization warning or exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100