presentation.pdf

 presentation.pdf

WWDC 2018のWhat's New in Testingのダイジェスト版です。

Db5cf21a75ebe2484b95ea9dec5f573b?s=128

Shingo Tamaki

July 24, 2018
Tweet

Transcript

  1. What's New in Testing

  2. What's New in Testing 2018

  3. ࣗݾ঺հ ۄ৓৴ޛ iOS Engineer Appium

  4. Agenda 1. Code Coverage 2. Test Selection and Order 3.

    Parallel Testing
  5. Code Coverage

  6. Code CoverageʢXcode 9.3ʣ • ΧόϨοδදࣔ·Ͱͷ࣌ؒ୹ॖ • Xcode9ͱൺ΂95%ߴ଎Խ • ΧόϨοδϑΝΠϧͷαΠζμ΢ϯ •

    Xcode9ͱൺ΂1/10ҎԼ • C++ʹ͓͚ΔϔομϑΝΠϧʹهड़͞Ε࣮ͨ૷ͷΧόϨοδ ऩू͕Մೳʹ
  7. Code CoverageʢXcode 9.3ʣ • λʔήοτͷબ୒ • ΧόϨοδऩूͷର৅Λλʔήοτ୯ҐͰબ୒Մೳ • ex) ϥΠϒϥϦͷαϯϓϧίʔυͷΧόϨοδͷ৘ใ͸

    ཉ͘͠ͳ͍
  8. xccov • ΧόϨοδσʔλΛѻ͏CLIπʔϧ • Coverage data • xccovreport: ֤λʔήοτɺιʔεϑΝΠϧɺ͓Αͼؔ਺ ͷΧόϨοδͷׂ߹ͳͲؚ͕·ΕΔ

    • xccovarchive: Ϩϙʔτ಺ͷ֤ϑΝΠϧͷੜͷ࣮ߦճ਺͕ ؚ·ΕΔ
  9. xccov • xccov view hoge.xccovreport Name Coverage ---------------------------------------------------------------------------------- ------------- SampleLib.framework

    100.00% (3/3) /Users/you/SampleLib/Classes/SampleLib.swift 100.00% (3/3) static SampleLib.SampleLib.foo() -> Swift.String 100.00% (3/3)
  10. xccov • xccov view hoge.xccovreport --json | jq { "coveredLines":

    3, "lineCoverage": 1, "targets": [ { "coveredLines": 3, "lineCoverage": 1, "files": [ { "coveredLines": 3, "lineCoverage": 1, "path": "/Users/you/SampleLib/Classes/SampleLib.swift", "functions": [ { "coveredLines": 3, "lineCoverage": 1, "lineNumber": 11, "executionCount": 1, "name": "static SampleLib.SampleLib.foo() -> Swift.String", "executableLines": 3 } ], "name": "SampleLib.swift", "executableLines": 3 } ], "name": "SampleLib.framework", "executableLines": 3, "buildProductPath": "/Users/you/Library/Developer/Xcode/DerivedData/.../SampleLib.framework/SampleLib" } ], "executableLines": 3 }
  11. Test Selection and Order

  12. Test Selection and Order • εΩʔϜຖʹλʔήοτͷςετΛࣗಈ௥Ճ͢Δ͔Ͳ͏͔બ ΂ΔΑ͏ʹͳͬͨ • ςετͷ࣮ߦॱΛϥϯμϜʹग़དྷΔ༷ʹͳͬͨ •

    ࣮ߦॱংʹґଘͨ͠ςετΛݕग़͠΍͘͢ͳΔ • ґଘΛແ͘͠setup/teardownΛ࢖ͬͯඞཁͳঢ়ଶ͸࡞Γ ·͠ΐ͏
  13. Parallel Testing

  14. !

  15. Parallel Testing • ͜Ε·Ͱͷฒྻςετ • ෳ਺ͷγϛϡϨʔλͰશͯͷςετΛ࣮ߦ • xcodebuild͔ΒͷΈαϙʔτ͍ͯͨ͠

  16. None
  17. Parallel Distributed Testing • ಉҰγϛϡϨʔλͰͷςετͷฒྻ࣮ߦ͕Մೳʹͳͬͨ • Xcodeͱxcodebuildͷ྆ํͰߦ͑Δ • ςετΫϥε୯ҐͰ෼ࢄ͞ΕΔ •

    ςετ͸ࢦఆͨ͠γϛϡϨʔλͷΫϩʔϯ͕ඞཁͳ͚ͩىಈ ࣮͠ߦ͞ΕΔ
  18. None
  19. Ҏ্

  20. ͓·͚

  21. man xccov xccovͷ࢖͍ํΛৄࡉʹ஌Γ͍ͨ৔߹͸man xccovΛݟͨํ͕ྑ ͍ xccov help΍xccov help viewͰදࣔ͞ΕΔ৘ใ͸؆ૉʹॻ͔Ε ͍ͯΔ

  22. xcrunলུ͍ͨ͠ xcrunൈ͖Ͱxccovୟ͖͍ͨͳΒ /Applications/Xcode.app/Contents/Developer/usr/bin/ ʹύε௨͠·͠ΐ͏ simctlͳͲͷଞͷ։ൃऀπʔϧΛ࢖͏ͷʹ΋ศརͰ͢ɻ

  23. xcodebuild option ฒྻςετ༻ͷΦϓγϣϯ͕૿͑·ͨ͠ //ฒྻςετͷϫʔΧʔ਺ͷࢦఆ -parallel-testing-worker-count n //ฒྻςετͷ࣮ߦΦϓγϣϯ -parallel-testing-enabled YES |

    NO
  24. ࢀߟURL What's New in Testing https://developer.apple.com/videos/play/wwdc2018/403/ xccov: Xcode Code Coverage

    Report for Humans https://medium.com/xcblog/xccov-xcode-code-coverage- report-for-humans-466a4865aa18