src\test\java
*Test.java
test*
我mvn clean test -X -Dtest=*Dumb* -DfailIfNoTests=false
并注意到已经创建了类文件(是的,我尝试了mvn clean test -X
并使用上面的结论来保持简单)。
下面是它打印的类路径(不确定它是如何获得junit * .jar;我的pom没有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
下面是它打印的配置
[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
可悲的是,我得到以下输出
结果:
测试运行:0,失败:0,错误:0,跳过:0
以下是有效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>
我知道我在问琐碎的问题;但我无法弄清楚;谢谢大家。
修改
5:确保其他测试框架(testng / junit)没有开始运行POJO测试
根据Alexy的回答:添加以下
<configuration>
<junitArtifactName>none:none</junitArtifactName>
<testNGArtifactName>none:none</testNGArtifactName>
</configuration>
答案 0 :(得分:1)
假设您的项目只有JUnit 4测试,可能surefire
正在寻找TestNG测试,因为testng
现在位于项目类路径中。
您可以尝试识别运行testng
的{{1}}依赖项,然后将其排除。
您还可以尝试在mvm dependency:tree
插件配置中禁用TestNG支持:
surefire