0
我有一個來自maven任務的調用單元測試的問題。我pom.xml
:如何運行測試maven?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>FizzBuzzTDDKata</groupId>
<artifactId>FizzBuzzTDDKata</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit/junit5-engine -->
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit5-engine</artifactId>
<version>5.0.0-ALPHA</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
我想補充一些根據教程<scope>
財產,但仍當我嘗試使用mvn clean install
或「MVN測試」我:
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.950s
[INFO] Finished at: Fri Apr 14 16:12:32 CEST 2017
[INFO] Final Memory: 11M/184M
[INFO] ------------------------------------------------------------------------
我使用的IntelliJ IDEA 2016年2月5日Ultimate和每個Maven任務都作爲Intellij中的運行配置運行。我究竟做錯了什麼?我應該添加一些其他的依賴關係,建立到pom.xml
?
不幸的是,這也幫不了我。 – Ice
我知道的一個常見問題是,Test類沒有被命名爲* Test.java或Test * .java。你是怎麼命名的? –
測試類被命名爲'FizzBuzzTest.java'。 – Ice