GHUnit for Xcode 3
2011-09-09 16:16
281 查看
To use GHUnit in your project, you’ll need to create and configure a test target.
Add a
In the Finder, copy
In the
(from MyProject/Frameworks/). It should now be visible as a
In the
In the
Change the Destination to
Drag
Make sure the copy phase appears before any
Copy
your project and include in the Test target.
If your main target is a library:
In the
Add a linked library, and select your main target; This is so you can link your test target against your main target, and then you don’t have to manually include source files in both targets.
If your main target is an application, you will need to include these source files to the
Now create a test (either by subclassing
adding it to your test target. (See example test case below.)
By default, the Tests-Info.plist file includes
Now you can create and run tests!
Add a
New Target. Select
Cocoa -> Application. Name it
Tests(or something similar).
In the Finder, copy
GHUnit.frameworkto your project directory (maybe in MyProject/Frameworks/.)
In the
Teststarget, add the
GHUnit.frameworkfiles
(from MyProject/Frameworks/). It should now be visible as a
Linked Frameworkin the target.
In the
Teststarget, under Build Settings, add
@loader_path/../Frameworksto
Runpath Search Paths(Under All Configurations)
In the
Teststarget, add
New Build Phase|
New Copy Files Build Phase.
Change the Destination to
Frameworks.
Drag
GHUnit.frameworkinto the the build phase
Make sure the copy phase appears before any
Run Scriptphases
Copy
GHUnitTestMain.minto
your project and include in the Test target.
If your main target is a library:
In the
Target 'Tests' Infowindow,
Generaltab:
Add a linked library, and select your main target; This is so you can link your test target against your main target, and then you don’t have to manually include source files in both targets.
If your main target is an application, you will need to include these source files to the
Testproject manually.
Now create a test (either by subclassing
SenTestCaseor
GHTestCase),
adding it to your test target. (See example test case below.)
By default, the Tests-Info.plist file includes
MainWindowfor
Main nib file base name. You should clear this field.
Now you can create and run tests!
相关文章推荐
- GHUnit for iOS测试指南
- Unit Testing in Xcode 4 – use OCUnit and SenTest instead of GHUnit
- GHUnit for iOS测试指南
- Add unit test for XCode project
- Xcode 5 单元测试(二)OCMock和GHUnit
- Xcode 5 单元测试(二)OCMock和GHUnit
- GHUnit for iOS测试指南
- GHUnit for iOS测试指南
- XCode 内置了 OCUnit 单元测试框架,但目前最好用的测试框架应该是 GHUnit。通过 GHUnit + OCMock 组合,我们可以在 iOS 下进行较强大的单元测试功能。本文将演示如何在
- Xcode 安装不了文档,出现 Could not download and install iOS 8. The certificate for this server is invalid...
- install cppUnit for eclipse
- Xcode 4 with External Static Library for iPhone Development
- Xcode 5.1 - No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i
- Xcode技巧:项目导入外部文件后编译运行出现Undefined symbols for architecture x86_64错误
- iOS开发插件推荐(1):利用神插件injectionforxcode倍增你的开发效率
- Applications must be ready for upload on iTunes Connect before they can be validated or submitted from within Xcode.
- GHUnit: Unit Testing Objective-C for the iPhone
- Injection for Xcode:成吨的提高开发效率
- HRPlugin For Xcode发布(附源码地址)
- 【xcode】错误之Could not launch "" failed to get the task for process