|
1 | 1 | [CmdletBinding(PositionalBinding=$false)]
|
2 | 2 | param(
|
3 |
| - [switch]$RunTests |
| 3 | + [switch]$RunTests, |
| 4 | + [switch]$RunTestsUntilFailure |
4 | 5 | )
|
5 | 6 |
|
6 | 7 | Write-Host "Run Parameters:" -ForegroundColor Cyan
|
7 | 8 | Write-Host "`tPSScriptRoot: $PSScriptRoot"
|
8 | 9 | Write-Host "`tRunTests: $RunTests"
|
| 10 | +Write-Host "`tRunTestsUntilFailure: $RunTestsUntilFailure" |
9 | 11 | Write-Host "`tdotnet --version: $(dotnet --version)"
|
10 | 12 |
|
11 | 13 | Write-Host "[INFO] building all projects (Build.csproj traversal)..." -ForegroundColor "Magenta"
|
12 | 14 | dotnet build "$PSScriptRoot\Build.csproj"
|
13 | 15 | Write-Host "[INFO] done building." -ForegroundColor "Green"
|
14 | 16 |
|
15 |
| -if ($RunTests) |
| 17 | +if ($RunTests -or $RunTestsUntilFailure) |
16 | 18 | {
|
17 | 19 | $tests_dir = Join-Path -Path $PSScriptRoot -ChildPath 'projects' | Join-Path -ChildPath 'Test'
|
18 | 20 | $unit_csproj_file = Resolve-Path -LiteralPath (Join-Path -Path $tests_dir -ChildPath 'Unit' | Join-Path -ChildPath 'Unit.csproj')
|
19 | 21 | $integration_csproj_file = Resolve-Path -LiteralPath (Join-Path -Path $tests_dir -ChildPath 'Integration' | Join-Path -ChildPath 'Integration.csproj')
|
20 | 22 | $sequential_integration_csproj_file = Resolve-Path -LiteralPath (Join-Path -Path $tests_dir -ChildPath 'SequentialIntegration' | Join-Path -ChildPath 'SequentialIntegration.csproj')
|
21 | 23 |
|
22 |
| - foreach ($csproj_file in $unit_csproj_file, $integration_csproj_file, $sequential_integration_csproj_file) |
| 24 | + Do |
23 | 25 | {
|
24 |
| - Write-Host "[INFO] running Unit / Integration tests from '$csproj_file' (all frameworks)" -ForegroundColor "Magenta" |
25 |
| - dotnet test $csproj_file --environment 'RABBITMQ_LONG_RUNNING_TESTS=true' --no-restore --no-build --logger "console;verbosity=detailed" |
26 |
| - if ($LASTEXITCODE -ne 0) |
| 26 | + foreach ($csproj_file in $unit_csproj_file, $integration_csproj_file, $sequential_integration_csproj_file) |
27 | 27 | {
|
28 |
| - Write-Host "[ERROR] tests errored, exiting" -Foreground "Red" |
29 |
| - Exit 1 |
| 28 | + Write-Host "[INFO] running Unit / Integration tests from '$csproj_file' (all frameworks)" -ForegroundColor "Magenta" |
| 29 | + dotnet test $csproj_file --environment 'RABBITMQ_LONG_RUNNING_TESTS=true' --no-restore --no-build --logger "console;verbosity=detailed" |
| 30 | + if ($LASTEXITCODE -ne 0) |
| 31 | + { |
| 32 | + Write-Host "[ERROR] tests errored, exiting" -Foreground "Red" |
| 33 | + Exit 1 |
| 34 | + } |
| 35 | + else |
| 36 | + { |
| 37 | + Write-Host "[INFO] tests passed" -ForegroundColor "Green" |
| 38 | + } |
30 | 39 | }
|
31 |
| - else |
32 |
| - { |
33 |
| - Write-Host "[INFO] tests passed" -ForegroundColor "Green" |
34 |
| - } |
35 |
| - } |
| 40 | + } While ($RunTestsUntilFailure) |
36 | 41 | }
|
0 commit comments