-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathgenerate-test.ps1
More file actions
32 lines (24 loc) · 1.07 KB
/
generate-test.ps1
File metadata and controls
32 lines (24 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
29
30
31
32
# Get the current working directory
$currentDir = Get-Location
# Define paths using Join-Path for cross-platform compatibility (handling \ vs /)
$testsDir = Join-Path $currentDir "tests"
$toolPath = Join-Path $currentDir "tools\Paramore.Brighter.Test.Generator\Paramore.Brighter.Test.Generator.csproj"
Write-Host "Using test generator tool at: $toolPath"
Write-Host "Starting test generation..."
# Check if the tests directory exists
if (Test-Path $testsDir) {
# Get-ChildItem is like 'ls'. -Directory ensures we only get folders.
$testFolders = Get-ChildItem -Path $testsDir -Directory
foreach ($folder in $testFolders) {
Write-Host "Generating test for $($folder.Name)"
# Enter the directory (pushes previous path to a stack)
Push-Location -Path $folder.FullName
# Run the dotnet command
dotnet run --project $toolPath
# Return to the previous directory
Pop-Location
}
} else {
Write-Host "Directory '$testsDir' not found." -ForegroundColor Red
}
Write-Host "Test generation completed."