-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.ps1
More file actions
28 lines (23 loc) · 1.07 KB
/
test.ps1
File metadata and controls
28 lines (23 loc) · 1.07 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
# test.ps1
param(
[string]$Configuration = "Release",
[string]$TestType = "All" # Possible values: All, Abstractions, CosmosDB, Dapper, EntityFrameworkCore, MongoDB, NHibernate
)
# Get all test project files
$testProjects = Get-ChildItem -Path "tests" -Recurse -Filter "*.Tests.csproj"
# Filter test projects based on the $TestType parameter, except for "All"
if ($TestType -ne "All") {
$testProjects = $testProjects | Where-Object { $_.FullName -match $TestType }
Write-Host "TestType: $($TestType) => Testing only projects matching '$TestType'..." -ForegroundColor "Cyan"
}
Write-Host "Projects to be tested:" -ForegroundColor "Cyan"
$testProjects | ForEach-Object { Write-Host $_.FullName -ForegroundColor "Cyan" }
foreach ($project in $testProjects) {
Write-Host "Running tests for project: $($project.FullName)"
dotnet test $project.FullName --configuration $Configuration
if ($LASTEXITCODE -ne 0) {
Write-Error "Tests failed for project: $($project.FullName)"
exit $LASTEXITCODE
}
}
Write-Host "All tests passed." -ForegroundColor "Green"