Adds test duration to status log

This commit is contained in:
benbierens 2023-07-21 09:20:28 +02:00
parent bbf66bb0f0
commit 344c004299
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
2 changed files with 8 additions and 4 deletions

View File

@ -200,8 +200,10 @@ namespace DistTestCore
private void DisposeTestLifecycle() private void DisposeTestLifecycle()
{ {
var lifecycle = Get(); var lifecycle = Get();
fixtureLog.Log($"{GetCurrentTestName()} = {GetTestResult()} ({lifecycle.GetTestDuration()})"); var testResult = GetTestResult();
statusLog.ConcludeTest(GetTestResult()); var testDuration = lifecycle.GetTestDuration();
fixtureLog.Log($"{GetCurrentTestName()} = {testResult} ({testDuration})");
statusLog.ConcludeTest(testResult, testDuration);
Stopwatch.Measure(fixtureLog, $"Teardown for {GetCurrentTestName()}", () => Stopwatch.Measure(fixtureLog, $"Teardown for {GetCurrentTestName()}", () =>
{ {
lifecycle.Log.EndTest(); lifecycle.Log.EndTest();

View File

@ -16,7 +16,7 @@ namespace Logging
this.codexId = codexId; this.codexId = codexId;
} }
public void ConcludeTest(string resultStatus) public void ConcludeTest(string resultStatus, string testDuration)
{ {
Write(new StatusLogJson Write(new StatusLogJson
{ {
@ -27,7 +27,8 @@ namespace Logging
codexid = codexId, codexid = codexId,
category = NameUtils.GetCategoryName(), category = NameUtils.GetCategoryName(),
fixturename = fixtureName, 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 category { get; set; } = string.Empty;
public string fixturename { get; set; } = string.Empty; public string fixturename { get; set; } = string.Empty;
public string testname { get; set; } = string.Empty; public string testname { get; set; } = string.Empty;
public string testduration { get; set;} = string.Empty;
} }
} }