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

"Meet Swift Testing" & "Go further with Swift T...

log5
July 02, 2024

"Meet Swift Testing" & "Go further with Swift Testing" in 5 min

「集まれSwift好き!Swift愛好会スピンオフ WWDC24セッション要約会 @ DeNA」 における発表資料

log5

July 02, 2024
Tweet

More Decks by log5

Other Decks in Technology

Transcript

  1. Meet Swift Testing Go further with Swift Testing log5 at

    ू·ΕSwift޷͖ʂSwiftѪ޷ձεϐϯΦϑ WWDC24ηογϣϯཁ໿ձ @ DeNA Λ5෼Ͱཧղ͢Δ·ͱΊ
  2. ϙΠϯτ • ςετؔ਺ (@Test attribute) • ظ଴஋νΣοΫ (#expectϚΫϩ) • τϨΠτ

    (@available ͷ஥ؒΈ͍ͨͳͷ) • ςετεΠʔτ (@Suite ͰςετΛάϧʔϓԽ)
  3. Swift Testing ʹ͍ͭͯ ཁ͢Δʹ • Swift Testing͸ • Xcode 16΍Swift

    Package Managerͱ౷߹ • طଘͷXCTestͱڞଘՄೳ • ςετͷ඼࣭޲্ͱޮ཰Խ
  4. දݱྗUP • ΤϥʔϋϯυϦϯάͷςετ͕༰қͳ expect throwsϚΫϩ • Optional஋ͷݕূʹϐολϦͳ required • ͳΜ͔όάͰ௨ͤͳ͍ͱ͖͸

    withKnownIssue • CustomTestStringConvertible ͰΘ͔Γ΍͍͢Τϥʔϝοηʔδ • ςετ࣌ͷϩάΛ޷͖ʹͰ͖Δ → ςετϨϙʔτ΋ಡΈ΍͍͢
  5. ඇಉظςετ • Swift Concurrencyͱͷ౷߹ • try await confirmation • Completion

    Handler ΍ event handler ͷςετʹͽͬͨΓ • (ݸਓతʹ5೥લʹObjective-CͷϓϩδΣΫτͰཉ͔ͬͨ͠ʣ
  6. Swift Testing ͷৄࡉ ͭ·ΓͲΏ͜ͱ • Swift Testing͸ • ςετίʔυͷ඼࣭ͱޮ཰Λେ෯ʹ޲্ •

    Xcodeͱ౷߹͞Εͯͯ࢖͍΍͍͢ (Xcodeࣗମ͕࢖͍΍͍͔͢͸ॾઆ͕) • Test Plan΍Xcode CloudͰ΋׆༂ • ΑΓ৴པੑͷߴ͍ιϑτ΢ΣΞΛޮ཰తʹ։ൃ