You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2019/10/10 07:22:36 UTC

[Bug 63827] New: LegacyXmlResultFormatter of JUnitLauncher Task does not write StackTrace of failure

https://bz.apache.org/bugzilla/show_bug.cgi?id=63827

            Bug ID: 63827
           Summary: LegacyXmlResultFormatter of JUnitLauncher Task does
                    not write StackTrace of failure
           Product: Ant
           Version: 1.10.7
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Optional Tasks
          Assignee: notifications@ant.apache.org
          Reporter: mseele@guh-software.de
  Target Milestone: ---

Switching from JUnit 4 to JUnit 5 we detected that LegacyXmlResultFormatter
does not write the StackTrace of a failure into the xml. Only the message is
stored.
Which makes troubleshooting very hard on failed tests.

Please see JUnit 5 code here:
https://github.com/apache/ant/blob/26b8a01e6421d22a2ca4393ab1420444b07a0bfd/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyXmlResultFormatter.java#L279

This is how the JUnit 4 code does it:
https://github.com/apache/ant/blob/3a4980e3c4be56745964442abc01360b618e3a85/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java#L316

final String strace = JUnitTestRunner.getFilteredTrace(t);
final Text trace = doc.createTextNode(strace);
nested.appendChild(trace);

These tree lines are missing in LegacyXmlResultFormatter for JUnit5.

I can add a patch for this if desired!?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63827] LegacyXmlResultFormatter of JUnitLauncher Task does not write StackTrace of failure

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63827

--- Comment #3 from mseele@guh-software.de ---
Great :)

Just one question, why using "cause.get()" when "t" is already a final variable
(of "cause.get()")?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63827] LegacyXmlResultFormatter of JUnitLauncher Task does not write StackTrace of failure

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63827

--- Comment #1 from mseele@guh-software.de ---
Created attachment 36816
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36816&action=edit
Patch which adds Stacktrace to failures & abortions (without filtering the
stacktrace)

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63827] LegacyXmlResultFormatter of JUnitLauncher Task does not write StackTrace of failure

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63827

Jaikiran Pai <ja...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |1.10.8
                 OS|                            |All

--- Comment #2 from Jaikiran Pai <ja...@apache.org> ---
Hello mseele, I actually pushed a commit a few minutes before I saw you upload
this patch. I see that I missed the "aborted" section. I have now pushed
another commit to fix that too. Thank you for reporting this issue as well as
taking time to create a patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63827] LegacyXmlResultFormatter of JUnitLauncher Task does not write StackTrace of failure

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63827

--- Comment #4 from Jaikiran Pai <ja...@apache.org> ---
> Just one question, why using "cause.get()" when "t" is already a final variable (of "cause.get()")?

Because working on too many unrelated things and not focusing enough for a
"simple fix" :) You are right though, we can just use "t" there. I'll probably
get to it later.

-- 
You are receiving this mail because:
You are the assignee for the bug.