Skip to content

Commit

Permalink
Merge pull request #35 from thj-dk/bugfix/time-decimal-culture
Browse files Browse the repository at this point in the history
Serialize time decimals using invariant culture (always use period as decimal separator)
  • Loading branch information
Siphonophora authored May 25, 2021
2 parents 276a1cd + d44af9a commit 2b21a9f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/JUnit.Xml.TestLogger/JunitXmlSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private XElement CreateTestSuiteElement(List<TestResultInfo> results, TestRunCon
element.SetAttributeValue("skipped", results.Where(x => x.Outcome == TestOutcome.Skipped).Count());
element.SetAttributeValue("failures", results.Where(x => x.Outcome == TestOutcome.Failed).Count());
element.SetAttributeValue("errors", 0); // looks like this isn't supported by .net?
element.SetAttributeValue("time", results.Sum(x => x.Duration.TotalSeconds));
element.SetAttributeValue("time", results.Sum(x => x.Duration.TotalSeconds).ToString(CultureInfo.InvariantCulture));
element.SetAttributeValue("timestamp", runConfiguration.StartTime.ToString("s"));
element.SetAttributeValue("hostname", Environment.MachineName);
element.SetAttributeValue("id", 0); // we never output multiple, so this is always zero.
Expand Down Expand Up @@ -268,7 +268,7 @@ private XElement CreateTestCaseElement(TestResultInfo result)
// seconds should be low enough it won't interfere with anyone monitoring test duration.
testcaseElement.SetAttributeValue(
"time",
Math.Max(0.0000001f, result.Duration.TotalSeconds).ToString("0.0000000"));
Math.Max(0.0000001f, result.Duration.TotalSeconds).ToString("0.0000000", CultureInfo.InvariantCulture));

if (result.Outcome == TestOutcome.Failed)
{
Expand Down

0 comments on commit 2b21a9f

Please sign in to comment.