DocTestLibrary - A Library for Visual Document Testing (and more)

Hey everyone,

I would like to share a new Robot Framework Library with you, that I just released.

It’s a library for visual document testing and the concept is pretty simple:
It loads two documents (e.g. PDF files) and compares them visually.
If they are equal - passed. If they differ - failed.

We use it in our company to test our central output management system after a new release.
To make sure that changes don’t have any “unwanted” effects on the generated outputs.

It has some useful features, like masking parts of the document (pased on text patterns or position) or even accepting small visual differents (like moved areas/texts within a defined range).

It can also check some properties of .pcl and .postscript files, but I guess that’s a very ‘specific’ functionality for our company.

It has a LOT of dependencies (like OpenCV, Tesseract, PyWand, …) so I definitely recommend to install it in a virtual python environment.

Some binaries need to be installed separately (Tesseract-OCR, ImageMagick, Ghostscript, …) but it’s all described in the ReadMe.
A Docker Image will also be provided, until then feel free to build your own container using the included Dockerfile.

It’s still in a very early stage, but the basic functionality (simple comparisons with masks) is working in a reliable way.

It will be presented in my talk at RoboCon 2021
https://robocon.io/#print-is-(not)-dead-–-visual-document-testing-using-robot-framework

Looking forward to hearing your feedback :smiley:

9 Likes

Hi,

I’m facing an issue when i do “Compare Images” call in RF using doctestlibrary.
I need to run the comparison like this

Compare Images ${REFERENCE_DIR}/${filename} ${CANDIDATE_DIR}/${filename} resize_candidate=True blur=True placeholder_file=${MASK_DIR}/${mask}

As you might see, the reference file and the candidate will be of different resolution. The problem i’m facing with this is, that the Mask is not resized/converted correctly for the candidate file and thus this kind of combination seems impossible to achieve with Compare Images keyword atm.

Is this a bug, i would really need this. The problem lies in the fact that i make the tests locally on my laptop which eventually has different resolution compared to when i run the tests in Azure pipeline. I run the tests headlesschorme and set the browser window size staticly
Set Window Size 1920 1080
but still the images i get locally are over 1920x1080 in resolution while the azure pipeline images are 1904x933 in size.

Hi Peter,

Thats an interesting constellation.
The expectation is, that the mask is scaled in the same factor as the candidate file is scaled to the reference image, correct?
I think that should be simple to implement.
Will you support the testing of that change?

1 Like

Yes, im happy to test it out.

ok, I’m working on it and I realized that I made a silly design decision which makes this change a little bit harder to implement than it should be.
But I should have a prerelase soon that you can try.

I created the following issue to track this topic

2 Likes

I created a prerelease 0.23.0dev0

You can install it via
pip install --pre --upgrade robotframework-doctestlibrary

The images are now resized before applying the mask.
This works only, with the argument resize_candidate=True

Pleae give it a try and give me a feedback in the GitHub issue.
Thanks a lot.

2 Likes