-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-all-tests.ps1
More file actions
107 lines (86 loc) · 3.98 KB
/
run-all-tests.ps1
File metadata and controls
107 lines (86 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Run all tests in order: unit tests, destination tests, end-to-end tests
# Usage: .\run-all-tests.ps1
Set-Location $PSScriptRoot
$totalStart = Get-Date
mvn clean
# =============================================================================
# Unit Tests
# =============================================================================
Write-Host ""
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host " UNIT TESTS" -ForegroundColor Cyan
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host ""
$unitStart = Get-Date
mvn test "-Dtest=io.github.fortunen.kete.unittests.**" "-Dsurefire.skipAfterFailureCount=1" -q
$unitExit = $LASTEXITCODE
$unitDuration = (Get-Date) - $unitStart
if ($unitExit -ne 0) {
Write-Host ""
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host " ✗ Unit tests failed! Aborting. ($([math]::Round($unitDuration.TotalSeconds, 1))s)" -ForegroundColor Red
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host ""
exit $unitExit
}
Write-Host ""
Write-Host " ✓ Unit tests passed! ($([math]::Round($unitDuration.TotalSeconds, 1))s)" -ForegroundColor Green
# =============================================================================
# Integration Tests
# =============================================================================
Write-Host ""
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host " INTEGRATION TESTS" -ForegroundColor Cyan
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host ""
$destStart = Get-Date
mvn test "-Dtest=io.github.fortunen.kete.integrationtests.**" "-Dsurefire.skipAfterFailureCount=1" -q
$destExit = $LASTEXITCODE
$destDuration = (Get-Date) - $destStart
if ($destExit -ne 0) {
Write-Host ""
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host " ✗ Integration tests failed! Aborting. ($([math]::Round($destDuration.TotalSeconds, 1))s)" -ForegroundColor Red
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host ""
exit $destExit
}
Write-Host ""
Write-Host " ✓ Integration tests passed! ($([math]::Round($destDuration.TotalSeconds, 1))s)" -ForegroundColor Green
# =============================================================================
# End-to-End Tests
# =============================================================================
Write-Host ""
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host " END-TO-END TESTS" -ForegroundColor Cyan
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host ""
$e2eStart = Get-Date
mvn test "-Dtest=io.github.fortunen.kete.endtoendtests.**" "-Dsurefire.skipAfterFailureCount=1" -q
$e2eExit = $LASTEXITCODE
$e2eDuration = (Get-Date) - $e2eStart
if ($e2eExit -ne 0) {
Write-Host ""
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host " ✗ End-to-end tests failed! ($([math]::Round($e2eDuration.TotalSeconds, 1))s)" -ForegroundColor Red
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host ""
exit $e2eExit
}
Write-Host ""
Write-Host " ✓ End-to-end tests passed! ($([math]::Round($e2eDuration.TotalSeconds, 1))s)" -ForegroundColor Green
# =============================================================================
# Summary
# =============================================================================
$totalDuration = (Get-Date) - $totalStart
Write-Host ""
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host " ✓ ALL TESTS PASSED!" -ForegroundColor Green
Write-Host ("=" * 80) -ForegroundColor DarkGray
Write-Host ""
Write-Host " Unit tests: $([math]::Round($unitDuration.TotalSeconds, 1))s" -ForegroundColor White
Write-Host " Integration tests: $([math]::Round($destDuration.TotalSeconds, 1))s" -ForegroundColor White
Write-Host " End-to-end tests: $([math]::Round($e2eDuration.TotalSeconds, 1))s" -ForegroundColor White
Write-Host " ─────────────────────────────" -ForegroundColor DarkGray
Write-Host " Total: $([math]::Round($totalDuration.TotalSeconds, 1))s" -ForegroundColor Cyan
Write-Host ""