ocunit testing on iPhone

Posted by Magnus Poromaa on Stack Overflow See other posts from Stack Overflow or by Magnus Poromaa
Published on 2010-06-08T19:16:40Z Indexed on 2010/06/08 19:22 UTC
Read the original article Hit count: 446

Filed under:
|
|
|

Hi

I am trying to get ocunit working in my project from XCode. Since I also need to debug in the unit tests I am using a script that automates the setup (see below). I just include it in the project under resources and change the name to the .ocunit file I want it to run.

The problem I get is that it cant find the bundle file and therefore exists with an error. Can anyone who has a clue about XCode and objective-c take a look at it and tell me what is wrong. Also how am I supposed to produce the .ocunit file that I need to run. By setting up a new unit test target for the iPhone and add tests to it or?

Hope someone has a clue since I just started ny iPhone development and need to get it up and running quickly

Apple Script

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

Cheers

Magnus

© Stack Overflow or respective owner

Related posts about iphone

Related posts about test