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.
I cannot profile a unit test suite with NB 6.5 and 6.7 RC1. I can do "Profile file" on a unit test class, but with a suite I get: init: profile-init: deps-jar: compile-single: profile-single: Profiler Agent: Waiting for connection on port 5140, timeout 10 seconds (Protocol version: 9) Profiler Agent: Established local connection with the tool java.lang.NoClassDefFoundError: com/apag/p2plus/p2businessevaluation/P2businessevaluationSuite Caused by: java.lang.ClassNotFoundException: com.apag.p2plus.p2businessevaluation.P2businessevaluationSuite at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Profiler Agent: Connection with agent closed Could not find the main class: com.apag.p2plus.p2businessevaluation.P2businessevaluationSuite. Program will exit. Profiler Agent: Connection with agent closed Profiler Agent: Initializing... Profiler Agent: Options: >D:\Program Files\NetBeans 6.7 RC1\profiler3\lib,5140,10< Profiler Agent: Initialized succesfully Exception in thread "main" Java Result: 1 BUILD SUCCESSFUL (total time: 3 seconds) The Profile | Profile Other | Profile Test for [classname] action of course does not help, because a suite has no corresponding "normal" class. Attaching ide.log drom NB 6.7 RC1.
Created attachment 83214 [details] ide log
Are you deploying your project to an application server. If yes then which one? Could you describe your setup closer? I tried to reproduce the problem on a J2SE project but without success. It either works (for JUnit3 suite) or informs the user abut the fact that the operation is not supported (for JUnit4 suite).
No, it's a J2SE project and we are using JUnit 3. Should I attach the project (without sources)?
That would be perfect!
Created attachment 83294 [details] Project files
I can not reproduce it whatever I do. If you try the same action with a new userdir and/or project, does it happen?
Product Version: NetBeans IDE 6.7 RC2 (Build 200906042131) Java: 1.6.0_14; Java HotSpot(TM) Client VM 14.0-b16 System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb) Wasn't able to reproduce, profiling JUnit 3.x suite works fine for me. The attached project doesn't help - there are no sources, no tests, just missing dependencies on external modules.
I have made a full working repro. Just do "Profile file" on the SampleSuite class. Attaching the repro...
Created attachment 83316 [details] Full working repro
Regarding new user dir: It does not work with NB 6.5 and it does not work with NB 6.7 RC1 with new user dir.
Thanks Thomas, thanks for the project. I was able to reproduce and identify the problem. The root cause is a main method in your test suite. It gets confused with a normal class and mixes up classpaths. The easy workaround is to remove the main method and add the tests to the suite in its constructor instead. A test suite generated by IDE works fine and the problematic case is pretty easy to workaround so I am lowering the priority.
Fixed. Added few additional conditions for "profile as test" action - http://hg.netbeans.org/profiler-main/rev/b5a4968c630a
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/b5a4968c630a User: Jaroslav Bachorik <yardus@netbeans.org> Log: #166561: Cannot profile unit test suites