UI Testing in Xcode 7
参考文章:
UI Testing in Xcode - WWDC 2015
https://developer.apple.com/videos/play/wwdc2015-406/
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的更多相关文章
- UI Testing
UI Test能帮助我们去验证一些UI元素的属性和状态.Apple 在 Xcode 7 中新加入了一套 UI Testing 的工具,其目的就是解决自动化UI测试这个问题.新的 UI Testing ...
- [Xcode 实际操作]七、文件与数据-(23)UI Testing系统界面测试功能的使用
目录:[Swift]Xcode实际操作 本文将演示UI Testing系统界面测试功能的使用. 如果项目中尚未引入界面测试功能,请点击项目属性面板->[General]面板左下角的[+]图标 - ...
- uiautomator跑安卓端UI testing
用uiautomator做安卓的app端的UI testing的环境搭建及编jar包和运行case的步骤如下: 1.新建java工程 2.右键properties, 添加junit4的library, ...
- iOS Testing with Xcode 阅读笔记
官方文档直通车 Performance Testing A baseline is a combination of the average time performance in ten runs ...
- Enable Coded UI Testing of Your Controls
http://msdn.microsoft.com/en-us/library/hh552522.aspx AccessibleObject Class http://msdn.microsoft.c ...
- WWDC15 Session笔记 - Xcode 7 UI 测试初窥
https://onevcat.com/2015/09/ui-testing/ WWDC15 Session笔记 - Xcode 7 UI 测试初窥 Unit Test 在 iOS 开发中已经有足够多 ...
- iOS 11系列 - Xcode 9新特性
Xcode 9最近刚刚发布,带来了一系列不错的新特性,可以更好的帮助到开发者完成开发工作. Xcode Runtime Tool Xcode 9中有许多Runtime Tool可以帮助开发者找到代码错 ...
- iOS App稳定性指标及监测
一个App的稳定性,主要决定于整体的系统架构设计,同时也不可忽略编程的细节,正所谓"千里之堤,溃于蚁穴",一旦考虑不周,看似无关紧要的代码片段可能会带来整体软件系统的崩溃.尤其因为 ...
- iOS自己主动化測试的那些干货
前言 假设有測试大佬发现内容不正确.欢迎指正,我会及时改动. 大多数的iOS App(没有持续集成)迭代流程是这种 也就是说.測试是公布之前的最后一道关卡.假设bug不能在測试中发现,那么bug 就会 ...
随机推荐
- 取消eclipse英文单词拼写验证
依次点击Preferences->General->Editors->TexEditors->Spelling->Enable Spell Checkingt , 如下图 ...
- php追加数组的问题
PHP数组合并两种方法及区别 如果是关联数组,如下: 代码如下: $a = array( 'where' => 'uid=1', 'order' => 'uid', ); $b = arr ...
- King's Pilots
题目链接 (双层图, 一层维护工作,一层维护政策) #include <bits/stdc++.h> using namespace std; inline int read() { ...
- java.exe is valid, but is for a machine type other than the current machine
java.exe is valid, but is for a machine type other than the current machine jdk版本不一致问题,在32位机器上使用64位的 ...
- Educational Codeforces Round 66 (Rated for Div. 2) A. From Hero to Zero
链接:https://codeforces.com/contest/1175/problem/A 题意: You are given an integer nn and an integer kk. ...
- Codeforces 1141F2(贪心、预处理)
要点 一开始dp然后码力太辣鸡并且算法带假于是调了很久一交还WA在28-- 吐槽完毕.后来想拿栈优化dp时发现其实完全不需要dp,贪心选取即可,当前的不兼容就干脆不要它了,结果不会变差.然后想要什么就 ...
- url、src与href属性的区别
http://blog.csdn.net/rickgreen/article/details/54943500
- net core WebApi 使用Swagger
Asp.net core WebApi 使用Swagger生成帮助页 最近我们团队一直进行.net core的转型,web开发向着前后端分离的技术架构演进,我们后台主要是采用了asp.net core ...
- Django使用网站图标
默认情况下,浏览器访问一个网站的时候,同时还会向服务器请求“/favicon.ico”这个URL,目的是获取网站的图标. 若是没有配置的话,Django就会返回一个404错误,并且浏览器接收到这个40 ...
- 使用cp命令拷贝目录下指定文件外的其他文件
shopt -s extglob cp test/!(abc*) test2/ cp test目录下除了以abc开头的其他文件 如果是除去多个文件的话使用 !(a|b) ; 注意不要多加空 ...