[英]What are the advantages of XCTest over SenTestingKit?
I want to do unit testing in iOS. 我想在iOS中进行单元测试。 By default test classes are created using XCTest framework classes in Xcode 5. I have used SenTestingKit in earlier versions of iOS. 默认情况下,测试类是使用Xcode 5中的XCTest框架类创建的。我在早期版本的iOS中使用过SenTestingKit。 What are the differences between these two frameworks? 这两个框架之间有什么区别? What are the advantages of XCTest framework. XCTest框架有哪些优点。 I googled for related documentation but I did not find any. 我搜索相关文档,但我没有找到任何。 Only thing I found is the interface classes to use inside the kit. 我发现的只是套件中使用的接口类。 Can anyone point me to the related resources. 谁能指出我相关的资源。
Apple's documentation is notably lacking with regards to testing. Apple的文档在测试方面尤其缺乏。 It's a shame, because spending five minutes with XCTest made me fall for it. 这是一种耻辱,因为用XCTest花了五分钟让我感到沮丧。 So, here are some docs that you may find useful. 所以,这里有一些你可能会觉得有用的文档。
First, stop and watch the WWDC video about testing: https://developer.apple.com/wwdc/videos/?include=409#409 (must be a registered developer) 首先,停下来观看有关测试的WWDC视频: https : //developer.apple.com/wwdc/videos/? include = 409 #409(必须是注册开发者)
Then, read about Bots. 然后,阅读Bots。 They're the real magic in XCTest. 它们是XCTest中真正的魔力。 I'm currently setting up an environment of a Mac Mini running Mavericks Server connected to a small array of iPod Touches, iPhones and iPads that will simultaneously run my unit tests and report back. 我目前正在建立一个运行Mavericks服务器的Mac Mini环境,该服务器连接到一小部分iPod Touch,iPhone和iPad,它们将同时运行我的单元测试并报告回来。 It's damn near magic. 它真是太神奇了。
https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/xcode_guide-continuous_integration/000-About_Continuous_Integration/about_continuous_integration.html#//apple_ref/doc/uid/TP40013292 https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/xcode_guide-continuous_integration/000-About_Continuous_Integration/about_continuous_integration.html#//apple_ref/doc/uid/TP40013292
All that said, I don't know SenTest well enough to compare the two. 所有这一切,我不太了解SenTest足以比较两者。 But I am learning XCTest, so here are a few thoughts on what I'm really digging about it so far. 但是我正在学习XCTest,所以这里有一些关于我到目前为止正在挖掘它的想法。
And, a few cons for measure: 并且,一些衡量标准:
My two cents. 我的两分钱。 Hope it helps. 希望能帮助到你。 I'd really recommend watching that video I linked to - they do live test creation and make a really compelling case for unit testing in general, regardless of if you use XCTest. 我真的建议观看我链接的视频 - 他们会进行实时测试创建,并为一般的单元测试制作一个非常引人注目的案例,无论你是否使用XCTest。
XCTest are included by default with ios7 and integrate better with the new continuous integration functionality. XCTest默认包含在ios7中,并且与新的持续集成功能更好地集成。
https://developer.apple.com/technologies/tools/ https://developer.apple.com/technologies/tools/
It seems the advantages are presently few, but that will hopefully change over time, so starting a community wiki to document some: 看来优势目前很少,但随着时间的推移,这将有希望改变,所以启动社区维基来记录一些:
XCTAssert…
family of macros can handle you leaving out the format
parameter (used for commenting why a test should pass) entirely. XCTAssert…
系列宏可以处理你XCTAssert…
format
参数(用于评论测试应该通过的原因)。 This is handy for keeping simple tests (where it's obvious from the test itself what it's doing) clean in the editor. 这对于在编辑器中保持简单测试(从测试本身显而易见的是它在做什么)清理是很方便的。 STAssert…
required us to make the format
parameter nil
or some such instead. STAssert…
要求我们将format
参数设置为nil
或其他一些。 XCTAssert()
macro, which feels neater than bodging some types of check into STAssertTrue
. 有一个通用的XCTAssert()
宏,它比把一些类型的检查放入STAssertTrue
感觉更整洁。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.