Return code from Ranorex

Ask general questions here.
User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Return code from Ranorex

Post by giuseppe.lacagnina » Wed Nov 25, 2015 12:25 pm

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!

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Return code from Ranorex

Post by krstcs » Wed Nov 25, 2015 2:34 pm

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).
Shortcuts usually aren't...

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: Return code from Ranorex

Post by giuseppe.lacagnina » Wed Nov 25, 2015 2:55 pm

I will now do an update and see what changes. Thanks!

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: Return code from Ranorex

Post by giuseppe.lacagnina » Wed Nov 25, 2015 3:22 pm

I have updated to 5.4.4 and the problem is still there.
Any hint on how to debug?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Return code from Ranorex

Post by krstcs » Wed Nov 25, 2015 3:50 pm

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.
Shortcuts usually aren't...

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: Return code from Ranorex

Post by giuseppe.lacagnina » Wed Nov 25, 2015 4:28 pm

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

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Return code from Ranorex

Post by krstcs » Wed Nov 25, 2015 5:06 pm

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).
Shortcuts usually aren't...

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: Return code from Ranorex

Post by giuseppe.lacagnina » Wed Nov 25, 2015 5:13 pm

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.

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

Re: Return code from Ranorex

Post by odklizec » Wed Nov 25, 2015 10:45 pm

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

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: Return code from Ranorex

Post by giuseppe.lacagnina » Thu Nov 26, 2015 8:43 am

Hi!

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

G.

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: Return code from Ranorex

Post by giuseppe.lacagnina » Thu Nov 26, 2015 12:55 pm

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?

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

Re: Return code from Ranorex

Post by Support Team » Mon Nov 30, 2015 12:47 pm

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
.
Image

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: Return code from Ranorex

Post by giuseppe.lacagnina » Tue Dec 01, 2015 1:59 pm

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