Skip to content
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

java.lang.IllegalStateException: Unexpected test organization for test Case: TestIdentifier #287

Open
Tych7 opened this issue Jul 4, 2024 · 0 comments

Comments

@Tych7
Copy link

Tych7 commented Jul 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant