diff --git a/Ghpr.Controller.ts/controller/common/localFileSystem/entities/TestRun.ts b/Ghpr.Controller.ts/controller/common/localFileSystem/entities/TestRun.ts index cb40d9fa..aff28f7a 100644 --- a/Ghpr.Controller.ts/controller/common/localFileSystem/entities/TestRun.ts +++ b/Ghpr.Controller.ts/controller/common/localFileSystem/entities/TestRun.ts @@ -8,6 +8,7 @@ class TestRun { name: string; fullName: string; description: string; + duration: number; testInfo: ItemInfo; testStackTrace: string; testMessage: string; diff --git a/Ghpr.Controller.ts/controller/common/localFileSystem/mappers/TestRunDtoMapper.ts b/Ghpr.Controller.ts/controller/common/localFileSystem/mappers/TestRunDtoMapper.ts index 77dedbe3..468204b8 100644 --- a/Ghpr.Controller.ts/controller/common/localFileSystem/mappers/TestRunDtoMapper.ts +++ b/Ghpr.Controller.ts/controller/common/localFileSystem/mappers/TestRunDtoMapper.ts @@ -37,9 +37,13 @@ class TestRunDtoMapper { testRunDto.name = testRun.name; testRunDto.categories = testRun.categories; testRunDto.description = testRun.description; - const diffTime = testRun.testInfo.finish.valueOf() - testRun.testInfo.start.valueOf(); - const diffSecs = Math.round(((diffTime / 1000) + Number.EPSILON) * 100) / 100; - testRunDto.duration = diffSecs; + if (testRun.duration !== undefined && testRun.duration !== 0) { + testRunDto.duration = testRun.duration; + } else { + const diffTime = testRun.testInfo.finish.valueOf() - testRun.testInfo.start.valueOf(); + const diffSecs = Math.round(((diffTime / 1000) + Number.EPSILON) * 100) / 100; + testRunDto.duration = diffSecs; + } testRunDto.events = eventDtos; testRunDto.fullName = testRun.fullName; testRunDto.output = SimpleItemInfoDtoMapper.map(testRun.output); diff --git a/Ghpr.Core.Core/Common/TestRunDto.cs b/Ghpr.Core.Core/Common/TestRunDto.cs index c34ab128..a5b457ba 100644 --- a/Ghpr.Core.Core/Common/TestRunDto.cs +++ b/Ghpr.Core.Core/Common/TestRunDto.cs @@ -24,6 +24,7 @@ public TestRunDto(Guid guid, string name = "", string fullName = "") Start = default(DateTime), Finish = default(DateTime) }; + Duration = .0; Name = name; FullName = fullName; Description = "";