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
Microsft Testing Platform と TUnitで単体テスト実行
Search
KM5075
May 24, 2026
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Microsft Testing Platform と TUnitで単体テスト実行
KM5075
May 24, 2026
More Decks by KM5075
See All by KM5075
祝!!System.CommandLine GA!!
km5075
0
380
Featured
See All Featured
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
600
Everyday Curiosity
cassininazir
0
350
Typedesign – Prime Four
hannesfritz
42
3.2k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Become a Pro
speakerdeck
PRO
31
6.3k
Un-Boring Meetings
codingconduct
0
460
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
280
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
580
The Cult of Friendly URLs
andyhume
79
7k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
Transcript
Microsoft Testing Platform ~AOTコンパイルで単体テストを一瞬で終わらせる~ .NETラボ 勉強会 2026年5月
自己紹介 茨城県水戸市在住エンジニア .Net , Azure 大好き 趣味:グラップリング、柔術
↑練習後の様子
Microsoft Testing Platformとは Microsoft Testing Platformが昨年発表したテストプラットフォーム Microsoft。Testing.Platform (MTP)
は、継続的インテグレーション (CI) パイプ ライン、CLI、Visual Studio テスト エクスプローラー、VS Code テスト エクス プローラーなど、すべてのコンテキストでテストを実行するための、VSTest の軽 量で移植可能な代替手段です。 MTP はテスト プロジェクトに直接埋め込まれて おり、テストの実行に必要な vstest.console や dotnet test など、他のアプリの 依存関係はありません。(公式概要より) Microsoft.Testing.Platform の概要 - .NET テストランナー - .NET | Microsoft Learn
なぜ新しく作ったのか?何が新しい? 既存システム(VSTest)のアーキテクチャーでは.NET以降に発生した問題に対応 できないケースが増えてきた リフレクションを用いた動的な実行や他のライブラリに依存しているため環境によっ て不安定になることがある。 特にローカル(Windows)ーCI(Ubuntu)間で結果が異なるなど
Hostable:テストのランタイムを指定のアプリ内にホストできる 任意のアプリケーション内でテスト実行可能 制限があるデバイスや特殊な環境にも対応できる ネイティブAOT対応 後述のTunitを使用するとネイティブAOTでテスト実行をものすごく早くできる。
TUnit Microsoft Testing Platform上に構築されたサードパーティー製のテストライブラリ MSTestやNUnitと同じくくり リフレクションを使用せずSource Generatorを用いることでコンパイル時に決定
Mockライブラリの自前で用意 AOTを用いることで単体テスト時間をものすごく短くできるらしい
Tunit公式のベンチマーク
検証してみた 環境:.NET 10 テスト内容:簡単なソフト300件のユニットテストを実装 いろいろ言いたいことはあるが確かにAOTコンパイル時には実行時間がかなり早く なってる。 実行時間_ms
構成 No 1041 MSTest + VSTest 1 2376 MSTest + MTP 2 2842 TUnit + MTP 3 133 TUnit + MTP + AOT 4
ただし。。。 ビルド時間はAOTコンパイルありのものが圧倒的に⾧い 10秒以上。。。 「テストが遅いからAOTコンパイルに変える」 結局ビルド時間で払うことになる可能性があるためバランスについてはチームごとに要検証
TUnit自体デフォルトで並列実行になっていたり早くなりやすいはある
まとめ VSTestの代わりになる新しいプラットフォームがでたよ!!! 今後はそっちにシフトしていきたい? 併せてTunitというライブラリもサードパーティーから出てるよ!!