Ranorex could not identify any controls after sometime

Class library usage, coding and language questions.
balajichandan
Posts: 24
Joined: Tue Apr 14, 2009 12:29 pm

Re: Ranorex could not identify any controls after sometime

Post by balajichandan » Thu Jun 25, 2009 8:46 am

Even though our class library has 180+ test cases, we run only 45 at a time because of the issue that Ranorex could not identify controls after sometime. I have posted this long back and could not execute 180+ test cases. But we are able to run 180+ test cases with Vista/Office 2007.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Ranorex could not identify any controls after sometime

Post by Support Team » Thu Jun 25, 2009 10:32 pm

NUnit is front end for us.
Some additional thoughts:

1.
Please check the ApartmentState of the NUnit thread, it must be STA (Single Threaded Apartement). Usually, NUnit runs the testing thread with an MTA apartment state while Ranorex assumes STA (and requires STA).

An instruction on how to do that can be found here:
http://www.hedgate.net/articles/2007/01 ... unit-test/
The first option is to place a config file in the same directory as you NUnit test library DLL. The second option is to create a new thread with STA in every test method calling Ranorex.

2.
Is it possible to run the most important part of the test without NUnit (from the command line).
I would like to check whether the problem exists only within NUnit or not.

Jenö
Ranorex Team
.
Image

Skarlso
Posts: 27
Joined: Thu Aug 07, 2008 9:11 am

Re: Ranorex could not identify any controls after sometime

Post by Skarlso » Sun Jun 28, 2009 4:02 pm

Hello!

I have a solution for you...

I too have faced this problem when using nunit and DLL for execution and not EXE.

RanorexSpy is somehow locked up by nunit and that causes all your trouble.

The solution is more of a workaround then really a solution but at least it works.

One: Create Application Domains and put RAnorex into it.
Second this is more simple:

Create a plus Console Application that has the sole purpuse of executing a function that starts your respective test. And that Console Application will be started from your initial test.

So if you have a test like Calculator do the following.

Test: Press + Button.
[Test]
public void runTest( string someparameter)
{
Something.runTest( "PressPlusButton" );
}

This test is called by your Console Application which calls the respective test.
This way the Console Application will be between nunit and the Test. And after the test finishes it is no longer a problem because the EXE garbage collects the RanorexSpy properly. This way your long term test runs weill me no problem anymore.

Please ask away is something is unclear.
Gergely.

balajichandan
Posts: 24
Joined: Tue Apr 14, 2009 12:29 pm

Re: Ranorex could not identify any controls after sometime

Post by balajichandan » Thu Jul 09, 2009 10:28 am

Hi Jeno,
We tried to add the following sections to App.config we use in our project.

<configSections>
<sectionGroup name="NUnit">
<section type="System.Configuration.NameValueSectionHandler"
name="TestRunner"></section>
</sectionGroup>
</configSections>

<NUnit>
<TestRunner>
<add value="STA" key="ApartmentState"></add>
</TestRunner>
</NUnit>
But still we could see the issue.

We tried other approach of running our Ranorex suite of 45 test cases using NUnit console (not GUI) but still we could the issue of System.ArgumentException which is similar to Access Violation exception. From then on, Ranorex could not identify any controls. But if we perform operations manually on Outlook, we were able to do it.

In our Ranorex Automation we already have [STAThread] attribute, to make our application work in Single Threaded Apartment.

We tried with latest patches 1.5.1.5519 and 1.5.2.6413 but it did not help us.
Is there anything which can help us to solve the problem?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Ranorex could not identify any controls after sometime

Post by Support Team » Fri Jul 10, 2009 3:56 pm

Is it possible to run the most important part of the test without NUnit (from the command line)?
I would like to check whether the problem exists only within NUnit or not.

Jenö
Ranorex Team
.
Image

balajichandan
Posts: 24
Joined: Tue Apr 14, 2009 12:29 pm

Re: Ranorex could not identify any controls after sometime

Post by balajichandan » Mon Jul 13, 2009 7:58 am

We tried running it using NUnit console, but still we could see same issue.

Is there any logs that I can enable on my machine to capture information for RanorexNet or RanorexCore dlls. Please let me know, it might help to know the issue exactly.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Ranorex could not identify any controls after sometime

Post by Support Team » Tue Jul 14, 2009 2:01 pm

Can you please try the solution Gergely (Skarlso, Sun Jun 28, 2009) suggested.
It seems to be the same problem you have, so the solution should also work for you.

Jenö
Ranorex Team
.
Image

balajichandan
Posts: 24
Joined: Tue Apr 14, 2009 12:29 pm

Re: Ranorex could not identify any controls after sometime

Post by balajichandan » Tue Jul 14, 2009 4:39 pm

Hi SKarlso,

Can you give more detail about what you mean by plus console application. If you can provide a small code snippet that would be great.
Thanks in advance