0
由於某些原因,我不知道,有時候,當我創建一個新的Test項目(我使用IntelliJ + Maven模塊)時,我使用了一些與插件相同的pom文件目前在另一個項目中工作,但後來當我運行命令行時無法獲得'mvn test'運行測試
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] ------------------------------------------------------------------------
通常情況下,它會之後執行測試,但有時它停止在這裏。
您的測試方法是否註釋了@ @ Test? – Tunaki
測試由神火-插件執行的,它有它解釋爲測試類的文件的命名約定:https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#包括 - 你的測試類與他們相匹配嗎?否則你需要配置它。 – wemu
@Tunaki,是的,我的測試有註釋「@Test」 – Ragnarsson