This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 244002 - Test results show No tests executed if any System.out.println message starts with "Running"
Summary: Test results show No tests executed if any System.out.println message starts ...
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Test Runner (show other bugs)
Version: 7.4
Hardware: PC Linux
: P2 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-22 16:46 UTC by amanmanglik
Modified: 2014-05-20 02:49 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample test file which fails (1.56 KB, text/x-java)
2014-04-22 16:46 UTC, amanmanglik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description amanmanglik 2014-04-22 16:46:49 UTC
Created attachment 146888 [details]
Sample test file which fails

Hi

I came across this interesting bug. Looks like in the UI but could be deeper.

If any System.out.println("<message>") has a <message> which starts with the word "Running" then the UI shows "No tests executed (0.0s)" after the tests are run.

I saw the issue first on Netbeans 7.4. I thought i might be running into some version issues so i upgraded to 8.0 but it happens in 8.0 too. I saw it on my Maven web project + TestNG combination but may exist for older versions and other project type + test framework combinations too.


Here are the steps to reproduce on 8.0.

1) Create a new Maven Web project.


2) Add TestNG as a dependency. I added the following lines in the pom.xml dependency section

<dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>6.8.8</version>
      <scope>test</scope>
</dependency>


3) Right click on the project Name > New > TestNG Test Case.
(ofcourse, this above can be done through the New.. dialog too). 
This will create a skeleton test.

4) Add the following two methods in the test.


//////// CODE  /////////////
    @Test
    public void hello1() {
        assertEquals(true, true);
        
        System.out.println("A");
        for (int i = 0; i < 2; i++) {
            
            System.out.println("Running some test case" ); // fails
//            System.out.println("some test case"); // works
//            System.out.println(" Running some test case" ); // works - notice the space at start
        }
        
        assertEquals(true, false);

    }
    
    @Test
    public void hello2() {
        assertEquals(true, true);
    }

//////  END CODE ///////////

5) Now right click in the editor > Test File

6) The Test Results Window shows "No tests executed" - BUG!!

7) Now comment the //fails System.out.println() line above and uncomment one of the // works lines and repeat step 5.

8) Now the Test Results window shows the proper GUI results.

9) I am attaching my sample test file for reference. The purpose of hello2() test method is just to show that the error prohibits all the other methods' results to also not show up in addition to the method with the bug causing output statement.
Comment 1 amanmanglik 2014-04-22 17:01:56 UTC
Also there might be related issue with Output capturing of the test in the Test Results window. On Hovering on the passed test in the GUI with a non-"Running" println it says No Output while there are System.out.println() statements in the test method.
Comment 2 Theofanis Oikonomou 2014-05-16 15:10:44 UTC
Changeset: 77fa51c5d7ad
Author:    Theofanis Oikonomou <theofanis@netbeans.org>
Date:      2014-05-16 17:10
Message:
Comment 3 Theofanis Oikonomou 2014-05-16 15:15:21 UTC
The problem was that maven surefire logs info about what test class is running like "Running a.b.c" so I was interpreting such messages as if a new test class was starting to run. I think that now it is fixed. Please try a latest build and reopen if it still happens. Thank you for catching and reporting this.

(In reply to amanmanglik from comment #1)
> Also there might be related issue with Output capturing of the test in the
> Test Results window. On Hovering on the passed test in the GUI with a
> non-"Running" println it says No Output while there are System.out.println()
> statements in the test method.

If a method passes then no output is presented in the Test Results Window. You can always see all the logged messages in the Output window.
Comment 4 Quality Engineering 2014-05-20 02:49:43 UTC
Integrated into 'main-silver', will be available in build *201405200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/77fa51c5d7ad
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Task #244002 - Test results show No tests executed if any System.out.println message starts with "Running"