Page 1 of 1

Return values of user-created methods required to be strings?

Posted: Wed Jul 24, 2019 4:55 pm
by Andrew.Finkernagel
Hello,

I'm trying to implement some database queries and validation of the returns into my testing modules. I'm creating my own methods and ideally would like to create methods that are modular and re-usable. It seems that when returning a value from a user-created method, the return value must be in the form of a string. This makes my task much more complicated and maybe impossible.

Am I looking at this the wrong way? If I go into the code and change the return values of my methods from strings to booleans or objects, is that going to break my tests when I eventually run them? My process for creating these methods is very slow as I'm a novice at C#, but I would hate to put a lot of time into building code that eventually just doesn't work.

Thanks in advance.

Re: Return values of user-created methods required to be strings?

Posted: Fri Jul 26, 2019 8:54 pm
by N612
Since Ranorex has a very open design, is based on .NET, and everything in the background is C# (or VB.NET), you can write your own methods/classes however you see fit and pass data around anyway you would like. However, if you want to use any of this data with Ranorex actions/API (such as validation, key-sequences, set-value), it generally needs to be a string.

Re: Return values of user-created methods required to be strings?

Posted: Mon Aug 05, 2019 8:36 am
by odklizec
Hi,

Aside to what N612 suggested, you can always convert string variable to number, if this is what you are after? https://www.cambiaresearch.com/articles ... -in-csharp