Page 1 of 1

Integration & Run Ranorex tests in TFS

Posted: Tue Aug 06, 2019 11:11 am
by honeychawla
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?

Re: Integration & Run Ranorex tests in TFS

Posted: Tue Aug 06, 2019 7:36 pm
by Support Team
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

Re: Integration & Run Ranorex tests in TFS

Posted: Fri Aug 09, 2019 8:13 am
by honeychawla
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.

Re: Integration & Run Ranorex tests in TFS

Posted: Fri Aug 09, 2019 8:33 am
by odklizec
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!

Re: Integration & Run Ranorex tests in TFS

Posted: Wed Aug 14, 2019 8:35 am
by honeychawla
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.

Re: Integration & Run Ranorex tests in TFS

Posted: Wed Aug 14, 2019 9:27 am
by odklizec
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.

Re: Integration & Run Ranorex tests in TFS

Posted: Fri Aug 16, 2019 3:05 pm
by honeychawla
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();