Skip to content

Commit

Permalink
[Harness] Add start-time to work around a bug in the publishing tool.
Browse files Browse the repository at this point in the history
The publishing tool is a little fragile. In run
https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3490479&view=logs&j=67d14776-f827-5fe4-2625-2db4b5987fd1&t=fa262eec-9d97-5ba4-b4cc-a9292beecd8f
I noticed that valid test runs with a failing test (launch issues) were
not being uploaded.

I found out that the reason is a flaw in the logic on the parser of the
publishing tool. The tool assumes, that if there is no start-time, there
are no test results (do remember that NUnitV3 is schemaless we don't
know exactly what attrs are compulsory).

The culprint is line: https://dev.azure.com/mseng/AzureDevOps/_git/AzureDevOps?path=%2FTa%2FTasks%2FPublishTestResults%2FParser%2FNUnitResultParser.cs&version=GBmaster&line=473&lineEnd=473&lineStartColumn=63&lineEndColumn=64&lineStyle=plain

Basically:

```csharp
 if (testRunNode?.Attributes?["start-time"] != null) {
   // import test data
 }

 // do nothing interesting since there is no data
```

This commit fixes it by setting the start time as the current one, we
dont care since it is a failure xml result.
  • Loading branch information
mandel-macaque committed Feb 21, 2020
1 parent 44bd2c8 commit 9fd1c2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/xharness/XmlResultParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ static void GenerateNUnitV3Failure (XmlWriter writer, string title, string messa
("inconclusive", "0"),
("skipped", "0"),
("asserts", "1"),
("date", XmlConvert.ToString (DateTime.Now, "yyyy-MM-dd"))
("run-date", XmlConvert.ToString (DateTime.Now, "yyyy-MM-dd")),
("start-time", DateTime.Now.ToString ("HH:mm:ss"))
);
writer.WriteStartElement ("test-suite");
writer.WriteAttributeString ("type", "Assembly");
Expand Down

0 comments on commit 9fd1c2d

Please sign in to comment.