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.
Build: NetBeans IDE 7.1 (Build 201112071828) VM: Java HotSpot(TM) 64-Bit Server VM, 21.0-b17, Java(TM) SE Runtime Environment, 1.7.0-b147 OS: Windows 7 User Comments: ricktw: try to run one single test method using the right mouse button option menu. Stacktrace: java.lang.IllegalArgumentException: run.single.method at org.netbeans.modules.ant.freeform.LookupMergerImpl$ActionProviderImpl.invokeAction(LookupMergerImpl.java:137) at org.netbeans.modules.junit.actions.TestMethodAction$1.run(TestMethodAction.java:104) at org.netbeans.modules.progress.ui.RunOffEDTImpl$1.run(RunOffEDTImpl.java:151) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1411) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1991)
Created attachment 114986 [details] stacktrace
Not sure what is going on here, and cannot reproduce. Either nbproject/project.xml binds run.single.method or it does not. The only thing I can think of is a race condition between when TestMethodAction.performAction calls ap.getSupportedActions or ap.isActionEnabled and when it calls ap.invokeAction, during which time the binding is removed. That could be solved by quietly returning from iAE/iA rather than throwing IAE (probably best done as an API change in ActionProvider), but this seems an unlikely explanation. The only other clue is [Fatal Error] :1:1: Content is not allowed in prolog. which suggests a parse error in project.xml. BTW ant.freeform should probably be using LookupProviderSupport.createActionProviderMerger rather than using its own implementation.
I've did some research and found a workaround. The reason this error occurs is because there is no action names "run.single.method" in project.xml. This is what I did to get "run Focused test" to work: 1) create new "run.single.method" action in project.xml file (copy "run.single" action and change target). === project.xml EXAMPLE === <action name="run.single.method"> <script>nbproject/ide-file-targets.xml</script> <target>run.single.method</target> <context> <property>run.class</property> <folder>test/src</folder> <pattern>\.java$</pattern> <format>java-name</format> <arity> <one-file-only/> </arity> </context> </action> ========================== 2) create new "run.single.method" target in ide-file-targets.xml (copy "run-selected-file-in-src") and make sure the test tag has a parameter "methods" using the property "${method}". === ide-file-targets.xml EXAMPLE === <target name="run.single.method" depends="compile"> <fail unless="run.class">Must set property 'run.class'</fail> <junit maxmemory="256m" fork="true" haltonerror="true" haltonfailure="true" printsummary="on" jvm="${jdk.dir}/bin/java" showoutput="true"> <sysproperty key="build.basedir" value="${basedir}"/> <test name="${run.class}" methods="${method}"/> <formatter type="plain" usefile="false"/> <classpath refid="CLASSPATH"/> </junit> </target> ==================================== Now you can use the right mouse menu "Run focused test". Maybe these actions/targets can be automatically created in the two files mentioned above? - Rick
(In reply to comment #3) > The reason this error occurs is because there is no action names > "run.single.method" in project.xml. I do not think that is it. If there is no such action name in project.xml, Run Focused Test should simply be disabled, not throw an error. That was what I observed in a sample freeform project with no such action binding (from JDK demos). > Maybe these actions/targets can be automatically created in the two files > mentioned above? Sure, that would be a useful RFE, but this bug is separate.
Reported for 7.3.x or earlier, no new info since then -> closing as worksforme, please reopen in case you see it.