
thomhurst/tunit
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
現代的で高速かつ柔軟な.NETテストフレームワーク
概要
最新の.NETテストフレームワーク。テストはコンパイル時にソースジェネレーターを通じて発見され、デフォルトで並列実行され、Native AOTの下で動作します。すべてMicrosoft.Testing.Platform上で構築されています。 TUnitアサーションを使う場合、テストが失敗した際に、TUnitは実際に書いた式を含め、何が起きたかを教えてくれます。 オブジェクトを比較する?2つのオブジェクトグラフを押し付ける代わりに、TUnitはその違いを的確に指摘します: - — テストはビルド時にソースジェネレーターによって配線され、実行時のリフレクションで検出されません。起動速度、IDE統合の改善、ネイティブAOT/トリミングのサポートが完全に可能です。- — Roslynアナライザーのスイートが同梱されているため、誤ったフック署名、壊れたデータソース、誤用されたアサートなどのミスはビルド失敗に陥りますが、CI実行では失敗しません。- — テストは箱からすぐに同時に実行されます。[DependsOn]、[NotInParallel]、[ParallelLimiter]は必要な時に正確な順序付けとスロットリングを提供します。
概要(AI 翻訳)
最新の.NETテストフレームワーク。テストはコンパイル時にソースジェネレーターを通じて発見され、デフォルトで並列実行され、Native AOTの下で動作します。すべてMicrosoft.Testing.Platform上で構築されています。
見た目はどうなるか
TUnitアサーションを使う場合、テストが失敗した際に、TUnitは実際に書いた式を含め、何が起きたかを教えてくれます。
オブジェクトを比較する?2つのオブジェクトグラフを押し付ける代わりに、TUnitはその違いを的確に指摘します:
なぜトゥニット?
- コンパイル時テストディスカバリー — テストはビルド時にソースジェネレーターによって配線され、実行時のリフレクションで検出されません。起動速度の向上、IDE統合の改善、そして完全なネイティブAOT/トリミングサポート。
- コンパイルタイム安全性 — Roslynアナライザーのセットがボックスに同梱されているため、無効なフック署名、壊れたデータソース、誤用されたアサートなどのミスはビルド失敗に陥りますが、CI実行ではありません。
- デフォルトでは並列、実制御 — テストは同時に実行されます;
[DependsOn]、[NotInParallel]、[ParallelLimiter ]が必要な時に正確な順序付けとスロットリングを提供します。
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
TUnit
A modern .NET testing framework. Tests are discovered at compile time via source generators, run in parallel by default, and work under Native AOT — all built on Microsoft.Testing.Platform.
What it looks like
[Test]
[Arguments("GOLD", 100.00, 80.00)]
[Arguments("SILVER", 100.00, 90.00)]
public async Task Discount_Is_Applied(string tier, double subtotal, double expected)
{
var checkout = new CheckoutService();
var total = await checkout.ApplyDiscountAsync(tier, subtotal);
await Assert.That(total).IsEqualTo(expected);
}
If using TUnit Assertions, when a test fails, TUnit tells you what happened — including the actual expression you wrote:
Expected to be 80
but found 100
at Assert.That(total).IsEqualTo(expected)
Comparing objects? Instead of dumping two object graphs at you, TUnit pinpoints the difference:
Expected to be equal to Employee { FirstName = "Victoria", LastName = "Apanii", Age = 30 }
but differs at member FirstName: expected "Victoria" but found "ictoria"
at Assert.That(actualEmployee).IsEqualTo(expectedEmployee)
Why TUnit?
- Compile-time test discovery — tests are wired up by a source generator at build time, not found via reflection at runtime. Faster startup, better IDE integration, and full Native AOT / trimming support.
- Compile-time safety — a suite of Roslyn analyzers ships in the box, so mistakes like invalid hook signatures, broken data sources, and misused assertions fail your build, not your CI run.
- Parallel by default, with real control — tests run concurrently out of the box;
[DependsOn],[NotInParallel], and[ParallelLimiter]give you precise ordering and throttling when you need it.
推奨ツール
別のキーワードを試すか、フィルタを外してください。
インストール
npx skillfish add thomhurst/tunit