遅いテストを速くする

toms
November 27, 2026

 遅いテストを速くする

JJUG CCC 2026 Fall の発表資料

Zennの記事: https://zenn.dev/toms74209200/articles/make-slow-tests-fast

# 参考文献

- Googleのソフトウェアエンジニアリング―持続可能なプログラミングを支える技術、文化、プロセス, Titus Winters, Tom Manshreck, Hyrum Wright, 竹辺 靖昭, 久富木 隆一, オライリー・ジャパン, 2021 https://www.oreilly.co.jp/books/9784873119656/
- Clean Architecture 達人に学ぶソフトウェアの構造と設計, Robert C.Martin, 角 征典, 高木 正弘, ドワンゴ, 2018 https://asciidwango.jp/post/176293765750/clean-architecture
- 手を動かしてわかるクリーンアーキテクチャ ヘキサゴナルアーキテクチャによるクリーンなアプリケーション開発, Tom Hombergs, 須田 智之, インプレス, 2024 https://book.impress.co.jp/books/1123101096
- Database and Always-Valid Domain Model · Enterprise Craftsmanship https://enterprisecraftsmanship.com/posts/database-always-valid-domain-model/

toms

November 27, 2026

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

20 slides
  1. テストの特性を知る: Googleのテストサイズ Feature Small Medium Large Network access No localhost

    only Yes Database No Yes Yes File system access No Yes Yes Use external systems No Discouraged Yes Multiple threads No Yes Yes Sleep statements No Yes Yes System properties No Yes Yes Time limit (seconds) 60 300 900+ 『Googleのソフトウェアエンジニアリング―持続可能なプログラミングを支える技術、文化、プロセス』 https://testing.googleblog.com/2010/12/test-sizes.html
  2. テストの特性を知る: Googleのテストサイズ Feature Small Medium Large Network access No localhost

    only Yes Database No 安定 Yes Yes 不安定 File system access No Yes Yes Use external systems No Discouraged Yes 安定性 テスト時間 短い No Yes Sleep statements No Yes Yes System properties No Yes Yes Time limit (seconds) 60 300 900+ Multiple threads 長い Yes https://testing.googleblog.com/2010/12/test-sizes.html
  3. ドメインの関心ごと: 「ユーザー」とはなにか • ユーザーはメールアドレスとパスワードを持っている • ユーザーには仮ユーザーとプレミアムユーザーがある // ユーザーはメールアドレスとパスワードを持っている Optional<User> from(String

    mail, String password); • 仮ユーザーのメールアドレスは検証されていない // ユーザーには仮ユーザーと本ユーザーがある • sealed interface User permits ProvisionalUser, VerifiedUser {} // 本ユーザーには通常ユーザーとプレミアムユーザーがある メールアドレスの検証とは、メールを送信し、ユーザーがマジックリンクにアクセ sealed interface VerifiedUser extends User permits RegularUser, PremiumUser {} スすること • // プレミアムユーザーは年間で5万円以上買い物したユーザー VerifiedUser from(VerifiedUser user, AnnualPurchase purchase); プレミアムユーザーは年間で5万円以上買い物したユーザー
  4. テストにもソフトウェアエンジニアリングを • Googleのテストサイズで分類する ドメインの関心ごと • small testで速く網羅的・忠実 • Always-Validとなるようにドメインの関心ごとを見つける アプリケーションの関心ごと

    • medium/largeなのでトレードオフを意識 • コードを書かない・テストを減らす 『Googleのソフトウェアエンジニアリング―持続可能なプログラミングを支える技術、文化、プロセス』より

More Decks by toms

Other Decks in Programming