Page 1 of 1

Every Report.Info contains a screenshot on failure when run from module/editor

Posted: Thu Jul 08, 2021 10:42 am
by lxsmkv
Hi Ranorexians ,

got Ranorex 9.5.3 here and a question.

I created a recoding module with user code step inside, where i use Report.Log
The strange thing is , when i run this module via "Run Recording" Button or from code editor with "Run Code" Button
and the function fails, then every Report.Info Line in Report Log before the "Error Module - Show/Hide Stacktrace" Line also contains a screenshot.
(I looked into the .data file of the log, it seems that its the same error image file linked to errimg attribute of every log item)

If i run the recodring module from a testsuite as a testcase, this doesn't happen. The Report.Info lines then don't contain any screenshots. Only the Error Line does, as expected.

It also makes no difference if i use Report.Info or Report.Log(ReportLevel.Info,

Can someone explain this logging behaviour? It looks like a bug to me, actually, because it makes no sense.

It matters because it makes the log much less readable when debugging. And imagine i may log hundreds of lines of data while debugging, where i want to check the text data and not screenshot thumbnail.

Re: Every Report.Info contains a screenshot on failure when run from module/editor

Posted: Fri Jul 09, 2021 7:08 am
by odklizec
Hi,

I can only speculate why it works like this, in case of individually started modules, however, there is a solution! Simply put this line to "init" section of each recording module:

Code: Select all

Ranorex.Core.Reporting.TestReport.TracingScreenshotCountLocal=1;
Apparently, it disables tracing screenshots for non-failure (info, warning, success) steps.

Re: Every Report.Info contains a screenshot on failure when run from module/editor

Posted: Fri Jul 09, 2021 10:19 am
by lxsmkv
Hi, Pavel,

It didnt work for me, the report still displays the screenshot for every info line. Which kinda makes sense, because its the same (one) screenshot, just linked many times.

Interestingly, if i set the value to zero

Code: Select all

Ranorex.Core.Reporting.TestReport.TracingScreenshotCountLocal=0;
Studio displays "Ranorex UI Access Launcher stopped working" dialog, but doesnt crash alltogether.

My first hypothesis was also, that it has something to do with tracing screenshots, so i went to Testsuite - [RMB] - Global Parameters - Report and set "Tracing Screenshots " option to "Off". But this had no effect in case of single module execution or code function execution.

Re: Every Report.Info contains a screenshot on failure when run from module/editor

Posted: Fri Jul 09, 2021 10:33 am
by odklizec
Hi,

Well, I'm afraid, it works for me? This is how my user code for given recording looks like and what's the result...
TracingScreenshots.png
Disabling/removing the code results to screenshot for every line.

Re: Every Report.Info contains a screenshot on failure when run from module/editor

Posted: Fri Jul 09, 2021 11:21 am
by lxsmkv
That's strange..
Screenshot_Bug_Info_Log_Screenshots.jpg
P.S: i tried it also on a clean installation of Ranorex 9.5.3, it behaves the same.

Re: Every Report.Info contains a screenshot on failure when run from module/editor

Posted: Fri Jul 09, 2021 11:55 am
by odklizec
Could you please export your actual Ranorex Studio settings and post them here (zipped)? Just go to "Settings" and use "Export..." button. Thanks.

Re: Every Report.Info contains a screenshot on failure when run from module/editor

Posted: Fri Jul 09, 2021 12:20 pm
by lxsmkv
ranorex_settings.zip

Re: Every Report.Info contains a screenshot on failure when run from module/editor

Posted: Fri Jul 09, 2021 1:10 pm
by odklizec
I'm afraid, it still works for me, even with your settings :) Just for fun, please try to run my solution (recording from it) on your PC.
MyTest8.zip

Re: Every Report.Info contains a screenshot on failure when run from module/editor

Posted: Fri Jul 09, 2021 3:13 pm
by lxsmkv
Your solution worked on my side too.
Then I fiddled around with your solution, and found out that it somehow depends on the method you use to fail the function.

In particular, what i tried:

Code: Select all

			// Validate.AttributeEqual(BaseElement, "url", "apples" ); // works
			// Ranorex.Validate.AttributeContains(BaseElement, "url", "apples"); // works
			// Validate.Attribute(BaseElement, "url", "apples"); // works
			// Validate.AttributeRegex(BaseElement, "url", new Regex("apples")); // works
			// Report.Error("There was an Error"); // works
			// BaseElement.WaitForAttributeContains(new Duration(3000), "url", "apples"); // works
			// BaseElement.WaitForNotExists(new Duration(3000)); // works, assuming the website ranorex.info is open.
			// Validate.Exists(".//BigBlueButton"); // works
			
			// Validate.IsTrue(false); // doesn't work
			//int a = 1; Validate.IsFalse(Validate.Equals(a,a)); // doesn't work
			// Report.Failure( "That is a failure");// doesn't work
			// Validate.Fail(); // doesn't work
			// throw new Exception("Something went wrong"); // doesn't work
			// var c = 0; var b = 7 / c; // doesn't work
I did slightly generalized your solution for the test, using just base dom element as repoItem, and downgraded the dotNet requirement to recommended 4.6.2
MyTest8.zip