How to disable report screenshots by code
Posted: Thu Sep 14, 2017 3:25 pm
Hi,
I'm using Ranorex 7.0.1 and I'm needing to disable the screenshots of the report inside a code module, but only for a single validation.
I have some code that invokes some web service and evaluate the result. If some error is detected, I want to throw an error message on the report, mark the test case as failed, and stop the test execution and continue with next one.
I found that Ranorex.Validate.Fail("My error message"); does the thing I need, but it also produce a Screenshot (totally useless) in the report. I want to disable the screenshots but only for that sentence, but I want the screenshots for the rest of the test case (other sentences interacts with the UI and the screenshots are very usefull).
I can't find any reference about the code to do that. I tried the following code (probably it's wrong):
Ranorex.Validate.ResultOption vResultOption = new Ranorex.Validate.ResultOption();
vResultOption = Ranorex.Validate.ResultOption.Never;
Ranorex.Validate.Options vValidateOptions = new Validate.Options(vResultOption);
Ranorex.Validate.Fail("My erro message", vValidateOptions);
But nothing happened. The error on the report stills include the screenshot.
I would appreciate if someone could help me with that. Is very important to avoid taking screenshot on these senteces due to the overhead of snapshot and storage those pictures.
Thanks in advance!
Regards,
Simón
I'm using Ranorex 7.0.1 and I'm needing to disable the screenshots of the report inside a code module, but only for a single validation.
I have some code that invokes some web service and evaluate the result. If some error is detected, I want to throw an error message on the report, mark the test case as failed, and stop the test execution and continue with next one.
I found that Ranorex.Validate.Fail("My error message"); does the thing I need, but it also produce a Screenshot (totally useless) in the report. I want to disable the screenshots but only for that sentence, but I want the screenshots for the rest of the test case (other sentences interacts with the UI and the screenshots are very usefull).
I can't find any reference about the code to do that. I tried the following code (probably it's wrong):
Ranorex.Validate.ResultOption vResultOption = new Ranorex.Validate.ResultOption();
vResultOption = Ranorex.Validate.ResultOption.Never;
Ranorex.Validate.Options vValidateOptions = new Validate.Options(vResultOption);
Ranorex.Validate.Fail("My erro message", vValidateOptions);
But nothing happened. The error on the report stills include the screenshot.
I would appreciate if someone could help me with that. Is very important to avoid taking screenshot on these senteces due to the overhead of snapshot and storage those pictures.
Thanks in advance!
Regards,
Simón