実機にインストールしたiPhoneアプリをコマンドラインから起動する

iPhoneアプリ開発時に、テスト自動化をしようとすると、アプリの自動起動が必要になります。

Xcode 4.4までは、

instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w <デバイスID/対象シミュレータ> <アプリ名>.app


Xcode 4.5からはInstrumentsのテンプレートの場所が変わりました。

<Xcode.appまでのパス>/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate


よって以下のようにすると、起動することができます。

instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w <デバイス identifier/対象シミュレータ> <アプリ名>.app

デバイス Identifier確認方法

  • Organizerから見ることができます
    • Xcodeメニューバー > Window > Organizer

f:id:sea_mountain:20130202182337p:plain