JamesD
JamesD

Reputation: 719

Maven surefire plugin doesn't run our Unit test case

Apache Maven 3.5.2 - the pom.xml doesn't declare the surefire plugin explicitly, but the effective pom.xml shows 2.18.1

When I run 'mvn test' - it ends successfully, it doesn't say that it can't find any test cases, but there is no trace of the test cases. This is all I see:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpreadSheetUploadWeb 1.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.fasterxml.jackson.core:jackson-databind:jar:1.9.10 is missing, no dependency information available
[WARNING] The POM for com.fasterxml.jackson.core:jackson-annotations:jar:1.9.10 is missing, no dependency information available
[WARNING] The POM for com.fasterxml.jackson.core:jackson-core:jar:1.9.10 is missing, no dependency information available
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ SpreadSheetUploadWeb ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 22 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ SpreadSheetUploadWeb ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ SpreadSheetUploadWeb ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ SpreadSheetUploadWeb ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ SpreadSheetUploadWeb ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

My pom.xml has jar specified, and my test case is in:

c:/SpreadSheetUploadWeb/src/test/java/com/ibm/cio/cloud/cost/spreadsheet/dao/UnitTestJdbcCostSpreadsheetDAO.java

It works perfectly when I run test explicitly like this:

mvn surefire:test -Dtest=UnitTestJdbcCostSpreadsheetDAO.java

Why won't it run when I just run: mvn test ?

Upvotes: 0

Views: 505

Answers (1)

Warley Noleto
Warley Noleto

Reputation: 573

By default surefire search for files following this patterns:

**/Test*.java

**/*Test.java

**/*Tests.java

**/*TestCase.java

http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

Upvotes: 1

Related Questions