Page 1 of 1

How do I prevent failure message to creat screenshots

Posted: Tue May 10, 2016 5:37 am
by FelixK98
Hi Everyone,

I got the following code:
Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Visible='True') on item 'AuComPlanetinnovationGidget.GidgetApp.MultipartLabelAlert'.", repo.AuComPlanetinnovationGidget.GidgetApp.MultipartLabelAlert.SelfInfo);
            try {
	            Validate.Attribute(repo.AuComPlanetinnovationGidget.GidgetApp.MultipartLabelAlert.SelfInfo, "Visible", "True");
            }
            catch(ValidationException e) {
            	Report.Log(ReportLevel.Failure,"Failure",e.Message.ToString());
            	return;
            }
Us result of the test run I am getting the following failure in report:
Failure_in_report.PNG
How can I disable screenshots in Validate function and still have it in first Report.Log function.

Thanks,
Felix.

Re: How do I prevent failure message to creat screenshots

Posted: Tue May 10, 2016 8:02 am
by lucian.teodorescu
Hi Felix,

First, set 'Tracing Mode' to Off: right-click Test Suite > Properties > Report > Tracing Screenshots.

Then, to make sure you have the screenshot you need, add Report.Screenshot(Element target); before your Report.Failure() or Report.Log(ReportLevel.Failure...)

Hope this solves your problem.

Re: How do I prevent failure message to creat screenshots

Posted: Tue May 10, 2016 10:01 am
by FelixK98
Hi lucian.teodorescu,

Thank you for reply.
All our Ranorex projects actually should be build by MS VS2015 without using Ranorex Studio.
I am looking for solution that will not use any Ranorax Studio settings.
Is it possible, to add function which will disable screenshots?

Thanks,
Felix.

Re: How do I prevent failure message to creat screenshots

Posted: Tue May 10, 2016 10:18 am
by lucian.teodorescu
Hi Felix,

In this case you can change the settings from code (choose your best place where to do this: for the entire Test Suite - in Main, or local).

Code: Select all

Ranorex.Core.Reporting.TestReport.EnableTracingScreenshots = false;
Then, as I said you can still report a screenshot, 'on demand' using Report.Screenshot() - check which one of the 6 overloads suits your needs.

Hope this helps?

Re: How do I prevent failure message to creat screenshots

Posted: Wed May 11, 2016 12:32 am
by FelixK98
Hi lucian.teodorescu,

Thank you for help. It is exactly what I was looking for. All screenshots that I need I can get by using Report.Screenshot().

Thanks,
Felix.