The ZUL Testing Language(ZTL) has been available for one year and during this time we have looked into improving the verification of layout placement, which is hard to do using normal unit testing techniques. This led to the idea of a visual comparison to locate any discrepancies. The capture image API in Selenium-RC provided does not satisfy our requirements and it is not ready for all the modern browsers. However, we found a way to solve the capture image issue, and found a method will allows comparison between images from the same browser. Please take a look at the demo below.
As you can see, we encapsulate the image comparison algorithm into a Java API called verifyImage(), which compares the current image with the other, and if an area is different, the test case will throw a JUnit AssertionError exception, identify the area which failed and store the result for debugging purposes.
We are going to add this feature to our current ZTL’s test cases. So far we have created hundreds of test cases and run them on a daily basis when someone changes ZK’s source code in SVN.