如何使用批处理文件从Visual Studio命令提示符运行编码的UI测试文件? [英] How to run Coded UI test file from Visual Studio command prompt using batch file?

查看:78
本文介绍了如何使用批处理文件从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

这篇关于如何使用批处理文件从Visual Studio命令提示符运行编码的UI测试文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