Unable to run tests after upgrading to Ranorex 8

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
sherinjab
Posts: 23
Joined: Wed Oct 08, 2014 2:57 pm

Unable to run tests after upgrading to Ranorex 8

Post by sherinjab » Tue Feb 20, 2018 2:45 pm

Hi,

I recently upgraded my Ranorex version from 6.1 to 8 and finding it really hard to get my tests running again. We run our tests from Visual Studio instead of Ranorex Studio and before worked by just adding the dlls Ranorex.Core and Ranorex.Plugin.Winforms as reference to run the tests on our desktop application.
However after installing Ranorex 8 and changing the reference to the new version, I had to add a lot more dlls to get the build to be successful. I had to add all the plugins even though I do not intend to use them, which is a bit weird compared to how it worked before.
Now I've got the build to be successful, however still can't get the tests to run as I get the error as below

Assert.Fail failed. Assembly Initialize failed. Could not load file or assembly 'Ranorex.Plugin.Win32, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b798506b574ebc9a' or one of its dependencies. The system cannot find the file specified.
StackTrace
at Ranorex.Core.PluginManager.LoadDefaultPlugins(Boolean nonBlocking)
at Ranorex.Core.PluginManager.LoadDefaultPluginsSuppressible(Boolean nonBlocking)
at Ranorex.Core.Configuration.set_Item(CaseInsensitiveString name, Object value)
at .AssemblyInit(TestContext context)

I noticed that if I debug the code and wait for few seconds the code executes fine without the error. Does this mean there is a delay in loading the plugins causing it to fail when executed quickly? I've added this dll as reference too (64bit) and hence not sure why it can't still find it

ahoisl
Certified Professional
Certified Professional
Posts: 125
Joined: Fri Sep 07, 2007 8:16 am

Re: Unable to run tests after upgrading to Ranorex 8

Post by ahoisl » Tue Feb 20, 2018 11:07 pm

As Ranorex 8 no longer installs assemblies into the GAC, you need to call some bootstrapping code (which is automatically added when using Ranorex Studio) which allows Ranorex to find its libraries. The whole process on how to do that with Visual Studio is in detail documented here:
https://www.ranorex.com/help/latest/vis ... ntegration
sherinjab wrote:I had to add all the plugins even though I do not intend to use them, which is a bit weird compared to how it worked before.
The default instruction is to add all plugins as references, but actually you should only need those technology plugins which you are using adapters from, e.g. the "Control" adapter is defined in the Ranorex.Plugin.WinForms.dll. The underlying mechanism for the technology plugins did not change, just the loading/bootstrapping of Ranorex DLLs.

So, my suggestion is: please try to follow the instructions and when you are all good, try deleting some of the plugin references that you think you don't need.

Regards,
Alex
Ranorex Team

sherinjab
Posts: 23
Joined: Wed Oct 08, 2014 2:57 pm

Re: Unable to run tests after upgrading to Ranorex 8

Post by sherinjab » Thu Feb 22, 2018 5:26 pm

Hi Alex,
Thanks for the instructions and it definitely helped getting the tests running locally and I could also reduce the number of plugins to just the Winforms one add another additional dll i.e Ranorex.Libs.Util. However, now I cannot run the tests on teamcity due to the same error. I'm trying to the run the tests from the same VS files checked out on teamcity and the error happens while executing the 2nd line of code from below:

Code: Select all

 var config = new Ranorex.Core.Configuration(Ranorex.Core.Configuration.Current);
                    config.Input.AsynchronousDispatching = false;
The error is as follows:
Assert.Fail failed. Assembly Initialize failed. Failed to load default plugins. Please reinstall Ranorex. at Ranorex.Core.PluginManager.LoadDefaultPlugins(Boolean nonBlocking)
at Ranorex.Core.PluginManager.LoadDefaultPluginsSuppressible(Boolean nonBlocking)
at Ranorex.Core.Configuration.set_Item(CaseInsensitiveString name, Object value)
at Ranorex.Core.Configuration.InputConfig.set_AsynchronousDispatching(Boolean value)
at HubbleDesktopAutomation.InitializerMethods.AssemblyInit(TestContext context)

Thanks,
Sherin

ahoisl
Certified Professional
Certified Professional
Posts: 125
Joined: Fri Sep 07, 2007 8:16 am

