A newbie and first question on this forum. My first script successfully runs tests in parallel using mstest with PowerShell v4.0 workflow. But as "InlineScript" has the limitation of running 5 in parallel, trying to re-design the script to something without "InlineScript". While I could make the second script work for single test with hard coded test name, getting issues when I try to pull all the tests for run. Please take a look at both the scripts and suggest:
First Script:
workflow Primary_Tests
{
$Workspace = "E:\Vishal_PS_Workspace"
$mstest = "C:\VisualStudio12\Common7\IDE\MSTest.exe"
$testlocation = "$Workspace\TEST\TestBin"
$RunName = Get-Date -format "yyyy-MM-dd-T-HH\hmm"
mkdir "$Workspace\TestResults\Results-$RunName"
$resultsDir = "$Workspace\TestResults\Results-$RunName"
$results = "/resultsfile:$resultsDir\$RunName.trx"
InlineScript { cd $Using:testlocation }
$tests = @("Test_01", "Test_006", "Test 013", "ST-002-002", "ST-001-002", "ST-032-002", "ST-012-002", "Test 016", "Test 143")
ForEach -Parallel -ThrottleLimit 10 ($test in $tests)
{
InlineScript { & $Using:mstest /TestContainer:"$Using:testlocation\$Using:test.webtest" /resultsfile:"$Using:resultsDir\$Using:test.trx" }
}
}
Primary_Tests
Second Script:
Workflow Parallel_Tests
{
$Workspace = "E:\Vishal_PS_Workspace"
$mstest = "C:\VisualStudio12\Common7\IDE\MSTest.exe"
$testlocation = "$Workspace\TEST\TestBin"
$RunName = Get-Date -format "yyyy-MM-dd-T-HH\hmm"
mkdir "$Workspace\TestResults\Results-$RunName"
$resultsDir = "$Workspace\TestResults\Results-$RunName"
$results = "/resultsfile:$resultsDir\$RunName.trx"
$arguments = " /testcontainer:" + "$testlocation\" + "Test_01.webtest"
$tests = @("Test_01")
ForEach -Parallel -ThrottleLimit 10 ($test in $tests)
{
Invoke-Expression "$mstest $arguments $results"
}
}
Parallel_Tests