@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命令提示符,并将目录更改为MSTest.exe所在的"C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE"
。但是最后一行不会在vs命令提示符窗口中运行,打开新窗口并尝试在新打开的窗口中运行。任何人都可以帮助如何使用批处理文件在打开的vs命令提示符下运行ui测试文件吗?
答案 0 :(得分:1)
我使用以下批处理脚本运行我的Coded 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
视觉工作室编号应根据不同版本替换