-
Notifications
You must be signed in to change notification settings - Fork 0
/
RunTests.ps1
36 lines (25 loc) · 1.03 KB
/
RunTests.ps1
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
dotnet build
$VSTestPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\TestPlatform\vstest.console.exe"
$BuildPath = ".\bin\Debug\netcoreapp3.1"
$AssemblyDllName = "ParallelTests.dll"
$TestsDeployBase = ".\TestDeploy"
$TestThreadDirBase = "Thread"
$NumThreads = 2
$TestArgs = @( )
for ($i = 0; $i -lt $NumThreads; $i++)
{
$ThreadDir = "$TestThreadDirBase$i"
$ThreadDirPath = "$TestsDeployBase\$ThreadDir"
if (Test-Path $ThreadDirPath)
{
Remove-Item -LiteralPath $ThreadDirPath -Recurse -Force
}
New-Item -Path $TestsDeployBase -Name $ThreadDir -ItemType "directory"
Copy-Item "$BuildPath\**" $ThreadDirPath -Recurse
$AppSettingsPath = "$ThreadDirPath\appsettings.json"
(Get-Content $AppSettingsPath).replace("<category to run>", "category$i") | Set-Content $AppSettingsPath
$TestArgs += "$ThreadDirPath\$AssemblyDllName"
}
$TestArgs += "/Settings:test.runsettings"
$TestArgs += "/Parallel"
& $VSTestPath $TestArgs