Predefine usercode paramters

Best practices, code snippets for common functionality, examples, and guidelines.
florian.mautendorfer
Posts: 5
Joined: Fri Dec 15, 2017 11:50 am

Predefine usercode paramters

Post by florian.mautendorfer » Wed Dec 12, 2018 2:52 pm

Hi everyone,

I am just starting to build one central user code file for our tests and in the process found out that it would be best if i could predefine which pramaters can be given.
In my research i found enums in c# but am not sure if it works or is the way to go.
Could one of you maybe give me a hint? Would be really appreciated!

BR
Florian

User avatar
N612
Posts: 135
Joined: Mon Jul 11, 2016 4:01 pm

Re: Predefine usercode paramters

Post by N612 » Fri Dec 14, 2018 9:32 pm

It is hard to say without more information, but why not keep things simple and use global parameters in Ranorex? These can be accessed in code by data-binding them to your variables or accessing them directly via the code snippet below.

Code: Select all

IDictionary<string, string> allParams = TestSuite.Current.Parameters;

florian.mautendorfer
Posts: 5
Joined: Fri Dec 15, 2017 11:50 am

Re: Predefine usercode paramters

Post by florian.mautendorfer » Mon Jan 28, 2019 5:06 pm

Sorry i totaly overlooked your answer! Thanks for getting back to me

I would prefer to have them in code because your solution would mean to keep them maintained in all our tests and that is something i wanna get rid of mostly.

Right now we have 60 tests and most of the usercode is programmed in all of them sometimes twice or more in each solution.