Ranorex could not identify any controls after sometime
-
- Posts: 24
- Joined: Tue Apr 14, 2009 12:29 pm
Re: Ranorex could not identify any controls after sometime
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.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ranorex could not identify any controls after sometime
Some additional thoughts:NUnit is front end for us.
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
Re: Ranorex could not identify any controls after sometime
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.
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.
-
- Posts: 24
- Joined: Tue Apr 14, 2009 12:29 pm
Re: Ranorex could not identify any controls after sometime
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?
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?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ranorex could not identify any controls after sometime
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
I would like to check whether the problem exists only within NUnit or not.
Jenö
Ranorex Team
-
- Posts: 24
- Joined: Tue Apr 14, 2009 12:29 pm
Re: Ranorex could not identify any controls after sometime
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.
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.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ranorex could not identify any controls after sometime
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
It seems to be the same problem you have, so the solution should also work for you.
Jenö
Ranorex Team
-
- Posts: 24
- Joined: Tue Apr 14, 2009 12:29 pm
Re: Ranorex could not identify any controls after sometime
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
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