Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
What's new in testing WWDC2018
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
yokoya-s000
June 11, 2018
750
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
What's new in testing WWDC2018
yokoya-s000
June 11, 2018
More Decks by yokoya-s000
See All by yokoya-s000
単体テストのハジメ
yokoyas000
13
4.4k
Featured
See All Featured
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
700
The Curse of the Amulet
leimatthew05
3
15k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
The SEO identity crisis: Don't let AI make you average
varn
0
560
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
430
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Deep Space Network (abreviated)
tonyrice
0
320
HDC tutorial
michielstock
2
880
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Transcript
What’s new in Testing WWDC18 #wwdc_rusuban 2018/06/11 @yokoyas000
◾ ·ͱΊ ◾ Code Coverage ɾ xccovίϚϯυͰΧόϨοδϨϙʔτΛ͍͍ײ͡ʹͰ͖Δ ◾ Test Selection
And Ordering ɾ ৽͍͠ςετΛ࣮ߦରʹؚΊΔ/ؚΊͳ͍ ΛબͰ͖Δ ɾ ςετ͕ϥϯμϜ࣮ߦͰ͖ΔΑ͏ʹͳͬͨɻݎ࿚ੑ61⤴ ◾ Parallel Testing ɾ ฒྻͰςετΛ࣮ߦͰ͖ͯૣ͍
Code Coverage
◾ Code Coverage ※ Ҏલ͔Β͋Δػೳ ذॲཧΛςετͰͲΕ͚ͩཏͰ͖ͯΔ͔ݟΕΔػೳ
◾ Code Coverage ▪ Code coverage Λ༗ޮʹͨ͠ঢ়ଶͰςετ࣮ߦͨ͠ޙ ɾςετͰ࣮ߦ͞Εͨߦ ɾςετͰ࣮ߦ͞Εͳ͔ͬͨߦ
◾ Code Coverage(Xcode 9.3 ~) ▪ ύϑΥʔϚϯεͱਖ਼֬͞ͷվળ ▪ ςετλʔήοτΛબΔ ▪
xccovίϚϯυͰΧόϨοδใΛݟΕΔ
◾ Code Coverage(Xcode 9.3 ~) ▪ ύϑΥʔϚϯεͱਖ਼֬͞ͷվળ ▪ ςετλʔήοτΛબΔ ▪
xccovίϚϯυͰΧόϨοδใΛݟΕΔ
◾ xccov ▪ xccov ΧόϨοδϨϙʔτΛͬͯͳΜ͔ΜͰ͖ΔίϚϯυ ▪ ΧόϨοδϨϙʔτ ΧόϨοδΛ༗ޮʹͨ͠ঢ়ଶͰςετΛ࣮ߦ͢Δͱੜ͞ΕΔϑΝΠϧ ɾ.xccovreport֦ுࢠ ɾΧόϨοδͷׂ߹͕ॻ͔Ε͍ͯΔ
ɾ.xccovarchive֦ுࢠ ɾ ΞϓϦέʔγϣϯίʔυͷ֤ϑΝΠϧͷ࣮ߦΧϯτ
◾ xccov ▪ xccovίϚϯυͰΧόϨοδϨϙʔτΛৄ͘͠ݟΕΔ $ man xccov NAME xccov -
view Xcode coverage data in human-readable or machine-parseable format.
◾ xccov ▪ xccov ΛͬͯΧόϨοδϨϙʔτΛਓ͕ؒݟΕΔܗͰग़ྗ͢Δ $ xcrun xccov view XXXX.xccovreport
Name Coverage ------------------------------------------------------------------ --------------- HelloWorld.app 57.89% (11/19) /tmp/HelloWorld/HelloWorld/AppDelegate.m 50.00% (3/6) -[AppDelegate applicationWillTerminate:] 0.00% (0/3) -[AppDelegate applicationDidFinishLaunching:] 100.00% (3/3) /tmp/HelloWorld/HelloWorld/ViewController.m 50.00% (5/10) -[ViewController setRepresentedObject:] 0.00% (0/5) -[ViewController viewDidLoad] 100.00% (5/5) /tmp/HelloWorld/HelloWorld/main.m 100.00% (3/3) main
◾ xccov ▪ xccov Φϓγϣϯ xccov view --json XXXX.xccovreport ɾKTPOܗࣜͰग़ྗ
xccov view --file-list XXXX.xccovarchive/ ɾΧόϨοδσʔλΛ࣋ͭͯ͢ͷϑΝΠϧΛҰཡදࣔ xccov view --file /tmp/HelloWorld/HelloWorldTests/HelloWorldTests.m XXXX.xccovarchive/` ɾ̍ϑΝΠϧͷΧόϨοδ͚ͩग़ྗ Լͭͷ͍ॴ͕Α͘Θ͔Βͳ͍...
Test Selection And Ordering
◾ Test Selection And Ordering ※ Xcode 10 ͔Βͷ৽ػೳ ▪
Test Selection ▪ Test Ordering
◾ Test Selection And Ordering ▪ Test Selection ▪ Test
Ordering
◾ Test “Selection” εΩʔϜผʹ৽͘͠Ճͨ͠ςετΛ࣮ߦ͢Δ/͠ͳ͍ΛબΔ ɾEdit Scheme -> Test -> Info
-> Options -> Automatically includes new tests ▪ ׆༻ྫ ɾUIςετφΠτϦʔϏϧυͰར༻͢ΔεΩʔϜͷΈ Automatically includes new tests Λ ON ʹ͢Δ
◾ Test Selection And Ordering ▪ Test Selection ▪ Test
Ordering
◾ Test “Ordering” XCTestCase ͷαϒΫϥε୯Ґ ͰɺςετΛϥϯμϜ࣮ߦ͢Δ ※ࠓ·ͰΞϧϑΝϕοτॱͩͬͨ ɾEdit Scheme ->
Test -> Info -> Options -> Randomize execution order ▪ ར ɾຖճಉ͡ॱ൪ͩͱʮͨ·ͨ·͏·͍ͬͯ͘Δςετʯͷଘࡏʹؾ͚ͮͳ͍
◾ Test “Ordering” ▪ ʮͨ·ͨ·͏·͍ͬͯ͘Δςετʯͱʁ ҎԼͷͭͷςετΫϥε͕͋ͬͨͱ͠·͢ɻ ɾATestsΫϥε: UserςʔϒϧΛ࡞ ɾBTestsΫϥε: UserςʔϒϧՃ
ɾCTestsΫϥε: Userςʔϒϧͷআ ্هςετɺ A->B->C ͷॱ൪ʹ࣮ߦͨ࣌͠ޭ͠·͢ɻ ͔͠͠ɺ B,C͔Β࢝·Δͱࣦഊ͠·͢ɻ
◾ Test “Ordering” ▪ ʮͨ·ͨ·͏·͍ͬͯ͘Δςετʯͱʁ ɾຊ ࣦഊ͖͢ςετ ͕ޭͯ͠͠·͍ͬͯΔɻ ɾςετؒʹ ґଘ
͕͋ΔͷʹɺͦΕΛݕग़Ͱ͖͍ͯͳ͍ɻ
◾ Test “Ordering” ▪ ʮͨ·ͨ·͏·͍ͬͯ͘Δςετʯͱʁ ɾຊ ࣦഊ͖͢ςετ ͕ޭͯ͠͠·͍ͬͯΔɻ ɾςετؒʹ ґଘ
͕͋ΔͷʹɺͦΕΛݕग़Ͱ͖͍ͯͳ͍ɻ ϥϯμϜ࣮ߦͰʮͨ·ͨ·͏·͍ͬͯ͘ΔςετʯΛແ͘͢ ݎ࿚ੑ61⤴
◾ Test “Ordering” ɾςετؒͰґଘ͕ແ͍Α͏ʹ͠·͠ΐ͏ ɾࣄલ/ࣄޙॲཧ͕ඞཁͰ͋ΕɺTFUVQ teardown Λ͍·͠ΐ͏
Parallel Testing
◾ Parallel Testing ※ࠓ·Ͱͷ1BSBMMFM Testing γϛϡϨʔλΛෳ ্ཱͪ͛ͯฒྻ࣮ߦ ▪ Parallel “Destination”
Testing xcodebuild test -destination ‘platform=iOS,name=iPhone X’ -destination ‘platform=iOS,name=iPad’
◾ Parallel Testing ※ࠓ·Ͱͷ1BSBMMFM Testing γϛϡϨʔλΛෳ ্ཱͪ͛ͯฒྻ࣮ߦ ▪ Parallel “Destination”
Testing xcodebuild test -destination ‘platform=iOS,name=iPhone X’ -destination ‘platform=iOS,name=iPad’ ɾiPhone X ͱ iPad ͷ γϛϡϨʔλͰฒྻ࣮ߦ ɾ֤γϛϡϨʔλͰ࣮ߦ͢Δςετέʔεಉ͡
◾ Parallel Testing ※৽͍͠1BSBMMFM Testing ̍ͭͷγϛϡϨʔλͷ ΫϩʔϯΛෳ ্ཱͪ͛ͯฒྻ࣮ߦ ɾiPhone X
ͷΫϩʔϯΛෳ্ཱͪ͛ͯฒྻ࣮ߦ ɾ֤ΫϩʔϯͰ ςετέʔεΛ୲ͯ͠ ࣮ߦ͢Δ ɾૣ͍ ▪ Parallel “Distributed” Testing
◾ Parallel “Distributed” Testing ▪ ֤ΫϩʔϯͰςετέʔεΛ୲࣮ͯ͠ߦ͢Δ XCTestCase ͷαϒΫϥε୯Ґ Ͱ୲͢Δɻ TestClass
TestClass TestClass TestClass TestClass TestClass
◾ Parallel “Distributed” Testing ▪ ֤ΫϩʔϯͰςετέʔεΛ୲࣮ͯ͠ߦ͢Δ TestClass TestClass TestClass TestClass
֤ΫϩʔϯͰࢀর͢ΔϑΝΠϧ͔Ε͍ͯΔͷͰɺ ʮଞͷΫϩʔϯ͕ઌʹϑΝΠϧ"Λ࿔͚ͬͨ࣌ͩςετ͕མͪΔ…ʯ ͱ͍͏Α͏ͳ͜ͱແ͍ɻ
◾ Parallel “Distributed” Testing ▪ Ϋϥε୯ҐͰόϥόϥʹ͢Δཧ༝ ɾςετΫϥεؒͷґଘΛͳ͘͢(ϥϯμϜςετͱಉ͡) ɾsetup, teardown ͦΕͧΕ̍ճͣͭݺΜͰཉ͍͠
ɾΫϥε୯ҐΑΓখ͘͢͞ΔͱɺTFUVQ teardownΛෳճݺͿ͜ͱʹ…
◾ Parallel “Distributed” Testing ▪ xcodebuild ίϚϯυͰɺฒྻςετʹؔ͢ΔΦϓγϣϯΛมߋͰ ͖Δ -parallel-testing-worker-count n
ɾฒྻςετதʹੜ͞ΕΔςετϥϯφʔͷ -parallel-testing-enabled YES | NO ɾεΩʔϜͷλʔήοτ͝ͱͷઃఆΛ্ॻ͖͢Δ -maximum-concurrent-test-device-destinations n ɾಉ࣌ʹςετ͢ΔσόΠεѼઌͷ࠷େ -maximum-concurrent-test-simulator-destinations n ɾಉ࣌ʹςετ͢ΔγϛϡϨʔλѼઌͷ࠷େ
◾ Parallel Testing Tips ▪ ̍ͭͷେ͖ͳςετΫϥεͭҎ্ʹׂ͠·͠ΐ͏ ɹɾʮେ͖ͳςετΫϥεʯ͕ऴΘΒͳ͍ݶΓςετऴྃʹͳΒͳ͍ ▪ ύϑΥʔϚϯεςετฒྻςετͱผʹςετ͠·͠ΐ͏ ▪
ύϥϨϧʹ ͍͍ͯͳ͍ ςετΛΓ·͠ΐ͏ ɾʮෳͷΫϩʔϯ͕ ڞ௨ͷ%#ʹΞΫηε͢ΔʯͳͲ
◾ Testing Tips & Tricks ͔Βͷൈਮ ... Λ͠Α͏ͱࢥ͚ͬͨͲ͕࣌ؒΓͳͦ͏ɻ Optimazation App
Launch When Testing("Testing Tips & Tricks"ͷ 34: 57 ~) ྑ͛͞ͳΞϓϩʔνͰͨ͠(ײ) ɾεΩʔϜ͝ͱʹڥมΛࢦఆ͠ɺʮ୯ମςετ࣌ʹෆཁͳॲཧ࣮ߦ͠ͳ͍ʯͳͲ Λߦ͏͜ͱͰςετΛૣ͘͢Δ
What's New in Testing https://developer.apple.com/videos/play/wwdc2018/403 Testing Tips & Tricks https://developer.apple.com/videos/play/wwdc2018/417