Hello,
I was wondering if there was a way to control what screenshots are saved to the Reports folder?
Currently, all screenshots taken during a my image validation tests are stored and it is taking up a lot of space. I'd like to only backup the image when a test fails the validation and not when a test passes.
Thank you for any help your able to provide,
Kim
Controlling Screenshots Saved in Reports Folder
Re: Controlling Screenshots Saved in Reports Folder
Hello kgowans,
There is a property for image validation actions called "Report Screenshot".
If you choose "onFail", Screenshots should be saved only if the validation fails.
I hope, this will help.
There is a property for image validation actions called "Report Screenshot".
If you choose "onFail", Screenshots should be saved only if the validation fails.
I hope, this will help.
You do not have the required permissions to view the files attached to this post.
Re: Controlling Screenshots Saved in Reports Folder
Thanks! That is definitely something I didn't know I could do. Is it possible to use this method if I'm using UserCode for image Validation?
Here is the code I'm using to validate:
I'm not sure if maybe the ContainsImage() method or the Report.Log() method are creating all these back up images. I've tried to add a finally condition to delete the screenshot backup if the validation is successful but I could never quite get the location of the backup screenshots.
Thanks again for any help,
Kim
Here is the code I'm using to validate:
Code: Select all
public void validatePages()
{
string expectedPicLocation;
for(int iteration = 1; iteration < this.numberOfPages + 1; iteration++)
{
Imaging.FindOptions findOption = new Imaging.FindOptions(1.0);
expectedPicLocation = this.goodFilePath + nameOfFile + iteration.ToString() + ".png";
Bitmap bmp1 = Ranorex.Imaging.Load(expectedPicLocation);
try
{
Validate.ContainsImage(repo.Common_Office_Popups.PrintPreviewItems.document, bmp1,findOption);
Delay.Milliseconds(100);
}
catch(Exception e)
{
Report.Log(ReportLevel.Error, "Validation Error", "page "+iteration.ToString(), repo.Common_Office_Popups.PrintPreviewItems.nextPageInfo);
}
NavigateToNextPage();
}
}
Thanks again for any help,
Kim
Re: Controlling Screenshots Saved in Reports Folder
Hi,
Unfortunately, it seems like there is no such method to use in UserCode.
But on default, a simple image validation should only save screenshots if the test fails.
If you use the Report.Screenshot(...) method, every image will be stored in you Reports folder.
Unfortunately, it seems like there is no such method to use in UserCode.
But on default, a simple image validation should only save screenshots if the test fails.
If you use the Report.Screenshot(...) method, every image will be stored in you Reports folder.