Integration & Run Ranorex tests in TFS

Experiences, small talk, and other automation gossip.
honeychawla
Posts: 6
Joined: Thu Feb 16, 2017 12:48 pm

Integration & Run Ranorex tests in TFS

Post by honeychawla » Tue Aug 06, 2019 11:11 am

I have Ranorex test project code in TFS and I want to run my tests on VM where ranorex runtime license is installed.

The test code is build along with AUT code but I am not able to run the tests on the VM.

AUT as well as Ranorex project is build on Build agent where no Ranorex is installed. The build is successful.

Note: There is no Ranorex installed on the build agent, so test code is build by simply command line operation: msbuild solution.sln

Now, I have a VM where Ranorex 9.1 is installed and runtime license is also installed, I want to run my tests there.
I take the exe build and try to run the tests, the tests are failing as Ranorex references are not able to find out.

Anything I am missing?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Integration & Run Ranorex tests in TFS

Post by Support Team » Tue Aug 06, 2019 7:36 pm

Hello Honeychawla,

I recommend installing Ranorex 9.1 on the build machine as it will be the easiest way to resolve this issue.

Regards,
Sean

honeychawla
Posts: 6
Joined: Thu Feb 16, 2017 12:48 pm

Re: Integration & Run Ranorex tests in TFS

Post by honeychawla » Fri Aug 09, 2019 8:13 am

Hi,
This is not possible as build agents are in different region and I don't have access to it.

Is there any possible solution? Or, Ranorex project has to be build with Ranorex installed on the machine? Is this mandatory?

I want to implement CI/CD and run the tests as soon as build is deployed.

Regards,
Honey.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Integration & Run Ranorex tests in TFS

Post by odklizec » Fri Aug 09, 2019 8:33 am

Hi,

As far as I know, Ranorex Studio is not really required on build machine. Could you please post exact error you are getting while running the test on target VM?

If build passed successful on build VM, the compiled test should work just fine on target VM. The question is, if you copied all necessary files from the bin directory and if Ranorex version installed on test VM is the same as the one used for creating your tests (9.1)? If the test stored in TFS was created with different version than installed on test VM, the compiled project will not work!
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

honeychawla
Posts: 6
Joined: Thu Feb 16, 2017 12:48 pm

Re: Integration & Run Ranorex tests in TFS

Post by honeychawla » Wed Aug 14, 2019 8:35 am

Following exception I am getting while running tests on Target VM:

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Ranorex.Core.WinApi, Version=9.1.0.0, Culture=neutral, PublicKeyToken=b798506b574ebc9a' or one of its dependencies. An attempt was made to load a program with an incorrect format.
at Ranorex.Keyboard.UpdateLowLevelKeyboardHookCallback()
at Ranorex.Keyboard.set_AbortKey(Keys value)
at PAA_Automation.Program.Main(String[] args) in D:\TFS\Src\PAA\Main\src\TestAutomationUI\PAA\Program.cs:line 34

The above error is coming when I copied complete Runtime folder to the location from where .exe is executed.

Couple of points for consideration:
1) I do not have even Ranorex runtime installed on the TFS agent/build machine. The code is build through msbuild and exe is generated.

2) If build passed successful on build VM, the compiled test should work just fine on target VM. --->> The size of exe is only 5KB after the release build.
If i build on a machine where Ranorex runtime is present, the size is 16KB of the release build.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Integration & Run Ranorex tests in TFS

Post by odklizec » Wed Aug 14, 2019 9:27 am

Hi,

To be quite honest, I have no experience with building Ranorex solutions on machine, without installed Ranorex. My tests are always built with msbuild (via Jenkins) on build machine with installed Ranorex, yet Ranorex is not used at all on this machine. So I'm not experiencing any build-related issues. In the end, it may be required to have, at very least, Ranorex core libs installed on build machine? Take it as a pre-requisity and simply install Ranorex core libs there. If you don't have access to the build machine then ask someone who can do it for you.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

honeychawla
Posts: 6
Joined: Thu Feb 16, 2017 12:48 pm

Re: Integration & Run Ranorex tests in TFS

Post by honeychawla » Fri Aug 16, 2019 3:05 pm

It is working now. The Ranorex test code build on TFS agent is running succesfully on Target VM (where Ranorex Runtime is installed).

Link: https://www.ranorex.com/help/latest/int ... tegration/

Following 2 lines have to be added at start of Program.cs

InitResolver();
RanorexInit();