title: How to troubleshoot @SpringBootTest leading to "No tests found for given includes"?
body: <p>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.</p>
  
  <p>Initially, the test cases from <a href="https://github.com/orange-cloudfoundry/osb-cmdb-spike/blob/5ca777827b6a2ae7bb7468f9e09fbdc88bba2e5c/spring-cloud-app-broker-integration-tests/src/test/java/org.springframework.cloud.appbroker/integration/CreateServiceKeyBindingComponentTest.java#L46" rel="nofollow noreferrer">CreateServiceKeyBindingComponentTest</a> are detected properly by idea 2019.3/gradle 6.0.1/junit 5.5.2/springboot 2.2.4, and properly execute.</p>
  
  <p>With some additional beans loaded in the context, see <a href="https://github.com/orange-cloudfoundry/osb-cmdb-spike/commit/33ead9bdfcfb2a873164117647924f356a9477d1#diff-3be56f55f7e43f84ad994213dc6c0466" rel="nofollow noreferrer">diff</a> from <a href="https://github.com/orange-cloudfoundry/osb-cmdb-spike/commit/33ead9bdfcfb2a873164117647924f356a9477d1" rel="nofollow noreferrer">commit 33ead9</a>, the test suprisingly fails with the following message, and no detected test case</p>
  
  <pre><code>&gt; Task :spring-cloud-app-broker-integration-tests:testClasses UP-TO-DATE
  &gt; 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'.
  &gt; No tests found for given includes: [org.springframework.cloud.appbroker.integration.CreateServiceKeyBindingComponentTest](filter.includeTestsMatching)
  </code></pre>
  
  <p><strong>What troubleshooting steps can be used in gradle/junit/springboot-context  to fix such unexpected "No tests found" symptom ?</strong></p>
  
  <p>This looks similar to <a href="https://stackoverflow.com/questions/56110026/springboottest-resulting-in-no-tests-found-for-given-includes">@SpringBootTest resulting in &#39;No tests found for given includes&#39;</a> which did not provide diagnostics</p>
  
  <p>I tried the following approaches without luck</p>
  
  <p>0- intellij stop and checking no gradle daemon was still running, before restarting intellij</p>
  
  <p>1- specifying <code>--debug</code> in gradle argument to get debug output did not provide useful logs</p>
  
  <pre><code>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] &lt;/event&gt;&lt;/ijLog&gt;
  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
  </code></pre>
  
  <p>2- trying to naively display springboot verbose log using logback did not produce further logs (see <a href="https://github.com/spring-cloud/spring-cloud-app-broker/commit/5ca777827b6a2ae7bb7468f9e09fbdc88bba2e5c#diff-68de24eb9f8f8b0ffba9235296af049f" rel="nofollow noreferrer">full diff</a>)</p>
  
  <pre><code>    &lt;logger name="org.springframework.test.context.junit.jupiter" level="debug" /&gt;
      &lt;logger name="org.springframework.boot.test" level="debug" /&gt;
  </code></pre>
  
  <p>3- trying to run the test with intellij instead of gradle leads to no further output (see related <a href="https://stackoverflow.com/questions/55405441/intelij-2019-1-update-breaks-junit-tests">Intelij 2019.1 update breaks JUnit tests</a>)</p>
  
  <pre><code>java ... com.intellij.rt.execution.application.AppMainV2 com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 org.springframework.cloud.appbroker.integration.CreateServiceKeyBindingComponentTest
  ##teamcity[enteredTheMatrix]
  ##teamcity[treeEnded]
  </code></pre>
  
  <p>Full list of other diagnostics considered in <a href="https://github.com/orange-cloudfoundry/osb-cmdb-spike/blob/service-binding-params/osb-cmdb/TODO.md" rel="nofollow noreferrer">log file</a> along with associated <a href="https://github.com/orange-cloudfoundry/osb-cmdb-spike/commits/service-binding-params" rel="nofollow noreferrer">commits</a></p>
  
  <hr>
  
  <p>EDIT </p>
  
  <p>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 :-(</p>
  
  <p>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:</p>
  
  <p>0- the update of springboot/junit/gradle in <a href="https://github.com/orange-cloudfoundry/osb-cmdb-spike/commit/d9fda3ee65f33d1481d0e59e9fab318cf7f16307" rel="nofollow noreferrer">commit d9fda3</a> which would not have properly be reloaded by intellij/gradle daemon</p>
  
  <p>1- passing the <code>--scan</code> option to the gradle build (which produces a <a href="https://guides.gradle.org/creating-build-scans/" rel="nofollow noreferrer">build scan</a>)</p>
  
  <blockquote>
    <p>A build scan is a shareable and centralized record of a build that provides insights into what happened and why.</p>
  </blockquote>
  
  <p>2- turning on the intellij <a href="https://www.jetbrains.com/help/idea/2019.3/run-debug-gradle.html?utm_campaign=IU&amp;utm_content=2019.3&amp;utm_medium=link&amp;utm_source=product#" rel="nofollow noreferrer">Enable Gradle script debugging</a> option</p>
  
  <p>3- run the gradle build within Idea debugger by hitting "Debug" on the gradle   configuration</p>
  
  <p>4- stopping the gradle daemon with <code>./gradlew --stop</code></p>
  
  <pre><code>
  </code></pre>