Page 1 of 1

Why do I not see all my user code methods in the Library?

Posted: Mon Apr 17, 2017 6:41 pm
by QAEveryday
I am new to Ranorex and am using the Trial version of 7.0...I have been successfully using all the features and the Repository so far...I have edited one of my user code methods today and since I changed the parameters, I got a compile error naturally. I deleted the existing user code action and when I tried to add the edited method, I cannot find the method in the Library....any idea why??

Re: Why do I not see all my user code methods in the Library?

Posted: Wed Apr 19, 2017 8:43 am
by qwertzu
Hello QAEveryday,

I would suggest creating a User Code Collection. This is a file in which you are able to create different user code methods which will be stored in the user code library.

In order to create a User Code Collection, simply choose "Add" --> "New Item" within the context menu of your project. Afterwards, select "User Code Collection".
AddNewItem.png
Afterwards, the file can be found in your project browser:
UserCodeCollection.png
Now, you can simply add new user code methods:
UserCodeMethods.png
These methods can be used in each recording by simply adding it from the user Code Library.
Therefore choose "Add new action" --> "User Code" --> "Select from Library" within a recording.

I hope, this helps.

regards,

qwertzu

Re: Why do I not see all my user code methods in the Library?

Posted: Mon Jun 19, 2017 2:34 pm
by vladimir.trandafilov
qwertzu wrote:Hello QAEveryday,

I would suggest creating a User Code Collection. This is a file in which you are able to create different user code methods which will be stored in the user code library.

In order to create a User Code Collection, simply choose "Add" --> "New Item" within the context menu of your project. Afterwards, select "User Code Collection".
AddNewItem.png
Afterwards, the file can be found in your project browser:
UserCodeCollection.png
Now, you can simply add new user code methods:
UserCodeMethods.png
These methods can be used in each recording by simply adding it from the user Code Library.
Therefore choose "Add new action" --> "User Code" --> "Select from Library" within a recording.

I hope, this helps.

regards,

qwertzu
Hi all!

Could I use another types (different from string) for parameters in methods from UserCollection?
When I try to add no-string parameters to my method, it becomes unavailable from User code library.

BR.

Re: Why do I not see all my user code methods in the Library?

Posted: Wed Jun 28, 2017 10:19 am
by qwertzu
Hi Vladimir,

Could you please explain what exactly you want to achieve in your method?
Please post the code you are using, so we can give you further hints.

regards,
qwertzu

Re: Why do I not see all my user code methods in the Library?

Posted: Wed Jun 28, 2017 3:58 pm
by BSullivan
Hey,

I had similar issues when 7.0 dropped. Here is the info that I got then, it looks to still be pretty accurate now.

https://www.ranorex.com/forum/new-code- ... 10323.html

Re: Why do I not see all my user code methods in the Library?

Posted: Fri Oct 13, 2017 8:00 am
by joyarjit
I created a new user code collection but still i am not seeing anything in the Library.
Please help!

Re: Why do I not see all my user code methods in the Library?

Posted: Mon Oct 23, 2017 8:53 am
by qwertzu
Hi joyarjit ,
Are you sure, you created a method within the UserCode Libraray?
An easy way to do so, is right click --> insert new usercode method.
insert_UserCodeMethod.png
Afterwards, you should be able to find this method within your usercode library.

regards, qwertzu

Re: Why do I not see all my user code methods in the Library?

Posted: Tue Oct 24, 2017 12:33 pm
by joyarjit
Hi Qwertzu,

If I myself define the method rather right clicking(as in your screenshot) it does not work.

But, when I define method using the way you mentioned then I am able to see the method in user code library.


Regards.

Re: Why do I not see all my user code methods in the Library?

Posted: Tue Oct 24, 2017 1:12 pm
by odklizec
Hi,
joyarjit wrote:Hi Qwertzu,
If I myself define the method rather right clicking(as in your screenshot) it does not work.
In my opinion, you forgot to add this line right before the definition of your method...
[UserCodeMethod]
Without this line, the method is not recognized as UserCodeCollection method. So the method should look like this:

Code: Select all

        [UserCodeMethod]
        public static void UserCodeMethod()
        {
        	
        }

Re: Why do I not see all my user code methods in the Library?

Posted: Tue Oct 24, 2017 1:20 pm
by joyarjit
Yes, I forgot to mention that in my code.

Thanks :)