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 137191 - Add constants for execution/debugging of a single test method
Summary: Add constants for execution/debugging of a single test method
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Milos Kleint
Depends on: 160649
Blocks: 72080
  Show dependency tree
Reported: 2008-06-13 17:35 UTC by Marian Petras
Modified: 2009-03-19 14:30 UTC (History)
0 users

See Also:
Exception Reporter:

diff of the suggested changes (4.99 KB, patch)
2008-06-13 17:38 UTC, Marian Petras
Details | Diff
updated diff of the suggested changes (mostly in apichanges.xml) (8.00 KB, patch)
2008-06-13 18:34 UTC, Marian Petras
Details | Diff
updated diff of the suggested changes (SingleMethod is now top-level) (9.08 KB, patch)
2008-07-09 21:38 UTC, Marian Petras
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Petras 2008-06-13 17:35:47 UTC
This is an API change suggestion. The suggested change would extend the set of symbolic names for commands specified in
class org.netbeans.spi.project.ActionProvider. The suggested new commands are:

    COMMAND_TEST_SINGLE_METHOD ......... for running one test method/function
    COMMAND_DEBUG_TEST_SINGLE_METHOD ... for running one test method/function in debugger

Because there must be a way to specify the method/function to be executed, I also suggest that one more constant would
be added:

    LOOKUP_ITEM_ID_METHOD_NAME ......... Id of the lookup item holding identification of test method/function
                                         that should be run by the above commands

The goal of these changes is to provide an API that would allow implementation of action "run single test method", as
requested in issue #72080 ("Would be nice to have a way to run one testXXX method").
Comment 1 Marian Petras 2008-06-13 17:38:23 UTC
Created attachment 62823 [details]
diff of the suggested changes
Comment 2 Marian Petras 2008-06-13 18:19:53 UTC
I wrote a wiki page about the suggested API change:
Comment 3 Marian Petras 2008-06-13 18:34:25 UTC
Created attachment 62825 [details]
updated diff of the suggested changes (mostly in apichanges.xml)
Comment 4 Jesse Glick 2008-06-13 21:11:24 UTC
[JG01] As mentioned on nbdev, I am -1 on the proposed use of Much clearer and simpler to specify what
object in the context will define the method name. If that needs to be a new struct class defined in the same place as
the new command constants, fine. Simplest would be to just add to some package:

public final class SingleMethod {
  public SingleMethod(/*?*/FileObject file, String name);
  public FileObject getFile();
  public String getName();
  public static final String COMMAND_ETC = "...";

which keeps the command names and the struct itself conveniently together.
Comment 5 Marian Petras 2008-07-09 17:58:37 UTC
OK, I decided to go the way you suggested.

public interface ActionProvider {


    public static final class SingleMethod {
        private FileObject file;
        private String methodName;
        public SingleMethod(FileObject file, String methodName) {
            this.file = file;
            this.methodName = methodName;
        public FileObject getFile() { return file; }
        public String getMethodName() { return methodName; }
        public static final String COMMAND_RUN_SINGLE_METHOD = "run.single.method";
        public static final String COMMAND_DEBUG_SINGLE_METHOD = "debug.single.method";
        public boolean equals(Object obj) { /*...*/ }
        public int hashCode() { /*...*/ }
    /* comments and checks of values are stripped */


Is it OK?
Comment 6 Jesse Glick 2008-07-09 18:08:44 UTC
Seems straightforward and clear. Instances of the new class would be placed in the Lookup context instead of raw
FileObject or DataObject, correct?

[JG02] Probably prefer for it to be a top-level class (generally we discourage public nested classes in APIs), with a
@see from ActionProvider.
Comment 7 Marian Petras 2008-07-09 18:22:52 UTC
instead of raw FileObject or DataObject, correct? ... YES

re [JG02] ... OK, I will make it a top-level class (in package org.netbeans.spi.project)

I will prepare a complete patch (with changes to, apichanges, etc.) and attach it here.
Comment 8 Marian Petras 2008-07-09 21:38:27 UTC
Created attachment 64209 [details]
updated diff of the suggested changes (SingleMethod is now top-level)
Comment 9 Marian Petras 2008-07-10 12:35:07 UTC
Committed, pushed.

Changeset Id:

New and modified files:
    projectapi/src/org/netbeans/spi/project/   (new)
Comment 10 Quality Engineering 2008-07-10 15:46:09 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #311 build
User: Marian Petras <>
Log: API change - added class SingleMethod for support of execution of a single method (issue #137191)