robotframework-doctestlibrary
robotframework-doctestlibrary copied to clipboard
OpenCV error when generating differences
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'
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!
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
.
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..
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.
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!
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:
- Taking Screenshots of each element are taken and saving them with a (hopefully ;)) unique name.
- If this is the first time the screenshots are taken, they will be saved as reference screenshots.
- If the reference screenshots already exist, new screenshots will be taken and they will be compared against the reference.
It's a very simple approach and cannot compete with commercial visual testing tools. But maybe it's a start.