参考文章:

UI Testing in Xcode - WWDC 2015
https://developer.apple.com/videos/play/wwdc2015-406/

Document

https://developer.apple.com/library/prerelease/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/UnitTesting.html

UI Testing in Xcode 7 revised
https://testerhome.com/topics/3372

UI Testing in Xcode 7
http://masilotti.com/ui-testing-xcode-7/

UI Testing Cheat Sheet and Examples
http://masilotti.com/ui-testing-cheat-sheet/

XCTest Reference
http://masilotti.com/xctest-documentation/index.html

1. 点击Test navigator icon,切换到Test模块

2. 点击左下角的“+”号,可以选择添加 Unit test target、Unit test class、UI test target、UI test class

这里我们选择 UI test target

如上图:

HouseLoanCalTests 是 Unit Test

HouseLoanCalUITests 是 UI Test

3.

问题1:

XCTAssertEqual(periodTextField.value, @"1");

XCTAssertTrue([periodTextField.value isEqualToString:@"1"], @"Strings are not equal %@ %@", @"1", periodTextField.value);

用 XCTAssertEqual,这个判断需要两个对比元素都是C类型(scalars、struct、union等),如xx.count,可以用XCTAssertEqual;

解决方法:

换成 XCTAssertTrue

http://stackoverflow.com/questions/19464261/xctassertequal-fails-to-compare-two-string-values

问题2:

之前给四个页面分别写了一个test,原本是向顺序执行的,但是发现运行时每个test都会调起一次app

解决方法:

之前在 setUp 方法里写了 [self.app launch],将之移到第一个test里面即可;

问题3:

在公司app里添加了一个xxxUITests,运行失败

解决方法:

1. Edit Scheme,Test项选择为OL

2. 错误:Tests couldn’t be loaded because it doesn’t contain a version for the current architecture

No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).

选择 Build Settings 里面 Valid Architectures 里,原来只有arm7、arm7s,这里需要加上arm64

问题4:

新建UITest的方法有好几种

1. 切换到test模块,点击左下角的+,New UI Test Target

2. File - New - Target - Test - iOS UI Testing Bundle

新建完的target,从代码目录看,是有个xxxUITests.m文件的,但是从test模块看,下面的test数目是0,且那个xxxUITests.m文件里的系统函数没有高亮

目前没有找到根本原因,零时的解决方法是:运行一下这个UI testing,试了几遍之后,就有了

UI Testing in Xcode 7的更多相关文章

  1. UI Testing

    UI Test能帮助我们去验证一些UI元素的属性和状态.Apple 在 Xcode 7 中新加入了一套 UI Testing 的工具,其目的就是解决自动化UI测试这个问题.新的 UI Testing ...

  2. [Xcode 实际操作]七、文件与数据-(23)UI Testing系统界面测试功能的使用

    目录:[Swift]Xcode实际操作 本文将演示UI Testing系统界面测试功能的使用. 如果项目中尚未引入界面测试功能,请点击项目属性面板->[General]面板左下角的[+]图标 - ...

  3. uiautomator跑安卓端UI testing

    用uiautomator做安卓的app端的UI testing的环境搭建及编jar包和运行case的步骤如下: 1.新建java工程 2.右键properties, 添加junit4的library, ...

  4. iOS Testing with Xcode 阅读笔记

    官方文档直通车 Performance Testing A baseline is a combination of the average time performance in ten runs ...

  5. Enable Coded UI Testing of Your Controls

    http://msdn.microsoft.com/en-us/library/hh552522.aspx AccessibleObject Class http://msdn.microsoft.c ...

  6. WWDC15 Session笔记 - Xcode 7 UI 测试初窥

    https://onevcat.com/2015/09/ui-testing/ WWDC15 Session笔记 - Xcode 7 UI 测试初窥 Unit Test 在 iOS 开发中已经有足够多 ...

  7. iOS 11系列 - Xcode 9新特性

    Xcode 9最近刚刚发布,带来了一系列不错的新特性,可以更好的帮助到开发者完成开发工作. Xcode Runtime Tool Xcode 9中有许多Runtime Tool可以帮助开发者找到代码错 ...

  8. iOS App稳定性指标及监测

    一个App的稳定性,主要决定于整体的系统架构设计,同时也不可忽略编程的细节,正所谓"千里之堤,溃于蚁穴",一旦考虑不周,看似无关紧要的代码片段可能会带来整体软件系统的崩溃.尤其因为 ...

  9. iOS自己主动化測试的那些干货

    前言 假设有測试大佬发现内容不正确.欢迎指正,我会及时改动. 大多数的iOS App(没有持续集成)迭代流程是这种 也就是说.測试是公布之前的最后一道关卡.假设bug不能在測试中发现,那么bug 就会 ...

随机推荐

  1. 洛谷P5173 传球(暴力)

    传送门 真·暴力艹过去 不难发现这个转移其实就是一个循环卷积的形式,设有多项式\(A=x+x^{n-1}\),那么\(f_m=f_0\times A^m\) 直接暴力计算并卡常就行了 //minamo ...

  2. [Swift]Xcode实际操作

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  3. 为HTML5添加新样式标签

    为 HTML 添加新元素 该实例向 HTML 添加的新的元素,并为该元素定义样式,元素名为 <myHero> : 实例 <!DOCTYPE html> <html> ...

  4. PJzhang:子域名爆破工具wydomain(猪猪侠)

    猫宁!!! 参考链接:https://www.secpulse.com/archives/53182.html https://www.jianshu.com/p/65c85f4b7698 http: ...

  5. 消息中间件之ActiveMQ(非原创)

    文章大纲 一.消息中间件基础知识二.ActiveMQ介绍三.ActiveMQ下载安装(Windows版本)四.Java操作ActiveMQ代码实战五.Spring整合ActiveMQ代码实战六.项目源 ...

  6. 概念端类型“xxx”中的成员“ID”的类型“Edm.Decimal”与对象端类型“xxx”中的成员“ID”的类型“System.Int64”不匹配

    概念端类型“xxx”中的成员“ID”的类型“Edm.Decimal”与对象端类型“xxx”中的成员“ID”的类型“System.Int64”不匹配 使用EF实体模型映射之后将edmx中xml映射关系中 ...

  7. 使用JMETER进行REST API测试

    我确定你在这里是因为你需要加载测试Json Rest API.这并不奇怪,因为Rest API现在越来越受欢迎. 这本指南的目的:帮助您进行负载测试一个Json的 REST API 通过一个具体的例子 ...

  8. Codeforces Round #431 (Div. 2) A

    Where do odds begin, and where do they end? Where does hope emerge, and will they ever break? Given ...

  9. input密码自动填充

    自动填充样式修改 input: -webkit - autofill, input: -webkit - autofill: hover, input: -webkit - autofill: foc ...

  10. 线程池(3)Executors.newCachedThreadPool

    例子: ExecutorService es = Executors.newCachedThreadPool(); try { for (int i = 0; i < 20; i++) { Ru ...