Rao.K Rao.K - 28 days ago 12
Java Question

Jenkins build is not picking up and running Unit Test Cases written in SpockFramewok

I have written almost 50 test cases using Spock framework for my java application. When I try to build my application, my spock unit tests are not running. Also build was not showing up any errors related to these test cases.

Here are the test results that are published from Jenkins log :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.201 sec

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

I have the following plug in configuration in my pom.xml

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>


Example Test file name : BusinessApplicationTest.groovy

Any suggestions on how to fix this issue ?

** Update **

Issue got resolved by adding the following gmavenplus plugin.




**Issue got resolved by adding the following gmavenplus plugin.**

> <plugin> <groupId>org.codehaus.gmavenplus</groupId>
> <artifactId>gmavenplus-plugin</artifactId> <version>1.5</version>
> <executions> <execution> <goals> <goal>compile</goal>
> <goal>testCompile</goal> </goals> </execution> </executions> </plugin>




Answer

I had the same issue and the solution given in update section worked for me.