Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Do you know xctest command?

tokorom
January 15, 2014

Do you know xctest command?

XCTest.frameworkじゃなくてxctestコマンド
xctestコマンドを直接叩いてCUIから任意のテストだけ実行するのにトライしてみた

tokorom

January 15, 2014
Tweet

More Decks by tokorom

Other Decks in Technology

Transcript

  1. xctestίϚϯυͬͯ
    ஌͍ͬͯ·͔͢ʁ
    ॴ ༑ଠ @tokorom
    iOS App Programer
    These are “not” confidential sessions—please diffuse by your blogging and twitter
    potatotips #3

    View full-size slide

  2. ༧૝
    • XCTestϑϨʔϜϫʔΫ͸஌͍ͬͯΔ
    • xctestίϚϯυͳΜͯ͋Δͷʁ

    View full-size slide

  3. Xcode 5 ʹͳͬͯ
    • xcodebuildίϚϯυ͕௒ઈύϫʔΞοϓʂ
    • XcodeͰಛఆͷςετέʔε͚ͩΛୟ͘ͷ͕؆
    ୯ʹͳͬͨ

    View full-size slide

  4. Ͱ΋
    • xcodebuildίϚϯυʹಛఆͷςετΛࢦఆ͢Δ
    ޱ͕ͳ͍
    • ී௨ʹ͸CUI͔ΒಛఆͷςετΛ࣮ߦ͢Δํ๏
    ͕ͳ͍ʂʂ

    View full-size slide

  5. xctestίϚϯυͱ͸ʁ
    • xcodebuild test ͸಺෦తʹ xctest ίϚϯυΛୟ
    ͍͍ͯΔ
    •xctest -XCTest SampleTests/testSample Ͱ࣮ߦ͢
    Δςετέʔε͕ࢦఆͰ͖Δ

    View full-size slide

  6. ͨͩ͠…
    • xctestίϚϯυΛTerminalͰ௚઀ୟ͍࣮ͯߦ͢
    Δͱ͔͸ৗਓʹ͸΄΅ෆՄೳ
    •΅͘͸ xctest Λ௚઀ୟ͍ͯςετ࣮ߦ͢Δͷʹ
    ؙ̎೔͔͔ؒͬͨ

    View full-size slide

  7. น1: ͲͷxctestΛୟ͘ͷʁ

    View full-size slide

  8. xctest͸͍͔ͭ͋͘Δ
    $ pwd
    /Applications/Xcode.app
    !
    $ find . -name xctest
    ./Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
    iPhoneSimulator7.0.sdk/Developer/usr/bin/xctest
    !
    ./Contents/Developer/usr/bin/xctest
    Xcode͔ΒͩͱϏϧυͨ͠όΠφϦʹ߹Θͤͯద੾ͳ΍
    ͕ͭ࢖ΘΕ͍ͯΔͬΆ͍

    View full-size slide

  9. น2: ϏϧυઃఆͷҾ͖ܧ͗

    View full-size slide

  10. xcodebuild -showBuildSettings
    • ͜ΕͰϏϧυઃఆΛ֬ೝ͍ͯ͠Ζ͍Ζมߋ͠
    ͳ͍ͱμϝ
    •build settings ͸xcodebuildʹ౉͢ଞͷΦϓγϣ
    ϯʹΑͬͯมΘΔͷͰ஫ҙʂʂ

    View full-size slide

  11. น3: ؀ڥม਺ͷઃఆ

    View full-size slide

  12. NSProcessInfo
    • NSProcessInfoΛ࢖ͬͯςετ࣮ߦ࣌ʹઃఆ͞
    Ε͍ͯΔ؀ڥม਺ͱ͔ίϚϯυͷҾ਺ͱ͔͕෼
    ͔Δ
    •͜Ε΋build settings ͷ಺༰ʹΑͬͯద੾ʹઃఆ
    ͢Δඞཁ͕͋Δ

    View full-size slide

  13. ཁ͢Δʹී௨ʹୟ͘ͷ͸ແཧ

    View full-size slide

  14. ͳͷͰϥΠϒϥϦԽ͠·ͨ͠ʂ

    View full-size slide

  15. xctest-runner

    View full-size slide

  16. xctest-runner
    $ gem install xctest-runner
    !
    $ xctest-runner
    !
    $ xctest-runner -test SampleTests/testSample

    View full-size slide

  17. xctest-runner
    $ xctest-runner -scheme Tests
    !
    $ xctest-runner -project Sample.xcodeproj -target Tests

    View full-size slide

  18. (Vimͱ͔emacs͔Βฤूதͷςετ
    ͚࣮ͩߦͱ͔Ͱ͖ΔΑ͏ʹͳΔʂʣ

    View full-size slide

  19. More Information
    Yuta ToKoRo!
    iOS App Programer!
    @tokorom!
    !
    http://www.tokoro.me/
    https://github.com/tokorom/xctest-runner

    View full-size slide