Guys I know I am asking a very silly question, but I am very curious like why my test is not running.
I have created simple maven project(no junits, etc just a simple main class) with one only main class in a test folder and I am trying to execute the same through pom.xml.
I have gone through the existing question's over here but that didn't resolve it
When I try to execute it I got the following output.
Running samplemav.TestOne
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>samplemav</groupId>
<artifactId>samplemav</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<includes>
<include>samplemav.TestOne</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
Java Class
package samplemav;
public class TestOne {
public static void main(String args[]){
System.out.println("test");
}
}
Regards
You may want to use Junit for unit testing.
package samplemav;
import org.junit.Test;
public class TestOne {
@Test
public void test() {
System.out.println("test");
}
}
And add test dependency your pom.xml
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>