WPF Client & Ranorex cannot interact when VM is disconnected

Ask general questions here.
benny28
Posts: 34
Joined: Thu May 31, 2012 4:48 pm
Location: London
Contact:

WPF Client & Ranorex cannot interact when VM is disconnected

Post by benny28 » Fri Jan 18, 2013 5:11 pm

Hello

I have the following setup when using ranonex:
* ranorex used to automate a WPF Windows Client
* test written in .Net
* test suite managed via TeamCity
* running tests on a dedicated VM

So; while I am connected to the VM, I 'Run' my tests via TeamCity. I can watch my WPF client launch and see these tests successfully pass.

But; when I disconnect from the VM and 'Run' via TeamCity, my tests fail as it seems ranorex and the WPF cannot interact whie the session is disconnected.

Some thoughts:
* when testing web sites with selenium / webdriver it is possible to Run tests while disconnected to a VM.
* is there some Service on the VM that Ranorex interacts with, that requires the properties setting 'Allow service to interact with desktop' ticked?
* I dont think any options in the TroubleShooting file relate to this:
http://www.ranorex.com/support/user-gui ... html#c3250


The logs dont give me mich info, just point me towards the trouble shooting page:

[RanorexTest0001] [Test Error Output]
[2013/01/18 15:42:13.291][Debug ][Logger]: Console logger starting.
[2013/01/18 15:42:13.303][Warn ][Automation]: The apartment state of the current thread is not set to STA. Please make sure that all threads accessing Ranorex methods have their apartment state set to STA.
[2013/01/18 15:42:20.180][Warn ][WinForms]: Failed to load the assemblies containing the definition of this control. UI element identification capabilities for this control are limited. Failed assemblies:
C:\Users\joeblogs\Downloads\NUnit-2.6.0.12051\NUnit-2.6.0.12051\bin\lib\nunit-gui-runner.dll
The following website provides more information on this technology limitation:
http://www.ranorex.com/support/user-gui ... html#c3250
(This message is only shown once per report.)


Any guidance or thoughts from the community would be greatly appreciated :D

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: WPF Client & Ranorex cannot interact when VM is disconnected

Post by Ciege » Fri Jan 18, 2013 5:33 pm

First, you need to set your Apartment state to STA (although this shouldn'e be the main issue).

Code: Select all

[STAThread]
Now to the meat... Ranorex (and most any functional test automation tool) is a functional test tool that interacts with the desktop and it's elements. If there is no desktop, there are no elements. Therefore Ranorex (or any functional test automation tool) will be unable to operate properly. You need to have a valid desktop for your AUT to reside for Ranorex to be able to interact with it.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

benny28
Posts: 34
Joined: Thu May 31, 2012 4:48 pm
Location: London
Contact:

Re: WPF Client & Ranorex cannot interact when VM is disconnected

Post by benny28 » Mon Jan 21, 2013 5:54 pm

But Ranorex can interact with web browser when the VM is disconnected and so can Selenium / Webdriver. Could this be because the interaction is specific to a WFP client?

I'm very surprised if there is no work around/fix for this!

In the mean time I have set up an unused laptop which is always on. And I'm remotely connected to that VM using this laptop. I can then run my tests successfully via TeamCity.
Actually even if I 'lock' the windows session in this situation the tests fail. Everything has to be active!