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.
If you execute tests by "Test" popup menu on the project node and you also have at least one failed tests then test results window is not shown by default and focus is given to Output tab. Steps: - Create couple tests one of them failing - Execute them by invoking 'Test' on project node You will see that Output tab is shown instead of test results.
*** Bug 186275 has been marked as a duplicate of this bug. ***
When we do have failed tests the corresponding ant build is set as failed. Seems that during 6.9 the behavior of output window has changed and now it always activates the tab with ANT output in case of failure. Seems that the most logical fix would be to set ignore.failing.tests property to true when running tests from IDE to prevent failing of ANT build.
Created attachment 99167 [details] A patch for the bug 186277 Proposed patch fixes this bug with minimal changes and risks. Nevertheless, it also changes the class org.apache.tools.ant.module.run.TargetExecutor in the Ant module (o.apache.tools.ant.module). Hence, the peer review of the Ant module owner is required additionally to the process specified here http://wiki.netbeans.org/NB69HighResistance
FYI Here is specification: http://ui.netbeans.org/docs/ui/progress_indication/progress_indication_spec.html#5_behaviour_of_tasks Unfortunately, the specification doesn't take into account this case, i.e. when two "output" windows are shown. BTW In this case, an appropriate "output" window is the "Test Results", and usual "Output" window is only secondary view of results.
Hi Jesse, could you please take a look at Victor's patch ? It's touching o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java
Seems that the change in behavior is caused by the fix from 2010-04-02 of issue 162159 [1]: 'displayed' variable is not set to true by the call of interestingOutputCallback.run(), that's why the output is activated at the very end of ant build. [1]http://hg.netbeans.org/main/rev/66582d893086
Is this really a P1 bug? The stack trace from the failed test continues to be displayed, and the Test window is still easily available. (If you even want it at all; see bug #118772.) Also note that you can disable Always Show Output if you prefer to see Ant output unconditionally for builds. The root bug may actually be something I have noticed in the past few months but did not yet get to filing: stack traces are displayed in Ant output at the end of the test suite rather than at the end of the test case. Therefore the OW is focused after the Test Results window gets notification of the error. This may be a problem in <junit> rather than the IDE. Might be possible to work around this in the junit module by focusing this window at the end of a test suite, but I'm not sure about the details. (In reply to comment #2) > Seems that during 6.9 the behavior of output window has changed and now it > always activates the tab with Ant output in case of failure. This was the traditional behavior, that was accidentally broken for a release or two. > Seems that the most logical fix would be to set ignore.failing.tests property > to true when running tests from IDE to prevent failing of Ant build. I would agree with this approach. You can verify that it would work by adding ignore.failing.tests=true to private.properties. The test targets should by default fail if tests fail, by the principle of least surprise and under the assumption that exit code is being used to control further actions; but any container which interprets test results directly (a CI server like Hudson, an IDE like NetBeans) should set this flag. Note that the Hudson integration already does so when creating jobs for NB projects. (In reply to comment #3) > Proposed patch [...] changes the class > org.apache.tools.ant.module.run.TargetExecutor This seems an unnecessary hack in light of comment #2.
(In reply to comment #7) >Might be possible to work >around this in the junit module by focusing this window at the end of a test >suite, but I'm not sure about the details. This is for sure the best solution, unfortunately it's unclear on how to implement it other than by patch from comment #3 as 'build finished' happens after test suite completion. So ignore.failing.tests=true seems to be a straightforward way, I would only put it into Tools->Options->Miscellaneous->Ant->Properties instead of private.properties. In this case it would work for all Ant based projects (Maven projects are not affected as output is shown by default).
(In reply to comment #8) > So ignore.failing.tests=true seems to be a straightforward way, I would only > put it into Tools->Options->Miscellaneous->Ant->Properties Not a good idea. This could affect any Ant build, even of a freeform project which depends on failed tests preventing a deploy! Also it assumes that every project type uses this exact property name. Rather, j2seproject and similar project types should pass this property to test-related targets in their ActionProvider impl, and JavaRunnerImpl should be made to not record a build failure in case of test failures (if not already the case).
I'm afraid I'm in the middle of a laptop switch so it is impossible to prepare a tested patch or anything, but the general idea: 1. java.source.ant/src/org/netbeans/modules/java/source/ant/resources/junit-snippet.xml and java.source.ant/src/org/netbeans/modules/java/source/ant/resources/junit-debug-snippet.xml already look OK, just needs to be tested. 2. java.j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl uses ignore.failing.tests, so java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java should modify getTargetNames for COMMAND_*TEST* to call p.setProperty("ignore.failing.tests", "true"). 3. Something similar to #2 needs to happen at least for web.project and j2ee.*project.
Thanks Jesse. With this idea the changes in action providers will touch all Java projects, Web projects and J2EE projects. The change is low-risk but I would not do it right prior to RC1. *Likely* the proper solution should be implemented which should transfer the focus to test results window after the build completion, likely together with issue #118772 So I suggest to downgrade this to P2, relnote, and do not fix for 6.9. Motivation: - No data loss and user can easily switch tabs to access test results window. - Workaround exist: add ignore.failing.tests into private.properties or ant properties. Marian, are you OK with downgrading this to P2 (filed after cut-off) ?
> Marian, are you OK with downgrading this to P2 (filed after cut-off) ? no problem, I am marking as 69patch candidate, so we'll fix it into patch once we will know it will be released.
Thanks. Set target to the .Next.
Please report on progress, especially if you can make it into 6.9.1, if not please consider removing 6.9.1_CANDIDATE keyword. Thanks, -R
Removing 6.9.1_CANDIDATE keyword. Not critical in terms of functionality.
Fixed in the main (changeset: 0f4915ddb3df).
Integrated into 'main-golden', will be available in build *201008190001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/0f4915ddb3df User: Andrey Yamkovoy <kaktus@netbeans.org> Log: Fix for #186277 - REGRESSION: Focus is not given to the test results if ANT output has not been opened