Recorder - User Code Items

Ask general questions here.
atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

Recorder - User Code Items

Post by atom » Mon Oct 19, 2009 1:07 pm

Hiya

It would be great if user code items are taken into account when Play is clicked in the Recorder
For this what would we like is in the configuration for this item to have:

- Assembly Name
- Fully qualified name to method (inc. namespace i mean)
- Method parameters (anything that can be serialised)
- For recorder to load assembly, and call method
- The method to return some enumerated result back to recorder

As at the moment Recorder only takes into account these items when code is generated
Meaning clicking Play is useless

Cheers

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Recorder - User Code Items

Post by Support Team » Thu Oct 22, 2009 12:25 pm

Hi atom,
I have added your request to our feature request list.
But I have to say that we have discussed such a feature a time ago and it`s improbable that we will implement it in the near future (maybe in Ranorex 3.0).

Best regards,
Christian
Ranorex Support Team
.
Image

JohnWashburn
Posts: 54
Joined: Wed Jan 09, 2013 7:02 pm

Re: Recorder - User Code Items

Post by JohnWashburn » Wed Jan 28, 2015 11:14 pm

Was this ever added as a feature?

I currently have Ranorex 5.2.2 and don't see how I add a call to method named:
StoreFile()
found in the assembly named:
Cognex.TA.Action.FTP.dll

The method signature is:
public bool Cognex.TA.Action.Ftp.StoreFile( string serverUri, string fileName, string userName, string password);

The line I expect to be called is:
bool success = Cognex.TA.Action.Ftp.StoreFile( serverUri, fileName, userName, password);

A search for
+user +code +method +NET +assembly
across all fora lead me to this old post as the most relevant

So even though the assembly Cognex.TA.Action.FTP.dll is reference by the project, none of the methods from this assembly appear in the drop down list of the Method Name combobox box for a UserCode line within a test script.

What do I have to do in UserCode in order to reference a method within my Cognex.TA.Action.FTP assembly?
Last edited by JohnWashburn on Thu Jan 29, 2015 2:12 am, edited 1 time in total.

JohnWashburn
Posts: 54
Joined: Wed Jan 09, 2013 7:02 pm

Re: Recorder - User Code Items

Post by JohnWashburn » Thu Jan 29, 2015 2:09 am

Even better for me and our exiting test library for items without a GUI interface would be:

UserCode that performs a validation.

Think of this boiler plate code that we have begun to write repeatedly particualrized for my FTP upload example:

Code: Select all

Validate.IsTrue(Cognex.TA.Action.Ftp.StoreFile( serverUri, fileName, userName, password));
I have a great deal of C# code that tests the state of our sensors where the method takes 0-N arguments, performs some action/validation, and returns a bool

Is there some way to within the Ranorex studio to pipe the output of a method from user code into Validate.IsTrue();

Perhaps call the step UserValidation and enforce a requirement that the method called must return a bool.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Recorder - User Code Items

Post by Support Team » Fri Jan 30, 2015 1:40 pm

Hi John,

In order to use your methods from your class, your recording just needs to derive from it, so just add it to the Recording.UserCode.cs class of your specific recordings.

It is currently not possible to also bind the return value of of a custom method to a module variable, but this will be possible with Ranorex 5.3, which should be released in the near future.
So you could then just execute your specific method in your recording's action table and bind the return value to a module variable which can then be used for the Validate action.

Regards,
Markus
.
Image