Skip to content

Commit

Permalink
Merge pull request #14 from soul4soul/parse-test-times
Browse files Browse the repository at this point in the history
Parse and assign start time and end time for Nunit tests
  • Loading branch information
anshooarora authored Aug 18, 2019
2 parents 06879e9 + 26e4f36 commit ea9eff6
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public NUnitParser(ExtentReports extent)
public void ParseTestRunnerOutput(string resultsFile)
{
var doc = XDocument.Load(resultsFile);
DateTime timeStampParsed;

if (doc.Root == null)
{
Expand Down Expand Up @@ -70,6 +71,17 @@ public void ParseTestRunnerOutput(string resultsFile)

AssignStatusAndMessage(tc, node);
AssignTags(tc, node);

if (tc.Attribute("start-time") != null)
{
DateTime.TryParse(tc.Attribute("start-time").Value, out timeStampParsed);
node.Model.StartTime = timeStampParsed;
}
if (tc.Attribute("end-time") != null)
{
DateTime.TryParse(tc.Attribute("end-time").Value, out timeStampParsed);
node.Model.EndTime = timeStampParsed;
}
}
}
}
Expand Down

0 comments on commit ea9eff6

Please sign in to comment.