manykarim / robotframework-doctestlibrary

Robot Framework DocTest library. Simple Automated Visual Document Testing.
Apache License 2.0
46 stars 20 forks source link

OpenCV error when generating differences #29

Open ipatterson opened 2 years ago

ipatterson commented 2 years ago

When the report is generating differences, it seems to error out in the process. Both images loaded without issue and are of the same dimensions.

error: OpenCV(4.5.4-dev) /tmp/pip-req-build-hcfz06yx/opencv/modules/imgproc/src/templmatch.cpp:587: 
error: (-215:Assertion failed) corr.rows <= img.rows + templ.rows - 1 && corr.cols <= img.cols + templ.cols - 1 in function 'crossCorr'
manykarim commented 2 years ago

Did you use any special options like the 'movetolerance' for that comparison? Or any masks/placeholders to ignore areas? Or just the Compare Images keyword without any further options? What type of files were compared? (PNG, jpg, PDF, ..) Would be great if you could share the test files that you used (e.g. via Mail)

Thanks a lot!

ipatterson commented 2 years ago

This happens when using move tolerance of any value. But no masks or placeholders are used. The files are PNG images. I managed to recreate it with these images with a move tolerance of 40

test-current test-expected .

manykarim commented 2 years ago

Sorry for the long delay. I added a temporary fix to the code, so that the test case fails properly including the highlighted differences in the report. But the problem runs a bit deeper.

What I can already say: The Library has a problem with the move_tolerance, if the moved parts are REALLY far away from each other. And I guess some other mathematical problems when calculating the distance ;)

Anyway, I published a new version with the temporary fix and some other features, I hope I can solve this problem properly in the next weeks..

manykarim commented 2 years ago

But one question: Do I see it correctly, that you want to use the Library for Visual Testing of Web Applications? (like in your example screenshot?) If yes, I could share an interesting example where I use the Library together with the Robot Framework Browser Library. In that example, each control is visually compared.

ipatterson commented 2 years ago

No worries! It was the holiday season, and I just got back, myself.

But to answer your question, yes, we are using this for testing web apps. I'd be interested in seeing your example!

manykarim commented 2 years ago

I added the example (it's just an experiment) to the repository by mistake 😄 , so let's just keep it :

https://github.com/manykarim/robotframework-doctestlibrary/blob/main/atest/Browser.robot

It uses the Browser Library to open a web page. The goal was to verify each control separately (elements of type input, button, h1, h2, h3, h4).

It's acomplished by:

It's a very simple approach and cannot compete with commercial visual testing tools. But maybe it's a start.