How do I prevent failure message to creat screenshots

Ask general questions here.
User avatar
FelixK98
Posts: 54
Joined: Fri Apr 08, 2016 6:28 am

How do I prevent failure message to creat screenshots

Post by FelixK98 » Tue May 10, 2016 5:37 am

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.
You do not have the required permissions to view the files attached to this post.

lucian.teodorescu
Posts: 82
Joined: Fri Oct 24, 2014 10:58 am
Location: Bucharest

Re: How do I prevent failure message to creat screenshots

Post by lucian.teodorescu » Tue May 10, 2016 8:02 am

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.
Lucian Teodorescu
NetSun Software

User avatar
FelixK98
Posts: 54
Joined: Fri Apr 08, 2016 6:28 am

Re: How do I prevent failure message to creat screenshots

Post by FelixK98 » Tue May 10, 2016 10:01 am

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.

lucian.teodorescu
Posts: 82
Joined: Fri Oct 24, 2014 10:58 am
Location: Bucharest

Re: How do I prevent failure message to creat screenshots

Post by lucian.teodorescu » Tue May 10, 2016 10:18 am

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?
Lucian Teodorescu
NetSun Software

User avatar
FelixK98
Posts: 54
Joined: Fri Apr 08, 2016 6:28 am

Re: How do I prevent failure message to creat screenshots

Post by FelixK98 » Wed May 11, 2016 12:32 am

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.