0
我使用NUnitConsole3測試運行器運行所有unittest.dll,並且在成功構建後生成xml TestResult報告。如果任何單元測試失敗,如何構建失敗?如何在NUnitTest上構建失敗使用Powershell失敗
下面給出的是腳本運行單元測試
$SourceDir = "C:\Users\M1036083\Source\Repos\TestSitecoreProject"
$OutDir = "C:\Builds\2\Demo\bin"
## ------------------------------------------------------------------------------
## Set Nunit Tool path
## ------------------------------------------------------------------------------
$nunit = "$SourceDir\NUnit.Console-3.6.1\nunit3-console.exe"
## ------------------------------------------------------------------------------
## Get all the Test dlls from the output directory
## ------------------------------------------------------------------------------
$tests = (Get-ChildItem $OutDir -Recurse -Include Demo.*Tests.dll)
## ------------------------------------------------------------------------------
## Run all the tests and generate report in XML format
## ------------------------------------------------------------------------------
& $nunit --inprocess $tests --noheader --work="$OutDir"