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

Ranorex Studio, Spy, Recorder, and Driver.
QAEveryday
Posts: 1
Joined: Mon Apr 17, 2017 4:43 pm

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

Post by QAEveryday » Mon Apr 17, 2017 6:41 pm

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

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

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

Post by qwertzu » Wed Apr 19, 2017 8:43 am

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
You do not have the required permissions to view the files attached to this post.

vladimir.trandafilov
Posts: 2
Joined: Wed Feb 15, 2017 2:04 pm

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

Post by vladimir.trandafilov » Mon Jun 19, 2017 2:34 pm

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.

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

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

Post by qwertzu » Wed Jun 28, 2017 10:19 am

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

BSullivan
Posts: 32
Joined: Thu Jun 04, 2015 6:31 pm
Location: HorseHeads NY
Contact:

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

Post by BSullivan » Wed Jun 28, 2017 3:58 pm

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

joyarjit
Posts: 20
Joined: Fri Oct 13, 2017 6:09 am

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

Post by joyarjit » Fri Oct 13, 2017 8:00 am

I created a new user code collection but still i am not seeing anything in the Library.
Please help!

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

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

Post by qwertzu » Mon Oct 23, 2017 8:53 am

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
You do not have the required permissions to view the files attached to this post.

joyarjit
Posts: 20
Joined: Fri Oct 13, 2017 6:09 am

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

Post by joyarjit » Tue Oct 24, 2017 12:33 pm

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.

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

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

Post by odklizec » Tue Oct 24, 2017 1:12 pm

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()
        {
        	
        }
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

joyarjit
Posts: 20
Joined: Fri Oct 13, 2017 6:09 am

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

Post by joyarjit » Tue Oct 24, 2017 1:20 pm

Yes, I forgot to mention that in my code.

Thanks :)