Bug 135553 - JUnit Shows "No Tests Executed" when tests have been executed
JUnit Shows "No Tests Executed" when tests have been executed
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: JUnit
6.x
PC Windows XP
: P2 (vote)
: 6.x
Assigned To: Marian Petras
junit-issues@java
: I18N
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-21 20:39 UTC by mjr_1974
Modified: 2008-07-17 04:47 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
Logs (506.54 KB, application/octet-stream)
2008-05-29 16:03 UTC, mjr_1974
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mjr_1974 2008-05-21 20:39:59 UTC
The JUnit Test Results window shows "No Tests Executed" (in the summary line, where it usually displays the amount of
tests run/failed/with error) after running them.

Underneath the "No Test Executed" leyend, you the name of the test class can be seen with the status "passed" (on the
right side). If I try to open the tree node, it doesn't show what tests were executed (the tree is empty).

The Output window shows all the logging from the tests, but no summary of how many tests were run/failed/caused errors.

There are several things I noticed that might be useful:

- This happens for some test classes of the project. Others seem to run perfectly fine.
- After those classes that make JUnit fail, I noticed a delay from the moment the tests finished until the "No Test
Executed" leyend shows up.
- The classes that make JUnit fail produce a high amount of logging that's also shown in the JUnit output window. The
delay mentioned in the previous point occurs before all the log information is shown in the output window, and then
almost at the same time the leyend "No Tests Executed" followed by the rest of the logs are displayed.
- If I cancel logging setting the level to Level.OFF the problem doesn't show up, but all my tests that verify logging
obviously fail.

Please let me know if I can help you in any way... For now I'm sutting down logging to keep working, but I don't feel
really confortable by doing that.
Comment 1 Marian Petras 2008-05-23 16:23:08 UTC
I tried to reproduce this bug with a simple test producing a million lines and then failing. It worked!

I used the following source code:

public class SomeJUnitTest extends TestCase {
    
    public SomeJUnitTest(String testName) {
        super(testName);
    }
    
    public void testWithLotsOfLogging() {
        for (int i = 0; i < 1000000; i++) {
            System.out.println("This is some text - just to produce something " + i);
        }
        fail("I wanted it to fail.");
    }

}

Could you run the above test? I suggest that you start with a lower number than million at first, e.g. with 100000.
How many lines of output does your test in question produce (approximately)?
Comment 2 Marian Petras 2008-05-28 09:54:06 UTC
Did you debug the tests? In this case, it might be the same issue as issue #130206 ("Test display incorrect when
debugging tests").
Comment 3 Marian Petras 2008-05-28 09:59:20 UTC
Can you verify that the JVM running the tests finishes regularly (i.e. is not interrupted and does not crash during
execution)?
Comment 4 Marian Petras 2008-05-28 10:19:52 UTC
If you think the JVM running the tests finishes regularly, could you please run NetBeans with the following extra argument?

   -J-Dorg.netbeans.modules.junit.output.JUnitOutputReader.level=300 

Either pass it as an argument for "netbeans.exe" (or "nb.exe") when running NetBeans, or make it permanent by adding it
to file "etc/netbeans.conf" in your NetBeans installation directory.

Then (re)start NetBeans and try to reproduce the bug. The JUnitOutputReader class should produce a detailed log to the
NetBeans' log file (<NB-user-dir>\var\log\messages.log). Please attach the log file to this issue or send it directly to
me. Thank you.
Comment 5 mjr_1974 2008-05-29 16:03:15 UTC
Created attachment 62128 [details]
Logs
Comment 6 Marian Petras 2008-07-04 21:58:48 UTC
I think that I found the cause - it is the thousands-separator used in the statistics line of the output:

    Tests run: 5, Failures: 5, Errors: 0, Time elapsed: 18,557 sec

The JUnit module has a hard-coded expression for matching float-numbers

    FLOAT_NUMBER_REGEX = "[0-9]*(?:\\.[0-9]+)?"

which accepts "18.557" but not "18,557".
Comment 7 Marian Petras 2008-07-16 16:12:33 UTC
Fixed.

Modified files:
   junit/src/org/netbeans/modules/junit/output/JUnitOutputReader.java
   junit/src/org/netbeans/modules/junit/output/RegexpUtils.java

Changeset Id:
b56ac1907fc7
(http://hg.netbeans.org/main/rev/b56ac1907fc7)
Comment 8 Quality Engineering 2008-07-17 04:47:14 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #324 build
Changeset: http://hg.netbeans.org/main/rev/b56ac1907fc7
User: Marian Petras <mpetras@netbeans.org>
Log: fixed bug #135553 - 'JUnit Shows "No Tests Executed" when tests have been executed'


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo