Skip to content

Instantly share code, notes, and snippets.

@satoshin2071
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satoshin2071/abdfed4df768426e6626 to your computer and use it in GitHub Desktop.
Save satoshin2071/abdfed4df768426e6626 to your computer and use it in GitHub Desktop.
[iOS][Test]kiwi導入メモ

#kiwi導入メモ

##xcode6 で非同期のテストできるようになったので御役御免かも

##cocoaPodで入れる。

####cocoaPodは最新版にする。 古いverだとpod install で kiwiが入らない場合がある。

####使用したpodfile

xcodeProjが複数あるプロジェクトなのでプロジェクトの指定
xcode5以上なのでpod 'Kiwi/XCTest'を指定する

----

platform :ios, '6.1'

xcodeproj  '/Users/ssato/ios/Hoge/Hoge.xcodeproj'

target :hogeTests, :exclusive => true do
  pod 'Kiwi/XCTest'
end

----

できたらPod install

#####手動でのインストールについて

BuildPhaseに追加してあるAssemble Frameworkっていうスクリプトにバグがあって

うまく直せずに.aファイルが生成されずにちょっとどん詰まりな感じに

(issueには解決したっぽいこと書いてあったが上手く行かず kiwi-bdd/Kiwi#487)

####pod install後の確認作業

  • pod installで作成されたxcworkspaceを開いて既存のプロジェクトが動くかの確認
  • Pods-HogeTests.xcconfingが作成されていること
  • Project → info → ConfigurationsのTestsのConfigurationFileにPods-HogeTests.xcconfingが指定されていること
  • Target → hogeTests → BudnleLoader が $(BUILT_PRODUCTS_DIR)/Hoge.app/Hogeになっていること
  • Target → hogeTests → TestHost も $(BUILT_PRODUCTS_DIR)/Hoge.app/Hogeになっていること

####kiwiが動くかの確認作業

デフォルトのテスト用ファイル.mの中身を全て削除して以下を追記して⌘+Uで実行して失敗するかを確認する

#import "Kiwi.h"

SPEC_BEGIN(MathSpec)

describe(@"Math", ^{
    it(@"is pretty cool", ^{
        NSUInteger a = 16;
        NSUInteger b = 26;
        [[theValue(a + b) should] equal:theValue(42)];
    });
});

SPEC_END
@satoshin2071
Copy link
Author

Xcode6からは非同期テストできるようになったのでkiwiお払い箱

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment