1

We are setting up our automation to run remotely so we can start incorporating them into the builds (you know, the whole CI/CD thing). These are a handful of important automated GUI tests that for obvious reasons, need an active VM to run. These are not browser tests, they are actually automated tests for a windows application so any support that Selenium brings to the table is off for us.

So now on to the challenge - how can I keep the VMs up and running without having to log into them using the Remote Desktop Connection to allow them to run the tests properly. Currently, I have to connect to them from my local machine and then minimize it and then I can kick off the builds. As soon as I exit however, the virtual machine is locked again.

I want the VMs to work completely independently from my machine, so I was skeptical about this approach because it seemed like it would still be tied to my machine only. Pretty much anyone in the company can log into the VMs from their machine using their credentials. What I would like to do is to programatically connect to the VM during my global TestStartup and then disconnect at TearDown. Is this possible to do? Has anyone had success or ran into similar situations with their automation integration process? We use a tool called LeanFT and NUnit as our test runner. .

Tree55Topz
  • 1,102
  • 4
  • 20
  • 51
  • have you looked at AutoLogin by Sysinterrnals? https://learn.microsoft.com/en-us/sysinternals/downloads/autologon – Moe Ghafari Dec 05 '17 at 14:32
  • @MoeGhafari I have not. Is this like a one time setup that you do on the remote computer or do you install and set it up on the local computer? – Tree55Topz Dec 05 '17 at 14:34
  • yeah you setup it up once in the registry of the remote ma chine and it will auto login every time the machine boots up. very handy – Moe Ghafari Dec 05 '17 at 14:42
  • @MoeGhafari the machine is already booted up and stays booted up. The problem is that when I exit out of the RDC window, the machine locks. I am not sure if this will solve it then as I am not trying to continuously turn the machine on and off in between test runs. – Tree55Topz Dec 05 '17 at 14:50
  • @Tree55Topz I am also doing the same thing. Trying to do the things on a Azure WVD and the CICD thing. My problem is the even minimizing the WVD the tests say ```Mouse/KeyBoard Input Not Received``` and disconnecting ``stops`` the whole test run – Apoorv Nov 09 '20 at 08:29

2 Answers2

1

Your idea to log in as part of the test is a bit fragile and prone to instabilities.

Here is the setup that works for every UI automation tool I've used for Windows

  • set up your VM to not lock / sleep /hibernate, etc.
  • Avoid using RDC (turn that feature off, even for admins if you can)
  • Only use the console viewer for your vm server
  • Limit access to those systems using the permissions in the VM server so that only you and your team can interact with them.

Here is why this works. You have already discovered that when you disconnect the RDP connection, the session locks and your automation fails. By using the vm console viewer, it's essentially like turning on/off the monitor connected to the system. By keeping them on all the time and not sleeping, they are always available for running tests.

We are using LeanFT and to encourage the stability of our tests, we have setup tasks to check the running processes to kill any stray leanft runtimes that didn't get closed cleanly from a prior run, as well as any stray applications that were not closed properly after a testing run.

not-bob
  • 815
  • 1
  • 8
  • 23
  • I think there is a bit more that needs to be done however.. Even if the VM was set to never lock, I believe if disconnected we would lose control of the GUI – Tree55Topz Dec 08 '17 at 14:33
  • 1
    if you use the VM Console, there is no 'disconnect' like you have with RDC. It really is just like turning on/off a physical screen. – not-bob Dec 08 '17 at 22:39
  • @not-bob I need some help here. After much of looking around, reached here. Need assistance. please help – Apoorv Nov 09 '20 at 08:31
  • @Apoorv I'll see what I can do. Can you describe the issue you're seeing? (What are you trying to do? What did you try? What did you expect would happen? What actually happened?) – not-bob Jan 02 '21 at 17:25
  • I have tried the thing with a WVD on Azure. The question above states that i need to be connected all the time and even minimizing the WVD instance causes run time issues of not finding the keyboard and mouse. – Apoorv Jan 03 '21 at 18:59
  • So, you’ve noticed that the mouse and keyboard are deactivated when you minimize the window. I think one misunderstanding is the need to maintain a connection. In my solution You need the vm to never sleep, and to not require a password. If you do connect, you may have issues like you mention. RDP connections for Windows is problematic for us automation. It’s often best to use the VM console view (I’m unsure how azure works, and may not be an option. You’ll have to research this) – not-bob Jan 05 '21 at 18:21
  • @apoorv let’s start at the beginning. 1) do you require windows os? 2) what are you automating? ( if a browser, which ones) 3) what automation tools are you using? – not-bob Jan 05 '21 at 18:22
0

These kind of issues are really annoying for UI automation.

In the end I found a solution. Not quite well but it works. All I did is created a Docker container and used it in UI automation job.

The container is composed by SSHD, Xvfb and xfreerdp, which let you connect to massive remote RDP, and because it use xvfb, a virtual display tool, it costs low resource.

Here's the image I created for your reference.

https://hub.docker.com/repository/docker/ariyuan/ubuntu1604_ssh_rdp

Before your UI automation start you just need to tell the container to open remote RDP connection to the machine where your UI automation hosted. In this case your display for UI automation will be kept all the time during the execution.(You can do it all by Jenkins with parameters to connect to different remote machine)

August
  • 13
  • 3