Skip to content

Commit 615bf49

Browse files
Add timing for test execution and update completion messages.
1 parent d631537 commit 615bf49

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tests/test.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ Assert (Test-Path $casesDir) "Test cases directory not found at: $casesDir"
5959

6060
Write-Host 'Running tests...'
6161

62+
# Record the wall-clock time when the first test case is invoked.
63+
$testStart = Get-Date
64+
6265
$failures = @()
6366
$total = 0
6467

@@ -96,6 +99,9 @@ foreach ($case in $failingCases) {
9699
}
97100
}
98101

102+
$testEnd = Get-Date
103+
$elapsed = $testEnd - $testStart
104+
$elapsedSeconds = '{0:N3}' -f $elapsed.TotalSeconds
99105
Write-Host ''
100106
if ($failures.Count -gt 0) {
101107
Write-Host 'FAILURES:' -ForegroundColor Red
@@ -104,9 +110,9 @@ if ($failures.Count -gt 0) {
104110
if ($f.Output) { Write-Host $f.Output -ForegroundColor Red}
105111
}
106112
Write-Host ''
107-
Write-Host "Completed with $($total - $failures.Count)/$($total) tests passing, $($failures.Count)/$($total) tests failing." -ForegroundColor Red
113+
Write-Host "Ran $total tests in $elapsedSeconds seconds, with $($total - $failures.Count)/$($total) tests passing, $($failures.Count)/$($total) tests failing." -ForegroundColor Red
108114
exit 1
109115
} else {
110-
Write-Host "Completed with $($total)/$($total) tests passing, 0/$($total) tests failing." -ForegroundColor Green
116+
Write-Host "Ran $total tests in $elapsedSeconds seconds, with $($total)/$($total) tests passing, 0/$($total) tests failing." -ForegroundColor Green
111117
exit 0
112118
}

0 commit comments

Comments
 (0)