The title explains it already. I'm looking for a solution to compare screenshots taken with target.captureScreenWithName in a UIAutomation script to some reference images. This would be really nice to test some custom views.
Try to use free ImageMagicK for Mac. Starting from iOS 5 there is a new UIAHost.performTaskWithPathArgumentsTimeout(path, args, timeout) that allows you to run external task right from your tests. Simply running ImageMagic script using this functions with parameters you will be able to get image comparison results right from your test.
var result = UIAHost.performTaskWithPathArgumentsTimeout(path, args, timeout)
path - string to the image comparison script;
args - an array of parameters and its values for ImageMagicK utility like:
var args = ['param1', 'param1Value', 'param2', 'param2value'....];
More details for ImageMagicK: http://www.imagemagick.org/script/index.php
UIAHost reference: http://developer.apple.com/library/ios/#documentation/UIAutomation/Reference/UIAHostClassReference/UIAHost/UIAHost.html
It is impossible to do it directly from UIA, at least I didn't find any way to do this. All the screenshots are saved to the test result folder. You can then process them by any tool you like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With