I'm working on a SpringBoot test which fails to launch any test case apparently as a side effect of the springboot context being modified with additional beans.
Initially, the test cases from CreateServiceKeyBindingComponentTest are detected properly by idea 2019.3/gradle 6.0.1/junit 5.5.2/springboot 2.2.4, and properly execute.
With some additional beans loaded in the context, see diff from commit 33ead9, the test suprisingly fails with the following message, and no detected test case
> Task :spring-cloud-app-broker-integration-tests:testClasses UP-TO-DATE
> Task :spring-cloud-app-broker-integration-tests:test FAILED
Test result: SUCCESS
Test summary: 0 tests, 0 succeeded, 0 failed, 0 skipped
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':spring-cloud-app-broker-integration-tests:test'.
> No tests found for given includes: [org.springframework.cloud.appbroker.integration.CreateServiceKeyBindingComponentTest](filter.includeTestsMatching)
What troubleshooting steps can be used in gradle/junit/springboot-context to fix such unexpected "No tests found" symptom ?
This looks similar to @SpringBootTest resulting in 'No tests found for given includes' which did not provide diagnostics
I tried the following approaches without luck
0- intellij stop and checking no gradle daemon was still running, before restarting intellij
1- specifying --debug in gradle argument to get debug output did not provide useful logs
2020-03-11T18:07:07.042+0100 [DEBUG] [TestEventLogger] Gradle Test Run :spring-cloud-app-broker-integration-tests:test STARTED
2020-03-11T18:07:07.052+0100 [QUIET] [system.out]
2020-03-11T18:07:07.052+0100 [QUIET] [system.out] Test result: SUCCESS
2020-03-11T18:07:07.052+0100 [QUIET] [system.out] Test summary: 0 tests, 0 succeeded, 0 failed, 0 skipped
2020-03-11T18:07:07.052+0100 [QUIET] [system.out]
2020-03-11T18:07:07.053+0100 [QUIET] [system.out] </event></ijLog>
2020-03-11T18:07:07.053+0100 [DEBUG] [TestEventLogger]
2020-03-11T18:07:07.053+0100 [DEBUG] [TestEventLogger] Gradle Test Run :spring-cloud-app-broker-integration-tests:test PASSED
2- trying to naively display springboot verbose log using logback did not produce further logs (see full diff)
<logger name="org.springframework.test.context.junit.jupiter" level="debug" />
<logger name="org.springframework.boot.test" level="debug" />
3- trying to run the test with intellij instead of gradle leads to no further output (see related Intelij 2019.1 update breaks JUnit tests)
java ... com.intellij.rt.execution.application.AppMainV2 com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 org.springframework.cloud.appbroker.integration.CreateServiceKeyBindingComponentTest
##teamcity[enteredTheMatrix]
##teamcity[treeEnded]
Full list of other diagnostics considered in log file along with associated commits
EDIT
The "no tests found..." error suddenly disappeared after being consistently being reproductible by adding/removing the offending beans in the spring context. I'm unable to reproduce it anymore nor to clearly identify what fixed it in my environment :-(
Here are in between steps that I ran even through they seem unrelated and I don't explain how they could have influenced/fixed the issue:
0- the update of springboot/junit/gradle in commit d9fda3 which would not have properly be reloaded by intellij/gradle daemon
1- passing the --scan option to the gradle build (which produces a build scan)
A build scan is a shareable and centralized record of a build that provides insights into what happened and why.
2- turning on the intellij Enable Gradle script debugging option
3- run the gradle build within Idea debugger by hitting "Debug" on the gradle configuration
4- stopping the gradle daemon with ./gradlew --stop