2013-08-26 4 views
0

다중 스레드 NUnit 테스트 용 PowerShell 스크립트를 작성하고 있습니다. 내 문제는 파일 category.txt에서 테스트 범주를 가져오고 출력 파일 file 1.txt에 어떤 범주가 작성되었는지 기록해야합니다. 또한 모든 테스트가 수행 된 후에도 XML 보고서를 출력해야합니다. 어떻게 NUnit에서 이것을 할 수 있습니까?NUnit 테스트 결과 게시

$Groups=Get-Content d:\test\category.txt | Select-Object -Last 10 
Write-Host $Groups 
if ($Groups -ne $null) 
    {Write-Host "true"} 
else 
    {write-host "false"} 
###Multithreading### 
$ThreadNumber =$Groups.Count 
$ScriptBlock = { 
    function Nunit { 
     $Connection = @{"server" = ""; "username" = ""; "password" = ""} 
     write-verbose $Connection 
     $serv = $connection.Get_Item("server") 
     $user = $connection.Get_Item("username") 
     $pass = $connection.Get_Item("password") 

     $securePassword = ConvertTo-SecureString -AsPlainText $pass -Force 
     #Create connection credentials object for Invoke-Command 
     $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $user, $securePassword 
     $Output = "C:\" 
     $scriptBlock = { 
      CMD.EXE /C "C:\testNunit\bin\nunit-console.exe /xml:c:\console-test.xml C:\testNunit\dll\Tests.dll /include:TestTypeSmoke> c:\1.txt" 
     } 
     Invoke-Command -ComputerName $serv -ScriptBlock $scriptBlock -credential $cred 
    } 
    Nunit 
} 
내 말에 어떤 일을 시도 후 NUnit과에 다시 연락을 시도하지만 제안으로 당신은 또한 멀티 스레딩을위한 PowerShell을 워크 플로우를 시도 할 수

답변

0

. 그들은 기능처럼 작동합니다.

Workflow NUnit 
    { 
     Param 
     (
      $server, 
      $username, 
      $password,    
     ) 

       foreach -parallel -throttlelimit 2($group in $groups) 
       try{ 
        //NUnit Code here 
       } 
      } 
      Catch 
      { 
       $_.Exception.Message 
      } 
     } 
    } 
    NUnit-server "" -username "" -password ""