Skip to content

Commit

Permalink
Merge pull request #27 from darrylmelander/hostname
Browse files Browse the repository at this point in the history
testsuite's hostname attribute should be the machine name, not the executor
  • Loading branch information
Siphonophora authored Sep 23, 2020
2 parents 0c11217 + 21692ab commit c4f294f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/JUnit.Xml.TestLogger/JUnitXmlTestLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ private XElement CreateTestSuiteElement(List<TestResultInfo> results)
element.SetAttributeValue("errors", 0); // looks like this isn't supported by .net?
element.SetAttributeValue("time", results.Sum(x => x.Duration.TotalSeconds));
element.SetAttributeValue("timestamp", this.utcStartTime.ToString("s"));
element.SetAttributeValue("hostname", results.First().TestCase.ExecutorUri);
element.SetAttributeValue("hostname", results.First().HostName);
element.SetAttributeValue("id", 0); // we never output multiple, so this is always zero.
element.SetAttributeValue("package", Path.GetFileName(results.First().AssemblyPath));

Expand Down
2 changes: 2 additions & 0 deletions src/JUnit.Xml.TestLogger/TestResultInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public TestResultInfo(

public string AssemblyPath => this.result.TestCase.Source;

public string HostName => this.result.ComputerName;

public string Namespace { get; private set; }

public string Type { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public void TestResultFileShouldContainTestSuiteInformation()

Assert.IsNotNull(node);
Assert.AreEqual("JUnit.Xml.TestLogger.NetCore.Tests.dll", node.Attribute(XName.Get("name")).Value);
Assert.AreEqual("executor://nunit3testexecutor/", node.Attribute(XName.Get("hostname")).Value);
Assert.AreEqual(Environment.MachineName, node.Attribute(XName.Get("hostname")).Value);

Assert.AreEqual("52", node.Attribute(XName.Get("tests")).Value);
Assert.AreEqual("14", node.Attribute(XName.Get("failures")).Value);
Assert.AreEqual("6", node.Attribute(XName.Get("skipped")).Value);
Expand Down

0 comments on commit c4f294f

Please sign in to comment.