title: Unable to execute groovy test files in Springboot application
body: <p>I have created a sample <code>SpringBoot</code> application for writing unit-tests using <code>Spock</code> framework. Below are the files.</p>
  
  <p><strong>Calculator.Java</strong></p>
  
  <pre><code>public class Calculator {
     @Autowired
     Addition addition;
  
     public int calculate(int a, int b, String choice) {
        return addition.add(a, b);
     }
  }
  </code></pre>
  
  <p>I have created test-class using Junit as below, its working fine</p>
  
  <p><strong>CalculatorTest.java</strong></p>
  
  <pre><code>@SpringBootTest
  public class CalculatorTest {
  
     @Mock
     Addition addition;
  
     @InjectMocks
     Calculator cal;
  
     @Test
     public void testCal() {
       when(addition.add(2, 3)).thenReturn(8);
       int value = cal.calculate(2, 3, "add");
       assertEquals(8, value);
     }
  }
  </code></pre>
  
  <p>But I need to write unit-test using <code>Spock Framework</code>, So I created groovy files and added corresponding <code>dependencies</code> and <code>plugins</code> in the <code>pom.xml</code>. when I run <code>mvn clean install</code> to build the application. Under <code>TESTS</code> I can see only <code>CalculatorTest.java</code> execution but not able to see <code>CalculatorGroovyTest.groovy</code> file's execution.</p>
  
  <p><strong>CalculatorGroovyTest.groovy</strong></p>
  
  <pre><code>@SpringBootTest
  class CalculatorGroovyTest extends Specification{
  
     @Mock
     Addition addition;
  
     @InjectMocks
     Calculator cal;
  
     def "Callator test method"(){
         given:
             addition.add(5, 8) --&gt; 9;
         when:
             int val = cal.calculate(5, 8, "add");
         then:
             val == 9;
     }
  }
  </code></pre>
  
  <p>Below are the dependencies and Plugins which I added in my pom.</p>
  
  <p><strong>Dependencies</strong></p>
  
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;org.spockframework&lt;/groupId&gt;
          &lt;artifactId&gt;spock-core&lt;/artifactId&gt;
          &lt;version&gt;1.3-groovy-2.5&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;
          &lt;artifactId&gt;groovy-all&lt;/artifactId&gt;
          &lt;version&gt;2.4.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.spockframework&lt;/groupId&gt;
          &lt;artifactId&gt;spock-guice&lt;/artifactId&gt;
          &lt;version&gt;1.0-groovy-2.4&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>PlugIns</strong></p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;useFile&gt;false&lt;/useFile&gt;
                  &lt;includes&gt;
                      &lt;include&gt;**/*Spec.groovy&lt;/include&gt;
                      &lt;include&gt;**/*Test.groovy&lt;/include&gt;
                      &lt;include&gt;**/*Test.java&lt;/include&gt;
                  &lt;/includes&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.gmavenplus&lt;/groupId&gt;
              &lt;artifactId&gt;gmavenplus-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.4&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;compile&lt;/goal&gt;
                          &lt;goal&gt;testCompile&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                  &lt;testSources&gt;
                      &lt;testSource&gt;
                          &lt;directory&gt;${project.basedir}/src/test/java&lt;/directory&gt;
                          &lt;includes&gt;
                              &lt;include&gt;**/*.groovy&lt;/include&gt;
                          &lt;/includes&gt;
                      &lt;/testSource&gt;
                  &lt;/testSources&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p><strong>NOTE:</strong> I am not getting any errors and getting Build Success after maven build</p>
  
  <p><strong>I am not Sure Why it is not considering <code>groovy</code>files for Unit-Testing</strong></p>