标题已经说明了。我正在寻找一种解决方案,用于将 UIAutomation 脚本中使用 target.captureScreenWithName 截取的屏幕截图与一些引用图像进行比较。这将非常适合测试一些自定义 View 。
最佳答案
尝试使用免费的 ImageMagicK for Mac。从 iOS 5 开始,有一个新的 UIAHost.performTaskWithPathArgumentsTimeout(path, args, timeout) 允许您直接从测试运行外部任务。只需使用带有参数的此函数运行 ImageMagic 脚本,您就可以直接从测试中获得图像比较结果。
var result = UIAHost.performTaskWithPathArgumentsTimeout(path, args, timeout)
路径 - 图像比较脚本的字符串;
args - ImageMagicK 实用程序的一组参数及其值,例如:
var args = ['param1', 'param1Value', 'param2', 'param2value'....];
ImageMagicK 的更多细节: http://www.imagemagick.org/script/index.php
关于iphone - iOS UI 自动化 : is it possible to compare screenshots to reference images?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4136291/