Re: Unable to run tests after upgrading to Ranorex 8

Post by ahoisl » Thu Feb 22, 2018 8:37 pm

sherinjab wrote:I'm trying to the run the tests from the same VS files checked out on teamcity and the error happens while executing the 2nd line of code from below:
Do you have Ranorex installed on the teamcity machine, too? Or alternatively followed the XCOPY deployment instructions?
From a deployment perspective, you still need Ranorex installed or all required DLLs copied to the machine (as instructed above) that you want to run Ranorex tests on.

Regards,
Alex
Ranorex Team

sherinjab
Posts: 23
Joined: Wed Oct 08, 2014 2:57 pm

Re: Unable to run tests after upgrading to Ranorex 8

Post by sherinjab » Fri Feb 23, 2018 9:20 am

Yes I do have Ranorex installed even there with a Runtime license. The runs from teamcity worked fine on the same agent when I had Ranorex 6.1. The error has come up only after upgrading to the latest version.

ahoisl
Certified Professional
Certified Professional
Posts: 125
Joined: Fri Sep 07, 2007 8:16 am

Re: Unable to run tests after upgrading to Ranorex 8

Post by ahoisl » Fri Feb 23, 2018 9:25 am

Did you try to run the tests on the teamcity machine without teamcity, I mean by starting them manually?
If you tests run locally, the same should be possible on teamcity. Did you install all prerequisites (C++ runtimes) as well? Please, install Ranorex using the self-extracting exe file (here is the link to the currently latest version 8.0.1).

Regards,
Alex
Ranorex Team

sherinjab
Posts: 23
Joined: Wed Oct 08, 2014 2:57 pm

Re: Unable to run tests after upgrading to Ranorex 8

Post by sherinjab » Fri Feb 23, 2018 9:58 am

Yes, tried running without teamcity and I still get the same error. I can find all the C++ runtime dlls too. Also tried using the latest version sent by you but still sadly facing the same issue.

Thanks,
Sherin

sherinjab
Posts: 23
Joined: Wed Oct 08, 2014 2:57 pm

Re: Unable to run tests after upgrading to Ranorex 8

Post by sherinjab » Fri Feb 23, 2018 2:45 pm

FYI, I even tried to comment the lines which failed before and see if it would work for other code which looks for a Ranorex form and got the error
"Could not load file or assembly 'Ranorex.Core.WinApi, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b798506b574ebc9a' or one of its dependencies. An attempt was made to load a program with an incorrect format. "

I did not need to add this dll on my local machine to run the test but to make sure the test passes on the test agent I even tried after copying all Ranorex plugin dlls to the folder from where the tests are executed but still no luck getting it to work.

ahoisl
Certified Professional
Certified Professional
Posts: 125
Joined: Fri Sep 07, 2007 8:16 am

Re: Unable to run tests after upgrading to Ranorex 8

Post by ahoisl » Sun Feb 25, 2018 10:54 pm

A few things you can try so we can narrow down the problem:
  • Run any of the Ranorex tools (Spy, Recorder, Studio) on the teamcity machine to verify Ranorex is installed correctly
  • Create a new default project with Ranorex Studio and run this on the teamcity machine
  • Change the target platform/CPU for your test suite project once to "x86" and once to "Any CPU"
  • Use XCOPY deployment instead of installing Ranorex
Regards,
Alex
Ranorex Team

Rith
Posts: 1
Joined: Sat Oct 13, 2018 10:20 pm

Re: Unable to run tests after upgrading to Ranorex 8

Post by Rith » Sat Oct 13, 2018 10:26 pm

Hello Alex,

I'm facing the same issue as described here unable-to-run-tests-after-upgrading-to- ... 11888.html
I've tried all the steps as you suggested on the last post and still having an issue.

Could you please help?

Regards,

Rith

qwertzu
Posts: 179
Joined: Wed Jan 25, 2017 11:08 am

Re: Unable to run tests after upgrading to Ranorex 8

Post by qwertzu » Mon Oct 15, 2018 3:06 pm

Hi Rith,

so you mean, the error also appeared in a newly created solution on this machine?
Then, I would suggest a clean re-installation of Ranorex by first uninstalling Ranorex, then restarting your machine and finally installing it via the *.exe. (Also, I would recommend installing Ranorex 8.3)
regards, qwertzu