【发布时间】:2017-07-28 03:15:30
【问题描述】:
我正在使用 NUnitConsole3 测试运行器运行所有 unittest.dll,它会在成功构建后生成 xml TestResult 报告。如果任何单元测试失败,我将如何使构建失败?
下面是运行单元测试的脚本
$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"
【问题讨论】:
标签: powershell build nunit