首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iPhone上的ocunit测试

iPhone上的ocunit测试
EN

Stack Overflow用户
提问于 2010-06-09 03:16:41
回答 2查看 1.6K关注 0票数 4

我正在尝试让ocunit在我的XCode项目中工作。因为我还需要在单元测试中进行调试,所以我使用了一个自动化设置的脚本(见下文)。我只需将其包含在项目的resources下,并将其名称更改为我希望其运行的.ocunit文件。

我得到的问题是它找不到捆绑包文件,因此存在错误。谁能对XCode和objective-c有所了解,看看它,告诉我哪里出了问题。另外,我应该如何生成我需要运行的.ocunit文件。通过为iPhone设置新的单元测试目标并向其添加测试,或者?

希望有人有线索,因为我刚刚开始纽约iPhone开发,需要让它快速启动和运行

Apple脚本

代码语言:javascript
复制
-- The only customized value we need is the name of the test bundle
tell me to activate
tell application "Xcode"
 activate

 set thisProject to project of active project document
 tell thisProject
  set testBundleName to name of active target
  set unitTestExecutable to make new executable at end of executables
  set name of unitTestExecutable to testBundleName
  set path of unitTestExecutable to "/Applications/TextEdit.app"

  tell unitTestExecutable

   -- Add a "-SenTest All" argument
   make new launch argument with properties {active:true, name:"-SenTest All"}

   -- Add the magic 
   set injectValue to "$(BUILT_PRODUCTS_DIR)/" & testBundleName & ".octest"


   make new environment variable with properties {active:true, name:"XCInjectBundle", value:injectValue}
   make new environment variable with properties {active:true, name:"XCInjectBundleInto", value:"/Applications/TextEdit.app/Contents/MacOS/TextEdit"}
   make new environment variable with properties {active:true, name:"DYLD_INSERT_LIBRARIES", value:"$(DEVELOPER_LIBRARY_DIR)/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection"}
   make new environment variable with properties {active:true, name:"DYLD_FALLBACK_FRAMEWORK_PATH", value:"$(DEVELOPER_LIBRARY_DIR)/Frameworks"}
  end tell
 end tell
end tell
EN

回答 2

Stack Overflow用户

发布于 2010-07-03 22:17:26

看起来该脚本所做的就是编辑xcode以将OCUnits测试注入调试器。实际上并不是用OCUnit构建的。

您确实需要创建一个OCUnit目标,然后创建指向该目标的OCUnit测试用例类。

请查看此处的教程,了解如何在XCode中使用OCUnit。

http://www.mobileorchard.com/ocunit-integrated-unit-testing-in-xcode/

票数 2
EN

Stack Overflow用户

发布于 2011-02-14 15:58:15

在经历了类似的麻烦之后,我总结了我为能够执行单元测试调试而采取的步骤。链接在这里:How to run and debug unit tests for an iphone application

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3000490

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档