5

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.

nschum
  • 15,322
  • 5
  • 58
  • 56
V1ru8
  • 6,139
  • 4
  • 30
  • 46

3 Answers3

3

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

Sh_Andrew
  • 352
  • 2
  • 6
1

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.

Sergey
  • 26
  • 1
1

Check out Zucchini Framework. It wraps UIAutomation API nicely and lets you have screenshots as test assertions.

vaskas
  • 21
  • 1