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 227358 - Run Focused Test Method always enabled
Summary: Run Focused Test Method always enabled
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Test Runner (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2013-03-12 13:08 UTC by Tomas Mysik
Modified: 2013-08-19 18:33 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed patch (18.90 KB, patch)
2013-06-14 13:45 UTC, Theofanis Oikonomou
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Mysik 2013-03-12 13:08:47 UTC
Run Focused Test Method action is always enabled - that is correct for test files but apparently incorrect for source files (files located underneath Source Packages/Files/...). I guess this action should not be present for such files at all or it should be disabled, at least.

Thanks.

Product Version: NetBeans IDE Dev (Build 20130312-8850981501c6)
Java: 1.6.0_43; Java HotSpot(TM) 64-Bit Server VM 20.14-b01
Runtime: Java(TM) SE Runtime Environment 1.6.0_43-b01
System: Linux version 3.5.0-25-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 1 280Z28 2013-03-27 15:21:54 UTC
Leaving the action enabled substantially improves the performance of the editor context menu throughout the project. If the command cannot be disabled without negatively impacting the display performance, it could stay enabled but should show a message if the user executes it at an unsupported location. Currently it is a silent failure if the command fails.
Comment 2 Tomas Mysik 2013-03-27 15:35:35 UTC
I think that to be correct - I mean to show the action only in test files - is definitely something what should be done, so it would be great if we could fix this issue.

Thanks.
Comment 3 Tomas Mysik 2013-03-27 15:36:30 UTC
BTW I am pretty sure that we have more actions like this one (at least in PHP) and there are no performance issues with them, AFAIK.

Thanks.
Comment 4 Theofanis Oikonomou 2013-06-14 08:09:13 UTC
Fixed: http://hg.netbeans.org/core-main/rev/b7000bb07e9d
Comment 5 Tomas Mysik 2013-06-14 08:43:58 UTC
Your fix will work only for Java, right? Or am I missing something? Reopening...

Thanks.
Comment 6 Tomas Mysik 2013-06-14 08:49:04 UTC
What about to extend API/SPI and ask whether the given file is a test or not? If there is any performance problem with it, the API/SPI client will solve it.

Thanks.
Comment 7 Theofanis Oikonomou 2013-06-14 13:45:19 UTC
Created attachment 135805 [details]
proposed patch
Comment 8 Theofanis Oikonomou 2013-06-14 13:52:53 UTC
(In reply to comment #6)
> What about to extend API/SPI and ask whether the given file is a test or not?
> If there is any performance problem with it, the API/SPI client will solve it.
> 
> Thanks.

Fair enough. I attached a proposed patch to solve this issue. 

AFAICT junit, testng, php.project and groovy.support are among the clients that override TestMethodDebuggerProvider/TestMethodRunnerProvider. I added appropriate implementations to those clients. I am not sure about com.sun.tools.tuxedo.testrunner and this is why the newly added method isTestClass is not abstract.

Please review the new api and client implementations. Thank you
Comment 9 Quality Engineering 2013-06-15 03:03:41 UTC
Integrated into 'main-golden', will be available in build *201306142301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b7000bb07e9d
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: #227358 - Run Focused Test Method always enabled
Comment 10 Tomas Mysik 2013-06-17 05:22:17 UTC
Patch seems to be fine to me, thanks for it. Also, IMHO it is totally OK to add a method with default implementation (especially for friend API).

Thanks.
Comment 11 Theofanis Oikonomou 2013-06-20 08:03:41 UTC
If there are no objections I will integrate tomorrow. Thank you for your comments.
Comment 12 Theofanis Oikonomou 2013-06-21 08:44:43 UTC
Thank you for the review. Fixed: http://hg.netbeans.org/core-main/rev/2da01d30c58b
Comment 13 Theofanis Oikonomou 2013-06-21 08:50:11 UTC
increasing spec version in php: http://hg.netbeans.org/core-main/rev/8f909b5e0c89
Comment 14 Quality Engineering 2013-06-25 02:44:34 UTC
Integrated into 'main-golden', will be available in build *201306242301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2da01d30c58b
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: #227358 - Run Focused Test Method always enabled
Comment 15 almson 2013-08-19 18:33:42 UTC
I am dissatisfied with this hack as I explained in bug 232519

Please find a more elegant way of detecting whether a Java source file is in Test Packages.