Page 1 of 1

Return code from Ranorex

Posted: Wed Nov 25, 2015 12:25 pm
by giuseppe.lacagnina
Hi.
I am running Ranorex on Windows 7. My version is: 5.3.2.23378
The test case involves IE 11.

I am experiencing the following problem: report files indicate success, but when I try to recover the return value with another application, I see that it actually is -1.

How can that be?

Is there a way to check what the return value is without using my custom application?

Thanks in advance!

Re: Return code from Ranorex

Posted: Wed Nov 25, 2015 2:34 pm
by krstcs
The report is finalized and written to disk prior to the test executable actually ending. It is possible that something in your test executable (especially in Program.cs) is failing AFTER the report is finalized.


Also, 5.3.2 is no longer supported, please update to a supported version (5.4.4 is current release).

Re: Return code from Ranorex

Posted: Wed Nov 25, 2015 2:55 pm
by giuseppe.lacagnina
I will now do an update and see what changes. Thanks!

Re: Return code from Ranorex

Posted: Wed Nov 25, 2015 3:22 pm
by giuseppe.lacagnina
I have updated to 5.4.4 and the problem is still there.
Any hint on how to debug?

Re: Return code from Ranorex

Posted: Wed Nov 25, 2015 3:50 pm
by krstcs
Put a break point in Program.cs just after the test runner ends. You may need to add a line like "int i = 0;" and break on that.

Re: Return code from Ranorex

Posted: Wed Nov 25, 2015 4:28 pm
by giuseppe.lacagnina
I have modified the last part of the Program.cs code as follows:

Code: Select all

string message = "RETURN CODE: " + error.ToString();
Report.Log(ReportLevel.Info, message);            

return error;
is this value I am now getting in the report the correct return code?
Just to be sure... :D

Re: Return code from Ranorex

Posted: Wed Nov 25, 2015 5:06 pm
by krstcs
Should be.

If you look at your Program.cs you should notice that there is a catch that catches any unhandled exception and handles it by setting error to -1.

I would break in there and see if you are getting an unhandled exception. Back track through the trace and see where the problem is.

You PROBABLY have an entry at the VERY END of your report that contains the stack trace, even though your report will show a pass, because the report is finalized before this last catch is hit. I forgot about this in my earlier post (sorry! :D).

Re: Return code from Ranorex

Posted: Wed Nov 25, 2015 5:13 pm
by giuseppe.lacagnina
Thanks!

My problem is that I cannot use break points since I am running Ranorex from another application that calls it and then recovers its return code. That's why I am logging the return code.

Re: Return code from Ranorex

Posted: Wed Nov 25, 2015 10:45 pm
by odklizec
Hi,

Are you sure the return value you are getting is from ranorex exe and not from the other app you are using? Try to run Ranorex exe from command line a read the return code here using errorlevel variable, as described for example here...
http://stackoverflow.com/a/334890

Re: Return code from Ranorex

Posted: Thu Nov 26, 2015 8:43 am
by giuseppe.lacagnina
Hi!

I am exactly investigating this issue :-)
Thanks for the link!!!

G.

Re: Return code from Ranorex

Posted: Thu Nov 26, 2015 12:55 pm
by giuseppe.lacagnina
So, there is an update. I am logging the return code from Ranorex as final act.
I am trying to understand if my application calling Ranorex gets the return value wrong.

I think this is not the case. I noticed that while Ranorex is executing (the test involves IE) I get some strange error messages

LineageGlueRule 'flex-object' caused UnauthorizedAccessException on Execution. Access is denied.

They seem not to affect the Ranorex execution and they are not reported.
I now suspect they might have to do with this return code of -1 that my application seems to get.

Could it make sense? Does anybody know about these error messages?

Re: Return code from Ranorex

Posted: Mon Nov 30, 2015 12:47 pm
by Support Team
Hello giuseppe.lacagnina,

The LineageGlueRule shouldn’t affect the return code of your test executable. As previously mentioned, please update Ranorex. Furthermore, I would also highly recommend to debug your test in order to see the actual return value or logging it to the consol as mentioned from Pavel.

Sincerely,
Robert

Re: Return code from Ranorex

Posted: Tue Dec 01, 2015 1:59 pm
by giuseppe.lacagnina
Hi.

I have already updated to 5.4.4.
The logged return value is zero. I will investigate further.

Thanks again.
All the best,

Giuseppe