无法让'mvn test'运行测试

时间:2015-09-24 11:16:49

标签: maven intellij-idea junit automation pom.xml

出于某种原因,有时我不知道,当我创建一个新的Test项目(我使用IntelliJ + Maven模块)时,我使用相同的pom文件和一些目前在另一个项目中工作的插件,但是当我运行命令行

mvn test

它不会运行我编写的JUnit测试方法。我不知道出了什么问题,它说:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building n26 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ n26 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ n26 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ n26 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Automation\NewHomePage\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ n26 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\Automation\NewHomePage\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ n26 ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.713 s
[INFO] Finished at: 2015-09-24T13:02:50+02:00
[INFO] Final Memory: 19M/306M
[INFO] ------------------------------------------------------------------------

通常,它会在之后执行测试,但有时会在此处停止。

1 个答案:

答案 0 :(得分:0)

@wemu谢谢,我命名我的文件是xxxTests.java,命名约定是xxxTest.java。它有效,谢谢