Created attachment 122694 [details]
Screenshot with sample
When i double click on a junit test failure in the "test result" window then the test source is opened at
ACTUAL: the incorrect line, at the line of @Test
EXPECTED: the correct line, where the fail/assertEquals/assertTrue... failed
See screenshot to see what i expect.
It seemed to worked previously as being fixed in http://netbeans.org/bugzilla/show_bug.cgi?id=163986.
Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.6.0_30; Java HotSpot(TM) 64-Bit Server VM 20.5-b03
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)
Error is caused by #163986
Created attachment 123631 [details]
Proposed patch for junit-module / working patch based on main
If you double-click on the "testAdd Failed:..." node then you should jump to the start of the test method (line 42). On the other hand if you double-click on the "at de.foo. ... .java:52" node then you should jump to the cause of the failure at line 52.
This is the expected behaviour and since it seems to be the case for you I am closing the bug.
(In reply to comment #3)
> This is the expected behaviour and since it seems to be the case for you I am
> closing the bug.
Yes, it is the current behaviour i described. BUT not the requested - more useful - one.
I try to explain in more detail.
When tests fail then the result list looks like
+ testA successful
+ testB failed: expected 5 but was 8
+ testC failed: expected true but was false
+ testD successful
When i double-click at the node "testB failed: ..." then
ACTUAL: it jumps to the start of the test-method
EXPECTED: it jumps to the cause of the failure (where the assertion failure "5 but was 8" comes from and that is the line i want to start my "why does the test fails investigation")
I understand what you are saying. I am not sure though if what you are proposing as the expected behaviour is the way to go. Petr any comments on this? Anyway, I believe this is not a defect. Thank you
Created attachment 127049 [details]
Proposed patch for junit- and maven.junit-module
I rewrote the patch. Please review!
* When doubleclicking at a failed MethodNode then the stracktrace-analyse-logic (from http://netbeans.org/bugzilla/show_bug.cgi?id=213935) is used to open the correct line (new behaviour).
* When doubleclicking at a passed MethodNode then the line of the testMethod will be focused (works as before).
* junit and maven.junit have to be patched (TODO: support testng)
In the next commit I will attach two sample projects with JUnit3+4 testcases (JavaApp and MavenJavaApp) so you can easily test the behaviour manually.
Created attachment 127050 [details]
Sample projects for testing
Created attachment 130936 [details]
patching junit, maven.junit and testng
Created attachment 130937 [details]
ant/maven junit/testng projects
I think the patch from comment 8 is much simpler. Please apply the proposed patch and verify that it works as expected for you using the supplied projects. Thank you
(In reply to comment #9)
> Created attachment 130937 [details]
> ant/maven junit/testng projects
> I think the patch from comment 8 is much simpler. Please apply the proposed
> patch and verify that it works as expected for you using the supplied projects.
> Thank you
You are right. Your patch looks easier AND works as expected! Thanks.
Author: Theofanis Oikonomou <email@example.com>
Date: 2013-02-11 15:57
Issue #216334 - Patch for: Double-click on a failing testcase method should open the line with the failing assertation within the testfile
Integrated into 'main-golden', will be available in build *201302122300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Theofanis Oikonomou <firstname.lastname@example.org>
Log: Issue #216334 - Patch for: Double-click on a failing testcase method should open the line with the failing assertation within the testfile