【问题标题】:ocunit testing on iPhoneiPhone 上的 ocunit 测试
【发布时间】:2010-06-08 19:16:40
【问题描述】:

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

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

希望有人能提供线索,因为我刚开始开发 iPhone,需要快速启动和运行

苹果脚本

-- 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

【问题讨论】:

    标签: iphone testing ocunit


    【解决方案1】:

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

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

    查看此处的教程,了解如何将 OCUnit 与 XCode 结合使用。

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

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-11-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多