Automate tests on virtual machine without graphical session

巧了我就是萌 提交于 2020-01-04 14:12:24

问题


Context :

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.

Problem:

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.

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).

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.


回答1:


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).

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"

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.

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

Regards Martin




回答2:


In the Tools ⇨ Options menu, select General ⇨ Run Sessions there you will find an option to Enable continued testing on locked/disconnected remote computers.

If this fails, see my other answer.




回答3:


I had the same problem when I try to run an automate tests on virtual machine and I find this solution to generated a graphical session although you are not connected to the virtual machine. You need to created a task to opend a session on the virtual machine when you disconected or terminated the session , this created a graphical session but will not function when you are connected and you have the screen minimize. Here is the link for the solution and the explanation

http://blogs.microsoft.co.il/arnona/2016/01/03/keeping-an-active-desktop-session/



来源:https://stackoverflow.com/questions/46928790/automate-tests-on-virtual-machine-without-graphical-session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!