我正在为多线程 NUnit 测试编写一个 PowerShell 脚本。我的问题是我从文件中获取测试类别category.txt
,并且我必须将已完成的类别写入我的输出文件file 1.txt
中。在执行完所有测试后,我还需要输出 XML 报告。我怎样才能在 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
}