Run a Ranorex Test Suite (.exe) on virtual machine

Ask general questions here.
rul
Posts: 4
Joined: Fri Nov 14, 2014 7:42 am

Run a Ranorex Test Suite (.exe) on virtual machine

Post by rul » Fri Nov 14, 2014 9:41 am

Hello there,

I want to run a Ranorex Test Suite (.exe) on a virtual machine. Therefore I want to start the .exe from outside with a C#-Application using the library "Vestris.VMWareLib", which provides the command "RunProgramInGuest".

Example:
VMWareVirtualMachine.Process ranorexProcess =
virtualMachine.RunProgramInGuest(@"c:\ranorex\Test_13_4.exe", string.Empty, 60 * 5);
The directory containing the Ranorex Test-Files can you see here: [img2].

Until now, everything works fine.
But just as the test begins to execute, a window is displayed [img1], which says an interactive service was detected. I found, that this is a security thing of Windows itself, causes the application (in this case: the Ranorex Test .exe) to be executed on 'session 0'.

Well, this does not really affect the test directly, for I can see in the Task Manager, that the Program I am testing, is running. (Which obviously means the test is also running)

Now, the problem:
After the test exited, there are no log-files found in the folder, where the Ranorex Test .exe lays. There are no files created at all. If I run the test manually, by double-clicking, the files were created, but not so, if I start the test via my C# Application from outside with the code snippet above.

So I have no possibilities to ensure, if the test was executed successfully or not.

Thank you for your help at this.
Regards, rul.

***
Specs:
My OS: Windows 8 (64 bit)
OS on the virtual machine: Windows Server 2008 R2 - Service Pack 1 (64 bit)
Ranorex version on the vm: 5.2.0.20272
.Net version on the vm: v4
***
You do not have the required permissions to view the files attached to this post.

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Run a Ranorex Test Suite (.exe) on virtual machine

Post by krstcs » Fri Nov 14, 2014 4:30 pm

My guess would be that the RunProgramInGuest method is actually running the test from the system login's context, which doesn't have a desktop.

Ranorex (and all other functional UI automation tools) MUST run an a user console (not system) login with a fully realized and unlocked desktop. I would recommend that you either set the RunProgramInGuest to use a real user, if possible, or use something like Jenkins. Keep the desktop unlocked on the test system using VNC or something similar.
Shortcuts usually aren't...

rul
Posts: 4
Joined: Fri Nov 14, 2014 7:42 am

Re: Run a Ranorex Test Suite (.exe) on virtual machine

Post by rul » Sat Nov 15, 2014 9:17 pm

Thank you very much for the answer.

To use the Methd RunProgramInGuest I have to first create a user context, which is used by followed methods... also, the desktop is unlocked the whole time.

But I will give a look to this Jenkins-thing.

rul
Posts: 4
Joined: Fri Nov 14, 2014 7:42 am

Re: Run a Ranorex Test Suite (.exe) on virtual machine

Post by rul » Wed Nov 26, 2014 8:01 am

Are there any other solutions for the mentioned problem?

I haven't tested Jenkins yet, for I want to keep it as an alternative solution. I really prefer my current way.

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Run a Ranorex Test Suite (.exe) on virtual machine

Post by krstcs » Wed Nov 26, 2014 3:14 pm

Creating a User-Context does not necessarily create a desktop, depending on the technology. You can be logged into a windows system without having a desktop. Context is only the login session, not the desktop.

Try this:
1. Login to the system using RDP/VNC.
2. Start the test manually from here. Does it work?
3. Under the same RDP/VNC login, start the test using CC like normal. Can you see the test running? If not, CC is the problem.
Shortcuts usually aren't...

rul
Posts: 4
Joined: Fri Nov 14, 2014 7:42 am

Re: Run a Ranorex Test Suite (.exe) on virtual machine

Post by rul » Fri Nov 28, 2014 2:07 pm

Yes, I can start the test manually and watch it running. I do have desktop etc.

I figured, that the really problem is, that the test is runned in session 0, caused by Windows Server.

Ranorex log files are created with a relative path from the .exe (which unfortunately is not running in the main session, but in the session 0, where no desktop exists, so there doesn't exist the needed directory).

I solved this problem by starting my Ranorex Test-.exe through cmd, giving the absolute path to the log files as parameter! Now, the process, which creates the log files, doesn't get lost in session 0, but creates the files with my absolute path in the main session.

Thank you all for the help :)