参考文章:

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. cf414B(dp)

    题目链接:http://codeforces.com/problemset/problem/414/B 题意:定义所有元素是其前一个元素的倍数的数列为good sequence,给出 n, 和 k,求 ...

  2. 洛谷P2188 小Z的 k 紧凑数

    P2188 小Z的 k 紧凑数 题目描述 小 Z 在草稿纸上列出了很多数,他觉得相邻两位数字差的绝对值不超过 k 的整数特别奇特,称其为 k 紧凑数. 现在小 Z 想知道 [l,r] 内有多少个 k ...

  3. cogs1583. [POJ3237]树的维护

    1583. [POJ3237]树的维护 http://www.cogs.pro/cogs/problem/problem.php?pid=1583 ★★★☆   输入文件:maintaintree.i ...

  4. 剑指Offer的学习笔记(C#篇)-- 斐波那契数列

    题目:大家都知道斐波那契数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项(从0开始,第0项为0). 一 . 理解概念 斐波那契数列概念:斐波那契数列(Fibonacci sequence), ...

  5. atom 插件 python语法验证linter-flake8-------填坑

    python的语法相对于一般语言的语法比较严格.对于刚刚从前端入门python的我来说,有时候代码写完了,然后报错,好多语法错误.所以这个时候一个好的语法验证插件是很好的.linter-flake8这 ...

  6. Python-9-赋值进阶

    1.序列解包 同时给多个变量赋值  >>> x, y, z = 1, 2, 3 >>> print(x, y, z) 1 2 3 用这种方式还可以交换两个变量的值 ...

  7. Sicily 1027. MJ, Nowhere to Hide

    //就是一个简单的字符串配对~~用map来解决很easy #include <iostream> #include <map> #include <string> ...

  8. 使用docker save load 的时候的一个小问题

    当你使用docker save image_id > aa.tar ; 然后再使用 docker load < aa.tar 时, 你会发现此时导入的镜像的repository和 tag ...

  9. Table行合并操作

    此方法不可取,但几天心血 保留,已有新想法,稍后会出一个完善的Table行列合并方法 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran ...

  10. F. Clique in the Divisibility Graph DP

    http://codeforces.com/contest/566/problem/F F. Clique in the Divisibility Graph time limit per test ...