File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/vstest.console/Internal Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -909,6 +909,20 @@ public MinimalTestResult(TestResult testResult)
909909 Outcome = testResult . Outcome ;
910910 StartTime = testResult . StartTime ;
911911 EndTime = testResult . EndTime ;
912+
913+ // When the test framework (e.g. xUnit 2.x.x) does not report start or end time
914+ // we assign it to UTC now when constructing the test result. But that does not
915+ // work for our logger, because we take the earliest StartTime and oldest EndTime
916+ // to calculate the duration and this makes the first test to be "missing" from the
917+ // duration.
918+ //
919+ // Instead we subtract the duration to get a more accurate result. We also
920+ // don't compare the times for equality because the times in the TestResult are assigned
921+ // on two different lines so they don't have to be the same.
922+ if ( EndTime - StartTime < testResult . Duration )
923+ {
924+ StartTime = EndTime - testResult . Duration ;
925+ }
912926 }
913927
914928 public TestCase TestCase { get ; }
You can’t perform that action at this time.
0 commit comments