簡體   English   中英

我的測試沒有在控制台中輸出我正在使用 Maven

[英]My test doesn't output in console I'm using Maven

我是 Maven 的新手,我正在使用 Intellij 面對這種奇怪的東西。

   class HelloWorldTest {

    public void testHello() {
        System.out.println("Test - hello! ");
    }

    public void testWorld() {
        System.out.println("Test - World!");
    }

}

當我在默認生命周期上運行包時,它在測試運行下方顯示輸出:0。測試未運行並在控制台中輸出。 我正在關注 udemy 上的 Apache Maven 初學者教程到 Guru。

[INFO] ------------------< guru.springframework:hello-world >------------------
[INFO] Building hello-world 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (auto-clean) @ hello-world ---
[INFO] Deleting /home/jericho/Documents/spring-projects/hello-world/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello-world ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ hello-world ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/jericho/Documents/spring-projects/hello-world/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello-world ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jericho/Documents/spring-projects/hello-world/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ hello-world ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/jericho/Documents/spring-projects/hello-world/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hello-world ---
[INFO] Surefire report directory: /home/jericho/Documents/spring-projects/hello-world/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

**Tests run: 0, Failures: 0, Errors: 0, Skipped: 0**

[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello-world ---
[INFO] Building jar: /home/jericho/Documents/spring-projects/hello-world/target/hello-world-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.044 s
[INFO] Finished at: 2020-10-10T16:57:23+08:00
[INFO] ------------------------------------------------------------------------

您的測試未運行:

Results :

**Tests run: 0, Failures: 0, Errors: 0, Skipped: 0**

您需要使用@Test 注釋您的測試類。 你應該查閱 JUnit 手冊

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM