2
@echo off
@setlocal enableextensions
@cd /d "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE"
start %comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat""
MSTest /testcontainer:C:\testdir\test.dll

上面显示的代码运行 vs 命令提示符并将目录更改为"C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE"MSTest.exe 所在的位置。但是最后一行不在 vs 命令提示符窗口中运行,打开新窗口并尝试在新打开的窗口中运行。谁能帮助如何使用批处理文件在打开的 vs 命令提示符下运行 ui 测试文件?

4

1 回答 1

1

我使用以下批处理脚本运行我的编码 UI 测试:

@echo off
:: Running tests without VS Enterprise is possible if you install the Test Agent package: https://msdn.microsoft.com/en-us/library/dd648127.aspx

set test_runner="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
set test_dlls="C:\Location\Compiled\Tests\Project.CodedUI.Test.dll"

:: If tests is set then only these comma separate test cases are run
:: set tests="Test1,Test2"
set tests=""

if %tests% == "" (
     %test_runner% %test_dlls% > CodedUITestResults.txt
) else (
     %test_runner% %test_dlls% /tests:%tests%
)
pause

视觉工作室编号应根据不同版本更换

  • VS2015:14.0
  • VS2013:12.0
  • ETC
于 2016-01-18T13:16:31.100 回答