Pass variable to Repository hosted in separate project

Best practices, code snippets for common functionality, examples, and guidelines.
matthewk
Posts: 11
Joined: Wed Aug 23, 2017 12:10 pm

Pass variable to Repository hosted in separate project

Post by matthewk » Wed Mar 28, 2018 4:07 pm

I have a Ranorex setup running on our CI and working no problems.

We test multiple environments so my Repository takes in a $RootDomain variable depending on which environment is being tested. All working fine when everything was contained in one project in the solution.

I am now looking at restructuring the whole setup to make it more reusable for multiple projects going forward.

I have moved the Repository out in to its own separate project and reference it from other projects in the solution - this is working for the majority of use cases.

The one issue I have is the Repository items which were using the $RootDomain variable. Now it is in a separate project I don't seem to be able to provide this value to the Repository from my other projects in the solution. Does anyone know how this can be achieved?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Pass variable to Repository hosted in separate project

Post by krstcs » Wed Mar 28, 2018 4:27 pm

My recommendation is that you keep your test modules and the repository ALL in the same project. This will ensure that your modules have direct access to the repo without doing any crazy gymnastics to try and get it all to work. Make that project your library or core, and all the other projects are just test suites that use the modules from core.

Mine look like this:

MyTest
--MyTest_Core
----MyModules
----MyRepo
--MyTest_1
----MyTest_1.rxtst
--MyTest_2
----MyTest_2.rxtst
...

Your test suites will just reference MyTest_Core, and you can still just drag-and-drop the test modules from core into the suites in any of your other projects and Ranorex will automatically add the reference for you.

The suites will have their own repo and modules that can be used for suite-specific stuff, if needed, but I rarely do that.

For me, doing it this way is much easier to manage.

This also means that if you have multiple people working on the solution, they can each take a separate project and do their own tests without really impacting anyone else with merges and such. The only issue is that they may all need to merge new modules and repo items into core. I recommend that this be done in a separate branch and each branch be merged back into master as needed with peer-review of merges and conflict resolutions.

Hope this helps!
Shortcuts usually aren't...

matthewk
Posts: 11
Joined: Wed Aug 23, 2017 12:10 pm

Re: Pass variable to Repository hosted in separate project

Post by matthewk » Mon Apr 16, 2018 5:01 pm

Only just seen this - thanks.

I will take a look at implementing as you suggest and see how I get on