美文网首页
Testing in iOS(三)

Testing in iOS(三)

作者: V_coa | 来源:发表于2015-12-24 23:29 被阅读43次

性能测试,主要是测试block的耗时


Paste_Image.png

Code Coverage是Xcode7的一个新功能,就是让你知道,测试的覆盖率。可以让你知道哪些方法和属性没有被测试等。


Paste_Image.png

先要打开覆盖率的操作

Paste_Image.png

cmd+U,就看到测试的覆盖率了

Paste_Image.png

双击这个文件

Paste_Image.png

里面显示了我们哪些方法没有被测试,被测试的方法执行了多少次

Paste_Image.png

在measureBlock中可以测试耗时


Paste_Image.png

Proxy Classes与UI Test元素进行交互。
XCUIDevice代表设备
XCUIApplication代表APP,它是XCUIElement的子类


Paste_Image.png

可以通过tap,click等方法来进行测试,当然还有一些属性,如frame等。


Paste_Image.png

可以通过,descendants matching type 和 children matching type来获取元素。
descendantsMatchingType获取某类型的全部元素,cell,button等。
childrenMatchingType获取层级子元素的某类元素。


Paste_Image.png
通过New->Target,添加UI Testing
通过一些方法可以实现点击操作等 Paste_Image.png

XCUIElementQuery,查找方法


Paste_Image.png

通过红点能录制操作,能自动生成代码。


Paste_Image.png

相关文章

网友评论

      本文标题:Testing in iOS(三)

      本文链接:https://www.haomeiwen.com/subject/ghwvhttx.html