【发布时间】:2017-12-21 13:15:54
【问题描述】:
在过去的几天里,我一直在绞尽脑汁想弄清楚如何直接从 Jenkins Job 运行 Coded UI 测试。因为我对詹金斯很陌生。我计划使用安装在同一台机器中的测试控制器和代理运行 jenkins 作业,作为存储我的项目的本地 VS 项目存储库。
我的目标是让 Jenkins Job 运行一个编码的 ui 测试,该测试直接与我的桌面交互。
用于测试的规范:
1. VS Enterprise 2015
2. Agents for MS 2013
3. Jenkins 1.69
到目前为止我所做的如下(这是我从 Jenkins 运行的批处理命令,我从 How to run Coded UI test file from Visual Studio command prompt using batch file? 复制的)在通过 CMD 运行时成功:
@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
我在我的 Windows 机器上使用我的本地存储库(不是 TFS 或 GIT,因为这不是必需的),这是在运行脚本时成功执行编码的 ui 测试。
但是,在 jenkins 中复制步骤时,我收到此错误(即使在 .settings 文件中使用 VS 配置测试控制器后):/
调用测试类 CodedUITest 的初始化方法时出错:Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException:要运行与桌面交互的测试,您必须将测试代理设置为作为交互进程运行。有关详细信息,请参阅“如何:设置测试代理以运行与桌面交互的测试”(http://go.microsoft.com/fwlink/?LinkId=159018)/
我的问题是:
- 为什么我的测试总是给我这个错误,尽管我的 测试代理是否已设置为交互式?
- 另外,我将如何获得它 从 Jenkins 运行,以便它直接与桌面交互 作为一个交互式过程?
【问题讨论】:
标签: visual-studio jenkins coded-ui-tests