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 208105 - Unable to debug TestNG tests
Summary: Unable to debug TestNG tests
Status: RESOLVED DUPLICATE of bug 208841
Alias: None
Product: java
Classification: Unclassified
Component: TestNG (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P2 normal with 1 vote (vote)
Assignee: Lukas Jungmann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-06 19:46 UTC by _ gtzabari
Modified: 2012-04-19 15:33 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2012-02-06 19:46:10 UTC
Product Version: NetBeans IDE Dev (Build 201202010600)
Java: 1.7.0_02; Java HotSpot(TM) 64-Bit Server VM 22.0-b10
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\Gili\.netbeans\dev
Cache directory: C:\Users\Gili\.netbeans\dev\var\cache

1) Open the project found at http://bbs.darktech.org/TestNG.zip
2) Place a breakpoint at org.pill.JavaCompilerTest
3) Hit CTRL+SHIFT+F6
4) Notice debugger does not hit breakpoint
5) Netbeans outputs:

Testsuite: org.pill.JavaCompilerTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.1 sec

Testcase: initializationError(org.pill.JavaCompilerTest):	Caused an ERROR
No runnable methods
java.lang.Exception: No runnable methods
	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)

6) This leads me to believe that the testcase is run (not in debug mode) and then JUnit is fired against the same class and complains it can't find any tests.
Comment 1 Lukas Jungmann 2012-02-07 13:27:00 UTC
reproduced, you're right. In this case global debugging actions do not work.

OTOH there are provided 2 possible workarounds for now:

-use custom TestNG -> Debug (= Debug Focused  Test) or -> TestNG -> Debug Test Class (same as CTRL+SHIFT+F6) actions available in java editor's context menu

-add <import file="nbproject/testng-impl.xml"/> to project's build script before <import file="nbproject/build-impl.xml"/> - this case global debugging actions and shortcuts (such as CTRL+SHIFT+F6) will work (http://hg.netbeans.org/main/contrib/rev/b4619fb1e7af)

as this is something which simply has to work => P2 (given there are workarounds available)

basic problem here is that projects' test debugging targets are not extensible and there's no simple way to override them with current NetBeans APIs (-debug-start-debuggee-test is the culprit here)

tentative solution for pre-7.2 (7 and 7.1.x) will most likely be to ask user to allow direct modification of build.xml by inserting <import file="nbproject/testng-impl.xml"/> before other imports there

solution for 7.2 will depend on testng author(s) (wrt accepting patch provided there) and eventually on broader agreement between other NetBeans teams (mainly java se, java ee, mobility?, core?, others?) - more about this will be available on the wiki by the end of this week
Comment 2 Lukas Jungmann 2012-04-18 23:10:16 UTC
already part of the IDE...
Comment 3 Jesse Glick 2012-04-19 15:33:01 UTC

*** This bug has been marked as a duplicate of bug 208841 ***