Skip to content

Commit

Permalink
Fix JUnitXmlReporter
Browse files Browse the repository at this point in the history
  • Loading branch information
nowsprinting committed Nov 16, 2024
1 parent f64a310 commit f1420b4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Runtime/Reporters/JUnitXmlReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ internal static string GetOutputPath(string outputPathField, Arguments args = nu
internal static XElement CreateTestCase(string name, float time, string message, string stackTrace,
ExitCode exitCode)
{
message = message ?? string.Empty;
stackTrace = stackTrace ?? string.Empty;

var element = new XElement("testcase",
new XAttribute("name", name),
new XAttribute("classname", "DeNA.Anjin.Autopilot"),
Expand All @@ -116,13 +119,18 @@ internal static XElement CreateTestCase(string name, float time, string message,
new XCData(stackTrace)));
break;
case ExitCode.AutopilotFailed:
case ExitCode.AutopilotLifespanExpired:
element.Add(new XElement("failure",
new XAttribute("message", message),
new XAttribute("type", exitCode.ToString()),
new XCData(stackTrace)));
break;
default:
throw new ArgumentOutOfRangeException(nameof(exitCode), exitCode, null);
element.Add(new XElement("failure",
new XAttribute("message", message),
new XAttribute("type", (int)exitCode),
new XCData(stackTrace)));
break;
}

return element;
Expand Down

0 comments on commit f1420b4

Please sign in to comment.