Page 1 of 1

Variable types in UserCodeMethods

Posted: Thu Feb 14, 2019 12:04 pm
by seurrep
I'm trying to add a function that tests an API end point that would normally expect a number as part of the input. Obviously one of the tests I would like to do is check what happens when other things (blank string or 'A' for example) are passed instead.

I had initially added a UserCodeMethod to actually call the API with a parameter of type object used to pass this value in. The intention being that the type of the parameter would be tested within the code and the JSON suitably generated within it before that JSON is then passed to the API.

The problem seems to be though that Ranorex doesn't seem to show this method in the list when I try and select it from the library to use in a recording. If I change the datatype of the object parameter to something like int then it appears.

Why are object parameters not recognised in functions that I've added to the project? Is it possible to have a function of some sort that can be agnostic in terms of the input and only tests the type of input internally? What would be the best way of going about this?

My colleague has also mentioned another potential issue: if he runs a recording by only running that recording rather than a wider test plan then Ranorex complains about the DPI (after having failed to find elements and subsequently fail the test). If the recording is run as a part of a wider test plan then it appears to work. Is there any reason why this might be the case? I've also just been told he has already looked at your documentation and followed your suggestions but none of these helped solve the issue.

Re: Variable types in UserCodeMethods

Posted: Thu Feb 14, 2019 12:36 pm
by odklizec
Hi,

I'm afraid Ranorex user code methods currently supports only these types:
Argument_types.png
Feel free to post a feature request for more datatypes here:
https://uservoice.ranorex.com/forums/15 ... ve-ranorex

As for DPI, you should always make sure the test machine uses the same DPI scaling across all displays and ideally 100% zoom:
https://www.ranorex.com/#DifferentDispl ... lingValues