Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
"Meet Swift Testing" & "Go further with Swift T...
Search
log5
July 02, 2024
Technology
0
190
"Meet Swift Testing" & "Go further with Swift Testing" in 5 min
「集まれSwift好き!Swift愛好会スピンオフ WWDC24セッション要約会 @ DeNA」 における発表資料
log5
July 02, 2024
Tweet
Share
More Decks by log5
See All by log5
App Clipの魔法: iOSデザイン開発の新時代
judau
2
1.4k
AppCodeのサ終から半年後
judau
1
170
Aquaの波紋によせて
judau
0
120
iOSは自動作曲の夢を見るか
judau
0
1.2k
What's New in App Clips after WWDC23
judau
1
120
「そういえば何でテストエンジニアやめたん?」〜5年前の振り返りなの
judau
0
160
App Clips はどこから来たのか&何者か&どこへ行くのか
judau
1
930
Other Decks in Technology
See All in Technology
Dojo 20240830 COBOL to Java on Z
ichikawayasuhisa
0
240
FastConnect の冗長性
ocise
0
7.1k
実践ジオフェンス 効率的に開発するために
navitimejapan
PRO
2
130
中規模・ミドルTier開発組織におけるDevRelの戦略と実行と成果 - DevRel Guild Conference Mini -
leveragestech
2
260
セキュリティ監視の内製化 効率とリスク
mixi_engineers
PRO
4
640
手軽に始める? おうちサーバーのすゝめ
nyagasan
0
180
エンジニア向け会社紹介資料
caddi_eng
15
250k
分野に潜むツールの紹介
pojiro
1
330
SHIFTの課題と目指したい組織像 / 20240827 Rinto Ikenoue
shift_evolve
0
140
タイミーのBraze活用 ~PUSH通知を活用したレコメンド~
ozeshun
2
120
contenteditableと向き合う
kikuchikakeru
2
140
バックログを導入し やっぱやめた話
ota42y
0
170
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
72
8.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
22
1.7k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
29
2.5k
Stop Working from a Prison Cell
hatefulcrawdad
266
20k
Designing the Hi-DPI Web
ddemaree
278
34k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
33
1.7k
Making Projects Easy
brettharned
113
5.8k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
42
2k
Mobile First: as difficult as doing things right
swwweet
220
8.8k
It's Worth the Effort
3n
182
27k
Designing on Purpose - Digital PM Summit 2013
jponch
113
6.8k
A Tale of Four Properties
chriscoyier
155
22k
Transcript
Meet Swift Testing Go further with Swift Testing log5 at
ू·ΕSwift͖ʂSwiftѪձεϐϯΦϑ WWDC24ηογϣϯཁձ @ DeNA Λ5Ͱཧղ͢Δ·ͱΊ
Meet Swift Testing
Swift Testing ͱ • SwiftίʔυͷςετΛ༰қ͔ͭڧྗʹ • Φʔϓϯιʔεύοέʔδ
ϞμϯͳSwiftͱͷ౷߹ • Async/await Actor isolation Λαϙʔτ • ϚΫϩʹΑΔৄࡉͳΤϥʔϨϙʔτ
ॊೈͳςετઃܭ JUnitͱ͔TestNGͱ͔ͰݟͨΞϨ • ͖݅ςετ࣮ߦ • ΧελϜλάʹΑΔςετͷάϧʔϓԽ • ύϥϝʔλϥΠζυɾςετ • ෳͷҾͰςετΛ܁Γฦ࣮͠ߦ
XCTestͱԿ͕ҧ͏? • ΑΓ໌ࣔతͳςετࢦఆ • ͏ testͳΜͱ͔ͱ͍͏ϝιου͡Όͳ͍͍ͯ͘ • γϯϓϧͳظνΣοΫ • XCTAssertGreaterThanͳΜͱ͔֮͑ͳͯ͘ྑ͍
• structͰςετεΠʔτ͕ॻ͚Δ
ΦʔϓϯιʔεͱϚϧνϓϥοτϑΥʔϜ • ιʔείʔυ͕GitHub্ʹ • ίϛϡχςΟओಋͷ։ൃ • AppleϓϥοτϑΥʔϜ͚ͩͰͳ͘LinuxWindowsαϙʔτ
ϙΠϯτ • ςετؔ (@Test attribute) • ظνΣοΫ (#expectϚΫϩ) • τϨΠτ
(@available ͷؒΈ͍ͨͳͷ) • ςετεΠʔτ (@Suite ͰςετΛάϧʔϓԽ)
Swift Testing ʹ͍ͭͯ ཁ͢Δʹ • Swift Testing • Xcode 16Swift
Package Managerͱ౷߹ • طଘͷXCTestͱڞଘՄೳ • ςετͷ্࣭ͱޮԽ
Go further with Swift Testing
Swift Testingͷৄࡉ • Swift TestingͰςετΛڧԽʂ • Մಡੑɺཏੑɺ৫Խɺฒྻ࣮ߦ
දݱྗUP • ΤϥʔϋϯυϦϯάͷςετ͕༰қͳ expect throwsϚΫϩ • OptionalͷݕূʹϐολϦͳ required • ͳΜ͔όάͰ௨ͤͳ͍ͱ͖
withKnownIssue • CustomTestStringConvertible ͰΘ͔Γ͍͢Τϥʔϝοηʔδ • ςετ࣌ͷϩάΛ͖ʹͰ͖Δ → ςετϨϙʔτಡΈ͍͢
ύϥϝʔλϥΠζυɾςετ ੲ͔Β͜ΕຊޠͰͳΜ͍ͯ͏ͷ͔Α͘Θ͔ΒΜ • 1ͭͷςετؔͰෳͷέʔεΛΧόʔ • For-each෦ͰͷΞαʔγϣϯ͕खܰʹ • ෳͷೖྗύϥϝʔλʹରԠ • ςετέʔεͷΈ߹ΘͤΛࣗಈੜ
• (ΦʔϧϖΞ๏ʢϖΞϫΠζ๏ʣ͕ग़ͯ͘Δ͔ͱظ͚ͨ͠Ͳҧͬͨ)
৫Խ (ͬͯ༁ޠ͋ͬͯΔʁ) • ωετ͞ΕͨςετεΠʔτ • @Tag ʹΑΔςετͷؔ࿈͚ͱ࣮ߦ੍ޚ • Xcodeͷ৽ػೳΛ׆༻ͨ͠λάϕʔεςετཧ
ςετͷฒྻ࣮ߦ • σϑΥϧτͰฒྻ࣮ߦ → ߴԽ • ςετؒͷӅΕͨґଘ͕ؔݟ͔ͭΔ • ͍͖ͳΓγϟοϑϧͰ͖ͳ͍ͳΒ.serializedτϨΠτͰஞ࣮࣍ߦ
ඇಉظςετ • Swift Concurrencyͱͷ౷߹ • try await confirmation • Completion
Handler event handler ͷςετʹͽͬͨΓ • (ݸਓతʹ5લʹObjective-CͷϓϩδΣΫτͰཉ͔ͬͨ͠ʣ
Swift Testing ͷৄࡉ ͭ·ΓͲΏ͜ͱ • Swift Testing • ςετίʔυͷ࣭ͱޮΛେ෯ʹ্ •
Xcodeͱ౷߹͞Ε͍͍ͯͯ͢ (Xcodeࣗମ͕͍͍͔͢ॾઆ͕) • Test PlanXcode CloudͰ׆༂ • ΑΓ৴པੑͷߴ͍ιϑτΣΞΛޮతʹ։ൃ
ϫΠͦΖͦΖiOS։ൃͨ͘͠ͳ͖ͬͯͨ(´ɾТɾʆ) Happy Testing!