In general, we compare two images when we’d like to detect differences between them in visual.
I believe OpenCV and ImageMagick are famous tools to achieve the purpose lately. But sometimes we faced building errors, for example. So, I’ve used a simple enough comparison tool. That is Kobold. The library uses blink-diff as a comparison engine. The library provides some features to configure how to compare each other.
I’ve published Ruby wrapper to use them.
- Ruby wrapper: https://github.com/KazuCocoa/koboldy
And you can also see some articles for it on this site. (Most of them are Japanese, and you need to translate though…) Link
By the way, I also researched some similar and straightforward libraries. I believe perceptualdiff also a famous library. I compared ImageMagick and perceptualdiff a bit before.
A few years ago, I started to investigate OpenCV, opencv_sample is one example, to make such comparison more flexible. The reason why I investigated it is many guys have been implemented Machine Learning / Deep Learning features in it. So I’ve believed it helps us.
And lately, Appium is going to support OpenCV based comparison features as one of the fundamental features. https://github.com/appium/appium-support/pull/65 is the brilliant PR. We can use some OpenCV features via them. We are also able to get diff images to ensure the results in visual.
The feature will help many users who would like to get image comparison easy.
Actually, to make test suites stable, separating steps are important like:
- Conduct test cases and assert the results without image comparison
- Compare images
- Collect and save the results
Otherwise, the new Appium feature will encourage automation more, I believe.