From 344c004299422c4576febbd354569bb94a020a46 Mon Sep 17 00:00:00 2001 From: benbierens Date: Fri, 21 Jul 2023 09:20:28 +0200 Subject: [PATCH] Adds test duration to status log --- DistTestCore/DistTest.cs | 6 ++++-- Logging/StatusLog.cs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/DistTestCore/DistTest.cs b/DistTestCore/DistTest.cs index 9f4dc1e6..3560d5d0 100644 --- a/DistTestCore/DistTest.cs +++ b/DistTestCore/DistTest.cs @@ -200,8 +200,10 @@ namespace DistTestCore private void DisposeTestLifecycle() { var lifecycle = Get(); - fixtureLog.Log($"{GetCurrentTestName()} = {GetTestResult()} ({lifecycle.GetTestDuration()})"); - statusLog.ConcludeTest(GetTestResult()); + var testResult = GetTestResult(); + var testDuration = lifecycle.GetTestDuration(); + fixtureLog.Log($"{GetCurrentTestName()} = {testResult} ({testDuration})"); + statusLog.ConcludeTest(testResult, testDuration); Stopwatch.Measure(fixtureLog, $"Teardown for {GetCurrentTestName()}", () => { lifecycle.Log.EndTest(); diff --git a/Logging/StatusLog.cs b/Logging/StatusLog.cs index 09130234..740a5646 100644 --- a/Logging/StatusLog.cs +++ b/Logging/StatusLog.cs @@ -16,7 +16,7 @@ namespace Logging this.codexId = codexId; } - public void ConcludeTest(string resultStatus) + public void ConcludeTest(string resultStatus, string testDuration) { Write(new StatusLogJson { @@ -27,7 +27,8 @@ namespace Logging codexid = codexId, category = NameUtils.GetCategoryName(), fixturename = fixtureName, - testname = NameUtils.GetTestMethodName() + testname = NameUtils.GetTestMethodName(), + testduration = testDuration }); } @@ -57,5 +58,6 @@ namespace Logging public string category { get; set; } = string.Empty; public string fixturename { get; set; } = string.Empty; public string testname { get; set; } = string.Empty; + public string testduration { get; set;} = string.Empty; } }