iphone - iOS UI 自动化 : is it possible to compare screenshots to reference images?

标签 iphone ios cocoa-touch ios-ui-automation

标题已经说明了。我正在寻找一种解决方案,用于将 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

UIAHost 引用: http://developer.apple.com/library/ios/#documentation/UIAutomation/Reference/UIAHostClassReference/UIAHost/UIAHost.html

关于iphone - iOS UI 自动化 : is it possible to compare screenshots to reference images?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4136291/

相关文章:

ios - 如何注册通知类别?

iphone - iPhone 版 Speex

ios - 如何在 ios 中使用子类更改 UITextfield 占位符文本颜色

ios - 如何将迭代的字符串值结果集转换为ios中的数组?

ios - 使用 Beta 版 XCode、OS X 或 IOS 创建的构建不支持 Delphi FMX 外部测试

objective-c - 关于 Objective-C 属性语法的基本问题

ios - UITableView 第二个原型(prototype)单元格似乎不符合自定义高度?

iphone - 在 Windows 7 上开发 iPhone 应用程序

ios - 而 dispatch_sync(kBgQueue, ^{});在后台使用前台 UI 瞬间卡住

iphone - UIView 上的渐变和 iPhone 上的 UILabels