Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-4332

Maven Projects: The "Test Results" pane test output text are get populated with stdout only when test fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 11.3
    • None
    • projects - Maven
    • None
    • Netbeans 11.3
      Maven 3.6.3
      JUnit 4.12
      OpenJDK 11.0.7.10
      Windows 10

    Description

      I am not sure if this is a bug or a configuration issue, but I face a weird behaviour. When running a test that print to stdout, the "Test Results" pane text output area remains empty if the test result is success. On the contrary, when a test is failing the stdout String text is printed normally in "Test Results" pane text output area.

      pom.xml

      <?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>com.mycompany</groupId>
          <artifactId>mavenproject1</artifactId>
          <version>1.0-SNAPSHOT</version>
          <packaging>jar</packaging>
          <dependencies>
              <dependency>
                  <artifactId>junit</artifactId>
                  <groupId>junit</groupId>
                  <version>4.12</version>
                  <scope>test</scope>
              </dependency>
          </dependencies>
          <properties>
              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
              <maven.compiler.source>11</maven.compiler.source>
              <maven.compiler.target>11</maven.compiler.target>
          </properties>
      </project>
      

      A simple class that has a method, which prints a message

      public class HelloWorld {
      
          public String printHelloMessage() {
              return "Hello";
          }
      }
      

      Another simple test class

      public class HelloWorldTest {  
      
          @Test
          public void testPrintHelloMessage() {
              System.out.println("Print out a Message");
              HelloWorld instance = new HelloWorld();
              String expResult = "Hello";
              String result = instance.printHelloMessage();
              assertEquals(expResult, result);
          }
      }
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            konstantinosraptis Konstantinos Raptis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: