参考文章:

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. cogs 421. HH的项链

    421. HH的项链 http://218.28.19.228/cogs/problem/problem.php?pid=421 ★★★   输入文件:diff.in   输出文件:diff.out  ...

  2. 3分钟了解HTTP的基础概念

    1. 什么是HTTP? HTTP意为超文本传输协议(HyperText Transfer Protocol), Web以此为规范发送请求.获取资源,完成从客户端到服务器端的一些列操作. 2. 如何理解 ...

  3. 洛谷 P1434 [SHOI2002]滑雪 解题报告

    这题方法有很多, 这里介绍2种: 方法1 很容易想到搜索, bfs或dfs应该都可以, 就不放代码了: 方法2 这题还可以用 dp 来做. 做法:先将每个点按照高度从小到大排序,因为大的点只能向小的点 ...

  4. Sonya and Matrix Beauty Codeforces - 1080E

    https://codeforces.com/contest/1080/problem/E 比赛时候一个多小时码不出来... 来看遇到的困难: 1.没有能用的随机unsignedlonglong函数 ...

  5. 数据绑定以及Container.DataItem几种方式与用法分析

    灵活的运用数据绑定操作        绑定到简单属性:<%#UserName%>        绑定到集合:<asp:ListBox id="ListBox1" ...

  6. html5响应式

    (function (doc, win) { var docEl = doc.documentElement, resizeEvt = ‘orientationchange’ in window ? ...

  7. [拾零]C/C++_代码复用的实现_静态链接库_动态链接库_使用.def导出

    1 静态链接库 1.1 创建静态链接库: 1.在VC6中创建项目:Win32 Static Library 2.在项目中创建两个文件:xxx.h 和 xxx.cpp 3.编译 1.2 使用静态链接库 ...

  8. i-nex安装教程

    sudo add-apt-repository ppa:i-nex-development-team/stable sudo apt-get updatesudo apt-get i-nex

  9. Swing---WindowConstants

    Java桌面开发过程中,很多人都写过类似下面的代码. import javax.swing.JFrame; public class SimpleFrame { public static void ...

  10. MySql自动默认时间及更新时间

    注意:5.7 才能用类型为datetime的字段实现 `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `modifie ...