如何使用批处理文件从Visual Studio命令提示符运行编码的UI测试文件?
问题描述:
@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测试文件?
Code shown above runs vs command prompt and changes directory to "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE"
where MSTest.exe is. But last line doesn't run in vs command prompt window, opens new window and tries to run in a new opened window. Can anyone help how to run ui test file in opened vs command prompt using batch file?
答
我使用以下代码运行UI编码测试以下批处理脚本:
I run my Coded UI tests with the following batch script:
@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
视觉工作室的编号应按发送版本
The visual studio number should be replaced per different version
- VS2015:14.0
- VS2013:12.0
- Etc