5

First of all, I apologize if I am wasting your time, because it looks like a simple step which I am not able to figure out even after some research.

Ok, here is what I am trying to achieve, I have written some UI tests using TestStack.White, I would like to execute this on a Jenkins Slave as different user, since the application behaves differently based on the roles that are assigned to them in Active Directory.

So after doing a bit of lookup on google I found the following links which are relevant to what I am trying to achieve.

It looks like that I have to install TightVNC on Jenkins slave and should connect to slave from Jenkins Master and execute tests on slave.

Which brings me to my first question, how do I exactly achieve this from a Jenkins job?

About logging in as different users, I understand I can use to "autologon.exe" to achieve this. So just wondering how I can do this on the Windows Slave from Jenkins Master. My company doesn't allow SSH to Windows instances (slave machines), I cannot remotely execute SSH from Jenkins Master.

I understand that I may not be looking at this correctly, so any help would be much appreciated.

Thanks in advance for your time and advice.

Community
  • 1
  • 1
Venkat Rao
  • 91
  • 10
  • 1
    I think the main issue with running UI tests unattended on a server is that you need an interactive session running. I.e. there needs to be a user logged in in an interactive session, which is not locked or otherwise "headless" currently, otherwise lots of things just don't work. Using a VM is often a suitable approach, but adds even more complexity. In our own product we solved the issue by not doing UI tests at all, but instead synthesizing our own abstracted input events in the correct order to make the rest of the code do the right thin, thereby side-stepping the session problem. – Joey Aug 02 '16 at 12:46

2 Answers2

1

I am getting ready to do something similar to this but I am building a communication layer into our UI Automation application so that our build machine (our company rolled our own build machine) can send TCP request back and forth. I am going to deploy the UI Automation and the build to a share then start a virtual machine. The build machines template will have a startup script that launches both our applications from the share. Once the virtual machine is started then I am going to communicate with the UI Automation application to tell it to start and it will tell me when its done so I can tear down the VM. I am going to save all the test results out to a share for reporting purposes.

I know this doesn't directly answer your question but this approach is one I have heard about from multiple people working in various automation frameworks.

If I was going to do this in Jenkins I would look into Jenkins plugin system. The plugin system as far as I know uses Java so you should be able to create some type of communication layer and interface with some type of VM. If you don't have the option to start and stop a VM you will need to look into start and stopping processes on a remote machine while masquerading as a user. I know this can be done in C# but I have never looked into it in Java.

Max Young
  • 1,236
  • 1
  • 12
  • 35
1

Thanks all for your comments and answers, basically this is what I did to get it working for me,

  1. Establish VNC connection with a VNC Client on Jenkins slave, this was done manually not through Jenkins.
  2. Use an app called "Caffeine" to prevent windows from locking out, it simulates a key up event on F15 (every xx seconds) so there is no interruption with testing task in my project.
  3. Launch JNLP connection to the Jenkins Master and "Caffeine" app as a part of windows logon through VNC Connection.
  4. Close out of the VNC connection (not logging off), this was done manually not through Jenkins.
  5. Let the build run as different users using PSExec on the slaves.

This seems to be working fine so far, I didn't reply sooner since I wanted to monitor the jobs for a few days before posting my reply here.

Venkat Rao
  • 91
  • 10