Enhance documentation for TUnit integration and usage#50094
Enhance documentation for TUnit integration and usage#50094thomhurst wants to merge 17 commits intodotnet:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances documentation for TUnit, a .NET testing framework built entirely on Microsoft.Testing.Platform, by adding comprehensive tutorials, examples, and integration guides across multiple languages and scenarios.
- Adds complete TUnit getting-started tutorials for C#, F#, and Visual Basic with test-driven development (TDD) workflows.
- Expands Microsoft.Testing.Platform documentation to show that extensions work with TUnit alongside MSTest, NUnit, and xUnit.
- Provides practical examples for filtering tests, ordering with dependencies, code coverage setup, and mutation testing with TUnit.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/core/testing/unit-testing-visual-basic-with-tunit.md | New tutorial for unit testing Visual Basic with TUnit, including project setup, test creation, and parameterized tests. |
| docs/core/testing/unit-testing-fsharp-with-tunit.md | New tutorial for unit testing F# with TUnit, demonstrating the test-driven development approach for functional code. |
| docs/core/testing/unit-testing-csharp-with-tunit.md | New tutorial for unit testing C# with TUnit, showing async test patterns and source generation features. |
| docs/core/testing/unit-testing-code-coverage.md | Added section on using code coverage with TUnit, including project setup and Microsoft.Testing.Extensions.CodeCoverage integration. |
| docs/core/testing/selective-unit-tests.md | Added TUnit examples for filtering tests using --treenode-filter flag with path-based syntax and attribute filtering. |
| docs/core/testing/order-unit-tests.md | Added TUnit section demonstrating [DependsOn] attribute for controlling test execution order through explicit dependencies. |
| docs/core/testing/mutation-testing.md | Added TUnit examples for mutation testing with Stryker.NET using async test patterns. |
| docs/core/testing/microsoft-testing-platform-intro.md | Updated TUnit description to clarify it only supports Microsoft.Testing.Platform and added link to getting started guide. |
| docs/core/testing/index.md | Enhanced TUnit section with detailed feature description and links to language-specific tutorials. |
|
Please take a look. |
Evangelink
left a comment
There was a problem hiding this comment.
@Youssef1313 and @nohwnd for extra reviews.
| Return Task.Run(Async Function() | ||
| Dim result As Boolean = _primeService.IsPrime(1) | ||
| Await Assert.That(result).IsFalse() | ||
| End Function) |
There was a problem hiding this comment.
Why this complexity? I think you should be able to declare the function as async, and await in it directly instead of returning a task created by Task.Run?
| Imports TUnit.Assertions.Extensions | ||
| Imports TUnit.Core | ||
|
|
||
| Namespace PrimeService.Tests |
There was a problem hiding this comment.
Can you please ensure that this doesn't duplicate the namespace?
IIRC, VB already uses RootNamespace, and having explicit namespace is duplicating it. But I might be misremembering.
There was a problem hiding this comment.
Sorry what do you mean RootNamespace? I think this should be consistent with other VB examples?
|
Thanks for the comments @Evangelink and @Youssef1313 - Have made changes |
There was a problem hiding this comment.
This whole page will be confusing for MTP. I think it needs a bit of general re-work. Best in a separate PR. I'll try to handle it soon.
There was a problem hiding this comment.
I was wondering if these pages should be moved under each framework instead of being general with tabs per framework and potentially per platform.
There was a problem hiding this comment.
You're probably right. Currently different frameworks have different syntaxes and switches
…nit tests documentation with TUnit filter syntax
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
….Platform and adjust related content across multiple files
…and VB documentation
…nks in C# and VB documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dba7848 to
5845aa4
Compare
… language - Remove links to xUnit samples from C# and VB TUnit tutorials - Fix VB tutorial to use <Test> attribute syntax instead of [Test] - Add missing ASP.NET Core include to C# and VB TUnit tutorials - Alphabetize MTP frameworks lists in code coverage page - Add missing xUnit runner link to framework-specific docs - Use void instead of async Task for empty test bodies in selective-unit-tests - Neutralize promotional language in TUnit description - Remove biased "modern" and "traditional" labels for test platforms Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…syntax - Alphabetize TUnit before xUnit in MTP intro framework list - Use period instead of colon for TUnit entry consistency - Add missing using TUnit.Core in C# tutorial test example - Remove link to wrong F# sample repository - Use VB <Arguments> syntax instead of C# [Arguments] in VB tutorial - Remove residual promotional "parallel by default" claim Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@thomhurst there are a few more updates and fixes to do, I can help with linters one if you need help. |
- Add blank lines before lists to fix MD032 markdownlint errors - Fix broken link to unit-testing-mstest-runner-intro.md - Use empty method bodies in TUnit order examples per review
|
Thanks @Evangelink - Pushed again |
This pull request expands documentation for TUnit, a .NET testing framework built on Microsoft.Testing.Platform, and clarifies its support for various extensibility features and workflows. The changes improve coverage of TUnit in comparison to other frameworks, add practical examples for advanced scenarios (such as filtering, ordering, code coverage, and mutation testing), and update documentation to show that Microsoft.Testing.Platform extensions work with TUnit.
TUnit documentation enhancements:
dotnet test --filter, including supported attributes and operator usage. [1] [2][DependsOn]attribute, covering dependency handling, failure behavior, and method overloads.Integration with Microsoft.Testing.Platform extensions:
Advanced testing scenarios with TUnit:
Internal previews