Permalink
Browse files

Include stack trace for nunit setup failures

  • Loading branch information...
timabell committed Dec 15, 2015
1 parent e33f1d0 commit 3c20823dac0666fe904c223bb762964c8b00520d
Showing with 18 additions and 5 deletions.
  1. +18 −5 ReportUnit/Parser/NUnit.cs
View
@@ -108,11 +108,24 @@ public Report Parse(string resultsFile)
? ts.Attribute("end-time").Value
: "";
- // any error messages or stack-trace
- testSuite.StatusMessage =
- ts.Element("failure") != null
- ? ts.Element("failure").Element("message").Value
- : "";
+ // any error messages and/or stack-trace
+ var failure = ts.Element("failure");
+ if (failure != null)
+ {
+ var message = failure.Element("message");
+ if (message != null)
+ {
+ testSuite.StatusMessage = message.Value;
+ }
+
+ var stackTrace = failure.Element("stack-trace");
+ if (stackTrace != null && !string.IsNullOrWhiteSpace(stackTrace.Value))
+ {
+ testSuite.StatusMessage = string.Format(
+ "{0}\n\nStack trace:\n{1}", testSuite.StatusMessage, stackTrace.Value);
+ }
+ }
+
// Test Cases
ts.Descendants("test-case").AsParallel().ToList().ForEach(tc =>

0 comments on commit 3c20823

Please sign in to comment.