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

Ask general questions here.
Andrew.Finkernagel
Posts: 2
Joined: Wed Jul 24, 2019 4:50 pm

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

Post by Andrew.Finkernagel » Wed Jul 24, 2019 4:55 pm

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.

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

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

Post by N612 » Fri Jul 26, 2019 8:54 pm

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.

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

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

Post by odklizec » Mon Aug 05, 2019 8:36 am

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
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