简体   繁体   中英

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.

   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. I'm Following tutorial Apache Maven Beginner to Guru on udemy.

[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. And you should consult the JUnit manual

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM