简体   繁体   English

我的测试没有在控制台中输出我正在使用 Maven

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

I'm new to Maven and Im facing this kind of of weird stuff Im using Intellij.我是 Maven 的新手,我正在使用 Intellij 面对这种奇怪的东西。

   class HelloWorldTest {

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

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

}

When I run package on Default Lifecycle It show's output below Test run: 0. The test isn't running and output in console.当我在默认生命周期上运行包时,它在测试运行下方显示输出:0。测试未运行并在控制台中输出。 I'm Following tutorial Apache Maven Beginner to Guru on udemy.我正在关注 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] ------------------------------------------------------------------------

Your test didn't run:您的测试未运行:

Results :

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

You need to annotate your test class with @Test.您需要使用@Test 注释您的测试类。 And you should consult the JUnit manual你应该查阅 JUnit 手册

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的单元测试一直显示 NullPointerException? 我正在使用@BeforeClass,但它似乎不起作用 - Why does my Unit Test keep saying NullPointerException? I'm using @BeforeClass and it doesn't seem to work 我无法在 Maven 中使用 mvn test 运行我的测试 - I can´t run my tests using mvn test in Maven 如果我在 Maven 测试中根本没有使用 hamcrest,为什么我会得到 NoClassDefFound org/hamcrest/SelfDescribing? - Why am I getting NoClassDefFound org/hamcrest/SelfDescribing if I'm not using hamcrest at all in my Maven test? Maven在构建时没有找到我的测试测试类 - Maven doesn't find my test test classes when building 我无法在FOP流程中捕获Java的控制台输出,并且我的所有流程均无法正常运行 - I can't capture the console output from Java in FOP process and all my process it doesn't work 我的测试正在运行,然后我单击“运行为--&gt; Maven clean”,现在当我单击“运行为--&gt; Maven 测试”时,它不再起作用 - My tests were running and then I clicked “Run as --> Maven clean” and now when I click “Run as --> Maven test” it doesn't work anymore 我正在创建一个 spigot 插件,我的测试服务器上显示的配置文件与 Intellij 中的配置文件不匹配 - I'm creating a spigot plugin, and the config file that appears on my test server doesn't match the one in Intellij 为什么我的 shell 脚本的输出没有在控制台中打印出来? - Why does the output of my shell script doesn't print in console? 为什么我的猜数字游戏没有向控制台输出任何信息? - Why doesn't my number guessing game output anything to the console? 使用maven控制台与m2eclipse - Using maven console with m2eclipse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM