2017-04-24 20 views
0

初心者で最初の質問です。私の最初のスクリプトは、mstestをPowerShell v4.0ワークフローで使用して、テストを並行して正常に実行します。しかし、 "InlineScript"には5を並列に実行することの限界があり、 "InlineScript"を使用しないでスクリプトを再設計しようとしています。 2つ目のスクリプトをハードコードされたテスト名でシングルテストで動作させることができますが、すべてのテストを実行しようとすると問題が発生します。PowerShellワークフローでmstestを使用して並列テストを実行する

最初のスクリプト:

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 

2番目のスクリプト:

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 

答えて

0

いくつかのより多くの再試行し、私はそれがネストされた のforeachを使用して動作させることができ、スクリプトや提案の両方を見てみてください。とにかくありがとうございます。

関連する問題