无需图形会话即可在虚拟机上自动化测试 [英] Automate tests on virtual machine without graphical session

查看:145
本文介绍了无需图形会话即可在虚拟机上自动化测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文:

我在Windows上运行并使用UFT/Ranorex的虚拟机上执行自动GUI测试(数量很少),执行由詹金斯(Jenkins)进行.

I execute automated GUI tests on virtual machines (there are few of them) on running on windows and using UFT/Ranorex, executions are piloted by Jenkins.

问题:

VM必须具有活动的 graphic 会话,否则,UFT将不会运行GUI测试(无法启动浏览器),并且Ranorex将运行,但效果很差,并且没有屏幕截图.我的意思是,在我的测试中,将VM配置为不睡眠"或没有任何屏幕保护程序,vm与jenkins正确连接. 行为是:我通过Jenkins启动了测试,这是在vm中完成的构建,自动化工具开始运行,但是发现打开浏览器很困难.

VM must have an active graphic session, otherwise, UFT won't run GUI tests (unable to launch browser) and Ranorex will run but poorly and without screenshots. i mean that in my tests, the VM is configured not to "sleep" or to have any screen saver, vm is connected with jenkins properly. The behavior is : i launch via Jenkins the test, one the build done inthe vm, automation tools start running but then finds difficulties to open browser.

我想知道是否有任何替代方法可以运行这些测试,而无需物理打开VMware或远程桌面连接. 请注意,VM一直在运行,并且会话始终处于打开状态(我们使用服务器托管VM).

I would like to know if there is any workaround to run those tests without being needed to physically open VMware or Remote desktop Connection. Notice that the VM is running all the time and the session is always open (we are using a server to host the VM).

所以问题是:如何在Windows活动的图形会话中进行模拟.我想这就像在模拟实际上有一个屏幕连接,即使没有...

So the problem is: how to simulate in windows active graphical session. I guess it's like simulating that there is actually a screen connected even though there isn't...

任何建议都会受到欢迎.

Any suggestions will be welcomed.

推荐答案

已经经历了很多次,您可以在Ranorex论坛中找到很多与您的问题相关的资源. (我的用户名有Martin供参考).

Had to go through this many times and you can find a lot of resources related to your issue in the Ranorex Forum. (My username there is Martin for reference).

但是要快速理解这些要点,请执行以下操作: 1)连接一台用于运行测试的RDP机器 2)您需要为该计算机禁用屏幕保护程序(我必须从注册表中执行此操作) 3)然后禁用个性化设置"屏幕保护程序下的在恢复时,显示登录屏幕"选项 4)最后,创建一个.bat脚本,其内容如下:%windir%\ System32 \ tscon.exe RDP-Tcp#0/dest:console"

But to go through the points you need to do quickly: 1) Have an RDP machine to connect to that is used to run your tests 2) You need to disable screen saver for that machine (I had to do it from registry) 3) Then disable the "On Resume, display logon screen" option under Personalize settings for the screen saver 4) And finally create a .bat script with the following content "%windir%\System32\tscon.exe RDP-Tcp#0 /dest:console"

因此,基本上,当您完成所有设置(仅需要一次)后,您将运行.bat脚本.这将关闭RDP窗口,但是会话将在启用屏幕的情况下保持打开状态.

So basically when you have everything set up (required only once) you will run the .bat script. This will close the RDP window BUT the session will be left open with the screen enabled.

只需将RDP与Jenkins连接,您就具有运行测试所需的全部功能.

Just connect the RDP with Jenkins and you have full functionality that you need to run your tests.

问候 马丁

这篇关于无需图形会话即可在虚拟机上自动化测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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