I am trying to split my tests using Junit categories for Jenkins. I read all the guides online and did the following.
- Created an interface
public interface regression {}
- Added annotation to test
@Category(regression.class)
@Test
public void myTest(){}
- Added the group to POM.XML
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<properties>
<property>
<name>listener</name>
<value>test_listener.TestListener</value>
</property>
</properties>
<groups>categories.regression</groups>
</configuration>
</plugin>
I wrote the following terminal:
mvn clean test -Dtest=categories.regression
and received this error message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project automation: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]