4

XCode から自分のプロジェクトで ocunit を動作させようとしています。単体テストでもデバッグする必要があるため、セットアップを自動化するスクリプトを使用しています (以下を参照)。リソースの下のプロジェクトに含め、名前を実行したい .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
4

2 に答える 2

2

そのスクリプトが行うことは、xcode を編集して OCUnits テストをデバッガーに挿入することのようです。OCUnit で実際にビルドするわけではありません。

OCUnit ターゲットを作成してから、そのターゲットを指す OCUnit テスト ケース クラスを作成する必要があります。

XCode で OCUnit を使用する方法については、こちらのチュートリアルを確認してください。

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

于 2010-07-03T14:17:26.253 に答える
2

私自身も同様の面倒を経験したので、単体テストのデバッグを実行できるようにするために行った手順の概要をまとめました。リンクはこちら: iPhone アプリケーションの単体テストを実行およびデバッグする方法

于 2011-02-14T07:58:15.453 に答える