我正试图让 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