Logging info from InvokeRemotely

Ask general questions here.
satish
Posts: 3
Joined: Thu Jun 07, 2012 10:23 am

Logging info from InvokeRemotely

Post by satish » Thu Jun 07, 2012 10:33 am

Hi Ranorex team,

Is there any way to log information/report messages to Ranorex Report from InvokeRemotely method.

Can any one please respond to this question.


Thanks
satish

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

Re: Logging info from InvokeRemotely

Post by Support Team » Fri Jun 08, 2012 2:57 pm

Hi,

What exactly do you want do report in your invoked method and why?
Do you want to add logging information to your Ranorex test application or to your application under test.

In general, calling methods from the Report class within InvokeRemotely methods/delegates will not add messages to the default XML file, because the code is executed in a completely different process, i.e. in the process of the control calling InvokeRemotely on.

Regards,
Bernhard
Ranorex Support Team
.
Image

satish
Posts: 3
Joined: Thu Jun 07, 2012 10:23 am

Re: Logging info from InvokeRemotely

Post by satish » Mon Jun 11, 2012 9:50 am

Hi Bernhard

Thanks for your reply.

As the code getting executed in a completely different process I am unable to debug what ever the code written under InvokeRemotely, so I thought is there any other alternate approach so that I could atleast print/display required information in the form of messages on to the screen only for debug purpose.
"Do you want to add logging information to your Ranorex test application or to your application under test."
sorry...I did not get what it means(Ranorex test application vs application under test )...
Thanks
satish

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

Re: Logging info from InvokeRemotely

Post by Support Team » Mon Jun 11, 2012 4:09 pm

Hi,

In general there are various ways how you can print messages for debug purposes. You can for instance write to the console of your automation under test:
MyCrtl.InvokeRemotely(	delegate(System.Windows.Forms.Control control, object Null)
    		{
    			Console.WriteLine("Your Message");
    			return 0;
    		}
            	);
You can also return the debug message as return statement of your invoked method:
// Create the Paremter Object
			object[] MyParams = new object[2];
			// Set Parameter Values
			MyParams[0] = "Ranorex String Value";
			MyParams[1] = 100;
            
			// Invoke public Method
            object res = MyCrtl.InvokeMethod ("Name of your method which should be invoked", MyParams);
            // Handle result from invoked Method
            Report.Info ("Number of Length of Param1: " + res.ToString());

There is also a blog about this topic on our website: Transfering data to and from a .NET control.

Regards,
Bernhard
Ranorex Support Team
.
Image

satish
Posts: 3
Joined: Thu Jun 07, 2012 10:23 am

Re: Logging info from InvokeRemotely

Post by satish » Mon Jun 25, 2012 6:03 am

Thanks Bernhard for your solution...

I have one more question
After using "Optimize Folder Path" or "Abbreviate Item Path" right click options of a repository
If we wanted to go back to original paths, how can we achieve this?

Thanks
Satish

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

Re: Logging info from InvokeRemotely

Post by Support Team » Mon Jun 25, 2012 4:00 pm

Hi,

There is unfortunately no function to get the old RxPath as you overrode it, you just can re-edit it with the path editor, or you can edit it with the Spy tool, there you can for instance click on "Update Path".

Regards,
Markus
Ranorex Support Team
.
Image