if (!empty($_SERVER['HTTP_CLIENT_IP']))
$ip=$_SERVER['HTTP_CLIENT_IP'];
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
else
$ip=$_SERVER['REMOTE_ADDR'];
?>
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.
Demo
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.
Summary
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.
Resource
For more details, please take a look at the tutorial for our Vision Test system.
The image comparison implementation is based on Pat Cullen’s code located here. A big thanks to him for letting us use it.
Hi Murilo,
the documentation is here (https://www.zkoss.org/wiki/ZTL_Essentials) however it’s mostly used internally (to test zk components).
Most application scenarios can be tested using ZATS, selenium-webdriver or testcafe tests.
If you can explain a bit what you are planning to test, I might be able to recommend a dedicated tool for the job.
Have you tried Sikuli Project (http://sikuli.org/) ?
I’ve used for some testing and seems to be very good.
Yes, I knew that, but I think we are not the same concept.
The image comparator is configurable. You could plug in a different implementation if you’d like.
[…] Vision Test for ZTL shows how they do image comparison. […]
Really powerful !
is still ZLT used? i’m not able to find updated information on blogs or internet..
Hi Murilo,
the documentation is here (https://www.zkoss.org/wiki/ZTL_Essentials) however it’s mostly used internally (to test zk components).
Most application scenarios can be tested using ZATS, selenium-webdriver or testcafe tests.
If you can explain a bit what you are planning to test, I might be able to recommend a dedicated tool for the job.