Reputation: 955
strangely, this was working few weeks ago and my changes messed up working tree. I feel like I am asking obvious question (that was answered many times on this site), but going no where after spending several hours on late friday and ran out of ideas.
src\test\java
*Test.java
test*
I do mvn clean test -X -Dtest=*Dumb* -DfailIfNoTests=false
and notice that class files are created (yes I tried mvn clean test -X
and settled with above to keep it simple).
Below is classpath it prints (not sure how it got junit*.jar; my pom doesnt have junit)
[DEBUG] test(compact) classpath: test-classes classes classes harmonia-timeseries-0.0.1-SNAPSHOT.jar gwt-servlet-2.6.1.jar gwtquery-1.3.3.jar junit-4.11.jar hamcrest-core-1.3.jar gxt-3.1.0.jar validation-api-1.0.0.GA-sources.jar gxt-theme-neptune-3.1.0.jar gxt-chart-3.1.0.jar httpclient-4.3.3.jar httpcore-4.3.2.jar commons-codec-1.6.jar json-20140107.jar gwt-elemental-2.6.1.jar gwt-user-2.6.1.jar json-simple-1.1.jar kafka_2.10-0.8.1.jar metrics-annotation-2.2.0.jar metrics-core-2.2.0.jar snappy-java-1.0.5.jar zookeeper-3.3.4.jar jline-0.9.94.jar jopt-simple-3.2.jar scala-library-2.10.1.jar zkclient-0.3.jar drools-core-5.5.0.Final.jar mvel2-2.1.3.Final.jar knowledge-api-5.5.0.Final.jar knowledge-internal-api-5.5.0.Final.jar drools-compiler-5.5.0.Final.jar antlr-runtime-3.3.jar antlr-3.3.jar stringtemplate-3.2.1.jar antlr-2.7.7.jar ecj-3.5.1.jar xstream-1.4.1.jar xmlpull-1.1.3.1.jar xpp3_min-1.1.4c.jar commons-email-1.3.2.jar mail-1.4.5.jar activation-1.1.1.jar joda-time-2.3.jar guava-17.0.jar jcabi-xml-0.8.1.jar jcabi-immutable-1.1.jar commons-collections-3.2.1.jar commons-jxpath-1.3.jar commons-beanutils-1.9.1.jar commons-logging-1.1.1.jar commons-configuration-1.10.jar commons-lang-2.6.jar jsoup-1.7.3.jar sigar-1.6.4.129.jar jcabi-aspects-0.12.jar jcabi-log-0.7.jar hibernate-validator-4.3.0.Final.jar jboss-logging-3.1.0.CR2.jar validation-api-1.1.0.Final.jar aspectjrt-1.6.12.jar slf4j-api-1.6.4.jar slf4j-log4j12-1.6.4.jar log4j-1.2.17.jar lombok-1.12.4.jar
[DEBUG] provider(compact) classpath: surefire-junit4-2.17.jar surefire-api-2.17.jar
Below is the configuration it prints
[DEBUG] (s) reportFormat = brief
[DEBUG] (s) reportsDirectory =
C:\**\target\surefire-reports
[DEBUG] (f) reuseForks = true
[DEBUG] (s) runOrder = filesystem
[DEBUG] (s) skip = false
[DEBUG] (s) skipTests = false
[DEBUG] (s) test = *Dumb*
[DEBUG] (s) testClassesDirectory =
C:\*\target\test-classes
[DEBUG] (s) testFailureIgnore = false
[DEBUG] (s) testNGArtifactName = org.testng:testng
[DEBUG] (s) testSourceDirectory =
C:\*\src\test\java
[DEBUG] (s) threadCountClasses = 0
[DEBUG] (s) threadCountMethods = 0
[DEBUG] (s) threadCountSuites = 0
[DEBUG] (s) trimStackTrace = true
[DEBUG] (s) useFile = true
[DEBUG] (s) useManifestOnlyJar = true
[DEBUG] (s) useSystemClassLoader = true
[DEBUG] (s) useUnlimitedThreads = false
[DEBUG] (s) workingDirectory = C:\*\ashore
Sadly, I get the following output
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Below is the plugin from effective pom
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<property>
<name>printSummary</name>
<value>true</value>
</property>
</configuration>
</execution>
</executions>
<configuration>
<property>
<name>printSummary</name>
<value>true</value>
</property>
</configuration>
</plugin>
<plugin>
I know I am asking trivial question; but I cant figure out; thanks folks.
EDIT
5: Ensure other test frameworks (testng/junit) are not getting on your way to run POJO tests
Based on Alexy's answer: added following
<configuration>
<junitArtifactName>none:none</junitArtifactName>
<testNGArtifactName>none:none</testNGArtifactName>
</configuration>
Upvotes: 0
Views: 744
Reputation: 10853
Assuming that your project has only JUnit 4 tests, it could be that surefire
is looking for TestNG tests instead because testng
is now in the project class path.
You can try to identify the testng
dependency running mvm dependency:tree
and then exclude it.
You can also try disable TestNG support in the surefire
plugin configuration:
<configuration>
<testNGArtifactName>none:none</testNGArtifactName>
</configuration>
Upvotes: 1