Add total running time (#33)

This commit is contained in:
Tanguy 2023-09-16 08:51:29 +02:00 committed by GitHub
parent e1b7a9f418
commit 91973dfa38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -228,6 +228,8 @@ type
statuses: array[TestStatus, int]
totalDuration: Duration
results: seq[TestResult]
failures: seq[TestResult]
@ -560,6 +562,7 @@ proc printTestResultStatus(formatter: ConsoleOutputFormatter, testResult: TestRe
method testEnded*(formatter: ConsoleOutputFormatter, testResult: TestResult) =
formatter.statuses[testResult.status] += 1
formatter.totalDuration += testResult.duration
if formatter.outputLevel == NONE:
return
@ -643,9 +646,11 @@ method testRunEnded*(formatter: ConsoleOutputFormatter) =
formatter.statuses[TestStatus.FAILED] > 0):
return
let totalDurStr = formatDuration(formatter.totalDuration, false)
try:
let total = foldl(formatter.statuses, a + b, 0)
stdout.write("[Summary ] ", $total, " tests run: ")
stdout.write("[Summary] ", $total, " tests run ", totalDurStr, ": ")
var first = true
for s, c in formatter.statuses: