Automate tests on virtual machine without graphica

2019-07-21 10:16发布

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.

3条回答
We Are One
2楼-- · 2019-07-21 10:46

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

查看更多
可以哭但决不认输i
3楼-- · 2019-07-21 10:59

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

screenshot

If this fails, see my other answer.

查看更多
仙女界的扛把子
4楼-- · 2019-07-21 11:05

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/

查看更多
登录 后发表回答