Page 1 of 1

Validation Failure of screenshot

Posted: Mon Oct 17, 2016 10:57 am
by Sandra
Hello,
My test environment is Win 7 Enterprise 64 bit Service Pack 1. Ranorex version 5.4.6.
I am trying to validate an image but it is failing to validate. The code is;
void ITestModule.Run()
        {
            Mouse.DefaultMoveTime = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor = 1.0;

            Init();

            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'Window1' at CenterRight.", repo.Window1.SelfInfo, new RecordItemIndex(0));
            repo.Window1.Self.Click("CenterRight");
            Delay.Milliseconds(0);
            
            Report.Log(ReportLevel.Info, "Validation", "Validating ContainsImage (Screenshot: 'Screenshot4' with region {X=705,Y=240,Width=194,Height=194}) on item 'Window1.DdDisplayPanel'.", repo.Window1.DdDisplayPanelInfo, new RecordItemIndex(1));
            Validate.ContainsImage(repo.Window1.DdDisplayPanelInfo, DdDisplayPanel_Screenshot4, DdDisplayPanel_Screenshot4_Options);
            Delay.Milliseconds(100);
            
        }
But it fails each time saying that the screen shot does not contain the image. But in the log file, I can clearly see the image in each screen shot.
I edited the settings by going to Settings, Imaging and selected Edges, Edges Sobel, Grayscale and I changed the similarity to 0.99 but these changes didn't seem to make a difference to the validation outcome.

The log file is attached;
images_GSWorksTestSuite_20161017_095424.zip
Thank you.

Edit by Ranorex Support: Formatted Code

Re: Validation Failure of screenshot

Posted: Wed Oct 19, 2016 1:31 pm
by Support Team
Hi Sandra,

First of all I'd like to mention that Ranorex 5.4.6 is already outdated and not supported anymore. It is highly recommended using a supported version (6.0.2 / 6.1.1).

Secondly, please upload your Ranorex report in the Rxzlog-format. The achieve you have uploaded only contains screenshots.

Additionally, may I ask you if you already had the chance to take a look on our blog posting about Enhanced Features of Image Validation. This posting describes some additional settings which can be helpful in debugging image based errors.

Hope that helps :)

Regards,
Markus (s)

Re: Validation Failure of screenshot

Posted: Wed Oct 19, 2016 4:11 pm
by Sandra
Hello,

I only started using Ranorex in March. I wasn't aware the version was out of date already.
When I go to upload the report, I get a message saying "The extension rxzlog is not allowed". How do I post the report?
Could the validation be failing because the screenshot is not the same size as the repository item?

Thank you,
Sandra.

Re: Validation Failure of screenshot

Posted: Thu Oct 20, 2016 7:44 am
by odklizec
Hi Sandra,

You can rename "rxzlog" extension to "zip", then it should be possible to upload it without a problem.

As for the different size of screenshot for image validation, yes, this is an issue! Validated image must have the same size as the reference one, otherwise the image validation will fail!

Re: Validation Failure of screenshot

Posted: Thu Oct 20, 2016 9:21 am
by Sandra
Report log is attached.

Re: Validation Failure of screenshot

Posted: Thu Oct 20, 2016 10:06 am
by Sandra
Thanks for the replies. I have solved the issue by re-sizing the screenshot image.