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
Swift Testingのモチベを上げたい
Search
stotic-dev
March 04, 2025
Programming
440
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swift Testingのモチベを上げたい
Swift愛好会 vol92の談義資料
stotic-dev
March 04, 2025
More Decks by stotic-dev
See All by stotic-dev
低コストで始めるiOSアプリ開発のVRT
stoticdev
0
110
Swift macrosの入門ハードルは意外と低いかも
stoticdev
1
96
SwiftUIとMetalで簡単に作るレアカード風UI
stoticdev
1
200
PRレビューのお供にDanger
stoticdev
1
440
Other Decks in Programming
See All in Programming
Crash Auto Pipelines
veronikapj
1
300
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
350
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
5k
[DroidKnights 2026] Workflow AX: From Auto-Documented Policies to E2E Testing
raeminkang
0
230
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
240
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
300
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
210
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
6.1k
LLM 101
dalinaum
0
430
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.3k
Getting Started with Vibe Coding
miccheng
0
140
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
330
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
600
How STYLIGHT went responsive
nonsquared
100
6.3k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
770
Why Our Code Smells
bkeepers
PRO
340
58k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Context Engineering - Making Every Token Count
addyosmani
9
1.3k
Odyssey Design
rkendrick25
PRO
2
910
KATA
mclloyd
PRO
35
16k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
350
Amusing Abliteration
ianozsvald
1
370
Transcript
Swift TestingϞνϕΛ্͍͛ͨ 2025/03/04 SwiftѪձ vol.92
ࣗݾհ ໊લࠤ౻ଡҰ झຯϦΫΨϝؑ גࣜձࣾ13&7&/5 ৬ۀJ04ΤϯδχΞ (JU)VCIUUQTHJUIVCDPNTUPUJDEFW 2JJUBIUUQTRJJUBDPNTUPUJDEFW 9IUUQTYDPNTF T
ΞδΣϯμ • Ϟνϕʔγϣϯ • Swift Testingͱ • ͲΜͳ՝ΛղܾͰ͖Δͷ͔ • ಋೖʹ͋ͨͬͯͷݒ೦
• ·ͱΊ
Ϟνϕʔγϣϯ ۀͰSwift TestingΛಋೖ͍ͨ͠!
Swift Testingͱ [Ҿ༻] " Swift Testing ɺSwift ίʔυͷςετΛ؆୯ʹ͢Δදݱྗ๛͔Ͱײతͳ API Λඋ͑ͨύοέʔδͰ͢ɻ
" https://github.com/swiftlang/swift-testing
Swift Testingͷಛ ςετʹ༻͢ΔAPI͕ײతʹͳͬͨ(ֶशίετ͕͍) https://developer.apple.com/documentation/testing/migratingfromxctest#Check-for-expected-values-and-outcomes
Swift Testingͷಛ ύϥϝλϥΠζυςετ͕ϑϨʔϜϫʔΫͰαϙʔτ͞ΕΔΑ͏ʹͳͬͨ https://developer.apple.com/documentation/testing/parameterizedtesting
Swift Testingͷಛ https://qiita.com/stotic-dev/items/f9fe0211f34b7c04c440 ଞʹͨ͘͞Μͷಛ͕ʂʂ
ղܾͰ͖Δ՝ • ςετͷ࣮ߦ • ςετͷՄಡੑɾอकੑ • ςετͷ৴པੑ
ςετͷ࣮ߦ • Swift TestingσϑΥϧτͰฒྻ࣮ߦ͞ΕΔ • ύϥϝλϥΠζυςετͷ࣮ߦฒྻ࣮ߦʹͳΔ • Swift TestingͱXCTestͷฒྻ࣮ߦʹҎԼҧ͍͕͋Δ •
XCTest: ෳϓϩηεͰҰͭͷςετΛ࣮ߦ͢Δ • Swift Testing: ҰͭͷϓϩηεͰฒྻ࣮ߦ͢Δ ϓϩηε1 ϓϩηε2 ϓϩηε3 7 6 5 4 1 2 3 ϓϩηε1 1 2 3 7 6 5 4 XCTestͷฒྻςετख๏ Swift Testingͷฒྻςετख๏ ϓϩηεͷ্ཱͪ͛ϝϞϦͰΦʔόʔϔου
ςετͷՄಡੑɾอकੑ ςετέʔεߏԽ͞Ε͍ͯΔํ͕ݟ͍͢
ςετͷՄಡੑɾอकੑ ΤοδέʔεΛݕূ͢ΔͨΊͷόϦΤʔγϣϯͷςετέʔε͕ɺ 1ͭͷέʔεͰॻ͚Δ
ςετରͷमਖ਼͕ೖͬͯɺςετίʔυͷϝϯς͕ೖͬͯ͜ͷέʔεΛ मਖ਼͢Δ͚ͩͰ͢Ή
ςετͷ৴པੑ ӕΛ͔ͭΕΔͱ৴པͰ͖ͳ͘ͳΔ ςετίʔυِཅੑͱ͍͏ܗͰӕΛͭ͘ ௨৴ ࣮ߦॱং ڞ༗ґଘ ϦϑΝΫλϦϯά
ςετͷ৴པੑ [Ҿ༻] " ͠ɺਖ਼ͳཧ༝ͳ͘ςετ͕ࣦഊ͢ΔΑ͏ʹͳΔͱɺϓϩμΫγϣϯɾίʔυͷʹରԠ ͢Δ։ൃऀͷೳྗͱҙࢥΛऑΊΔ͜ͱʹͳΔɻͳͥͳΒɺςετରͷίʔυ͕ਖ਼͘͠ৼΔͬ ͔͔ͯΘΒͣɺςετ͕ࣦഊ͢ΔΑ͏ͳ͜ͱ͕ଓ͘ͱɺ։ൃऀͦͷ͜ͱʹ׳Εͯ͠·͍ɺςε τ݁ՌΛॏཁࢹ͠ͳ͘ͳΔ͔ΒͰ͋Δɻ " " ຊདྷਖ਼ͳৼΔ͍Ͱ͋Δͷʹ͔͔ΘΒͣɺςετ͕සൟʹࣦഊ͍ͯ͠Δͱɺςετʹର͢
Δ৴པ͕ঃʑʹࣦΘΕ͍ͯ͘ɻͦͷ݁Ռɺςετͷ͜ͱΛ৴པͰ͖ΔηʔϑςΟɾωοτͱͯ͠ ݟΒΕͳ͘ͳΓɺςετΛߦ͏ҙຯ͕ബΕͯ͠·͏ɻ " ୯ମςετͷߟ͑ํ/͍ํ p99 (ஶ) Vladimir Khorikov (༁) ਢాஐ೭
ςετͷ৴པੑ [Ҿ༻] " ୯ମςετΛߦ͏͜ͱͷඪɺιϑτΣΞ։ൃʹؔ͢ΔϓϩδΣΫτͷΛ࣋ଓՄೳͳ ͷʹ͢Δɺͱ͍͏͜ͱͰ͋Δɻ " ୯ମςετͷߟ͑ํ/͍ํ p24 (ஶ) Vladimir
Khorikov (༁) ਢాஐ೭
ςετͷ৴པੑ ཧͱͯ͠શͯͷFlakyςετमਖ਼ͯ͠৴པͰ͖Δςετʹ͖͢ ͨͩ؆୯ʹमਖ਼Ͱ͖Δ͔ΓͰͳ͍ɺɺ ৴པੑΛ୲อ͢Δݱ࣮తͳҊͱͯ͠ɺ ৴པͰ͖Δςετͱͦ͏Ͱͳ͍ςετΛ͚Δ ୯७ʹमਖ਼͢Δ࣌ؒͳ͍ɺɺ
ςετͷ৴པੑ Swift TestingͷλάͷػೳΛ༻͍ͯɺ৴པͰ͖Δςετͱͦ͏Ͱͳ͍ςετΛ͚Δ
ಋೖʹ͋ͨͬͯͷݒ೦ & ҙ • ಋೖ͕େมͦ͏ • XCTestͱڞଘͰ͖Δ͔Βେৎʂ • Xcode16͔Βඪ४ͰΈࠐ·Ε͍ͯΔʂ(Xcode15ҎԼͰSPMͰಋೖ͢Δඞཁ͋Γ) •
Xcode16ະຬͷ߹ͰSPM͔ΒಋೖՄೳʂ • UITest(XCUIApplication)ੑೳςετ(XCTMetric)Swift Testingͷαϙʔτ֎ͳͷͰɺ Ҿ͖ଓ͖XCTestΛ͏ඞཁ͕͋Δ • ύϥϝλϥΠζυςετΛཚ༻͢ΔͱՄಡੑ͕Լ͕Γͦ͏ • OSS ϩάformatterͰςετ݁Ռ͕Ұ෦ग़ྗ͞Εͳ͍
ύϥϝλϥΠζυςετͷҙ έʔε໊͕நతͰɺinputʹରͯ͠ͲΜͳOutputʹͳΔͷ͔Θ͔ΓͣΒ͍
ύϥϝλϥΠζυςετͷҙ ݁ՌͷछྨʹΑͬͯέʔεΛ͚ͨํ͕ɺέʔε໊ͷந͕Լ͕ͬͯ ԿͷৼΔ͍Λݕূ͠Α͏ͱ͍ͯ͠Δͷ͔͕Θ͔Γ͍͢
OSS ϩά formatterͰςετ݁Ռ͕ग़ྗ͞Εͳ͍ xcprettyฒྻςετʹରԠ͍ͯ͠ͳ͍
OSS ϩά formatterͰςετ݁Ռ͕ग़ྗ͞Εͳ͍ xcbeautifyฒྻςετΛαϙʔτ͍ͯ͠Δ ύϥϝλϥΠζυςετදࣔͰ͖͍ͯͳ͍
OSS ϩά formatterͰςετ݁Ռ͕ग़ྗ͞Εͳ͍ Ϩϙʔτͷใ͕ཉ͍͠߹ɺxcresult͔Βऔಘ͢Δඞཁ͕͋Γͦ͏
·ͱΊ • Swift TestingWWDC24Ͱൃද͞Εͨ৽͍͠SwiftͷςετϑϨʔϜϫʔΫ • Swift TestingΛಋೖ͢ΔͱҎԼͷԸܙΛಘΒΕΔ͔͠Εͳ͍ • ୯ମςετ࣮ߦͷߴԽ •
ςετίʔυͷՄಡੑ্ • ςετίʔυͷอकੑ্ • ςετͷ৴པੑ্
·ͱΊ • Swift TestingΛಋೖ͢Δʹ͋ͨͬͯͷݒ೦ • ύϥϝλϥΠζυςετͷཚ༻ʹΑΔՄಡੑͷԼ • ਖ਼ৗܥͱҟৗܥͰέʔεΛ͚ΔͳͲɺέʔε͔Βݕূ͢ΔৼΔ͍͕ಡΈऔΕΔཻͰ׆ ༻͢Δ •
OSS formatterͰSwift Testingͷςετ݁ՌΛग़ྗͰ͖ͳ͍έʔε͕͋Δ • xcresultΛιʔεʹѻ͏Α͏ʹ͢Δ • ΫϦςΟΧϧͳݒ೦جຊͳ͍ͷͰɺಋೖ͍ͨ͠ʂʂ
ࢀߟ • https://developer.apple.com/videos/play/wwdc2024/10179 • https://developer.apple.com/videos/play/wwdc2024/10195/ • https://developer.apple.com/documentation/testing/de f iningtests •
https://developer.apple.com/documentation/testing/parameterizedtesting • https://developer.apple.com/documentation/testing/migratingfromxctest#Check-for-expected-values-and-outcomes • https://leocoout.medium.com/welcome-swift-testing-goodbye-xctest-7501b7a5b304 • https://developer.apple.com/documentation/testing/parallelization • https://github.com/xcpretty/xcpretty/issues/295 • https://github.com/swiftlang/swift-testing • https://qiita.com/bsj-k-hashikawa/items/603b7b842fede13942ca • https://qiita.com/yonetty/items/ 447cd47fe5d37473cb2d#%E6%A7%8B%E9%80%A0%E5%8C%96%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3 %82%8Bstructured • ୯ମςετͷߟ͑ํ/͍ํ (ஶ) Vladimir Khorikov (༁) ਢాஐ೭