我有一个 *.webtest,我正在构建它作为 TFS 2015 发布定义的一部分。 我想将此测试作为版本的一部分运行。
我相信这需要mstest.exe
但是在Command Line
组件中运行时无法识别mstest
命令,这与dotnet publish
等其他命令不同。
我是否需要在我的测试项目中包括 MSTest.exe 可执行文件,或者是否有一种更"开箱即用"的方法在 TFS 2015 发布定义中运行 Web测试?
您可以通过MSBuild工具运行WebTests,也可以通过PowerShell调用MSBuild工具。
- 添加电源外壳任务
法典:
param (
$tool = "C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDEMSTest.exe",
$path ,
$include = "*.webtest",
$results ,
$testsettings)
$web_tests = get-ChildItem -Path $paths -Recurse -Include $include
foreach ($item in $web_tests)
{
$args += "/TestContainer:$item "
}
& $tool $args /resultsfile:$Results /testsettings:$testsettings
- 添加"发布测试结果"任务
有关详细信息,可以参考本文:将 Web 测试作为 VSTS VNext 发布管道的一部分运行