diff --git a/CLAUDE.md b/CLAUDE.md index 14eba45..fc2bb32 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,7 +1,7 @@ # TUnit docs — local Markdown copy Every page of https://tunit.dev/docs as Markdown, one file per page, same tree as the site. -Mirrored from `https://tunit.dev/llms.txt`; latest TUnit release at refresh time: `v1.68.17` (see `VERSION`). +Mirrored from `https://tunit.dev/llms.txt`; latest TUnit release at refresh time: `v1.70.1` (see `VERSION`). ## How to use this folder @@ -144,6 +144,7 @@ This file is generated — edit `scripts/refresh_docs.py`, not this file. - `docs/reference/environment-variables.md` — **Environment Variables**: TUnit supports configuration through environment variables, allowing you to set defaults without modifying command-line arguments. - `docs/reference/programmatic-configuration.md` — **Programmatic Configuration**: Overview - `docs/reference/test-configuration.md` — **Test Configuration**: TUnit supports having a testconfig.json file within your test project. +- `docs/reference/tunit0075.md` — **TUnit0075: Use the hook cancellation token for setup**: Severity: Warning ### `docs/writing-tests/` diff --git a/VERSION b/VERSION index 666c7ae..5817dd3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.68.17 +v1.70.1 diff --git a/WHATSNEW.md b/WHATSNEW.md index 893b84c..013def9 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -1,41 +1,201 @@ -# TUnit v1.68.4 → v1.68.17 +# TUnit v1.68.17 → v1.70.1 -Compare: https://github.com/thomhurst/TUnit/compare/v1.68.4...v1.68.17 +Compare: https://github.com/thomhurst/TUnit/compare/v1.68.17...v1.70.1 ## Releases -### v1.68.17 +### v1.69.0 -* fix(mocks): emit init accessors for init-only properties and indexers by @thomhurst in https://github.com/thomhurst/TUnit/pull/6833 -* fix(mocks): let one type be mocked regularly and wrapped in one compilation by @thomhurst in https://github.com/thomhurst/TUnit/pull/6835 -* fix(mocks): keep editors in sync with publicized project references (#6836) by @thomhurst in https://github.com/thomhurst/TUnit/pull/6837 +* feat(templates): add enableDotCover flag (#6714) by @ForNeVeR in https://github.com/thomhurst/TUnit/pull/6844 +* fix: don't request semantic models for attribute syntax from other compilations (DevKit crash) by @thomhurst in https://github.com/thomhurst/TUnit/pull/6855 +* fix(ci): restore net472 PublicAPI tests on Windows by @thomhurst in https://github.com/thomhurst/TUnit/pull/6857 +* perf(html-report): stream report JSON through pooled chunks and overlap sidecar serialization by @thomhurst in https://github.com/thomhurst/TUnit/pull/6860 +* chore(renovate): cap Microsoft.Build packages below 18.10.0 by @thomhurst in https://github.com/thomhurst/TUnit/pull/6863 +* perf: shrink generated per-class test source static constructors (~40% less startup JIT) by @thomhurst in https://github.com/thomhurst/TUnit/pull/6859 +* refactor: remove unreachable decimal source-text path from GenerateAttributeInstantiation by @thomhurst in https://github.com/thomhurst/TUnit/pull/6856 +* perf: cut per-test allocations in discovery and execution (-61% at 10k tests) by @thomhurst in https://github.com/thomhurst/TUnit/pull/6861 +* perf: stop hashing per-test event receivers during registration (data-driven tests 2.9x faster at 10k) by @thomhurst in https://github.com/thomhurst/TUnit/pull/6858 +* perf(analyzers): cut TUnit analyzer build time ~60% on large test projects by @thomhurst in https://github.com/thomhurst/TUnit/pull/6862 +* @ForNeVeR made their first contribution in https://github.com/thomhurst/TUnit/pull/6844 + +### v1.69.16 + +* fix: preserve TRX results when session cleanup fails by @Sing303 in https://github.com/thomhurst/TUnit/pull/6879 +* @Sing303 made their first contribution in https://github.com/thomhurst/TUnit/pull/6879 + +### v1.69.21 + +* fix: preserve JUnit results after session cancellation by @Sing303 in https://github.com/thomhurst/TUnit/pull/6882 +* feat: warn when setup hooks pass the test execution token by @Sing303 in https://github.com/thomhurst/TUnit/pull/6883 +* fix: complete DedicatedThreadExecutor tests only after CleanUp() returns by @glennawatson in https://github.com/thomhurst/TUnit/pull/6886 +* @glennawatson made their first contribution in https://github.com/thomhurst/TUnit/pull/6886 + +### v1.69.24 + +* fix: skip Ctrl+C handling where Console.CancelKeyPress is unsupported by @glennawatson in https://github.com/thomhurst/TUnit/pull/6889 + +### v1.70.0 + +* feat: clear parallel constraints and limiter during test registration by @thomhurst in https://github.com/thomhurst/TUnit/pull/6897 +* fix(mocks): emit valid lambdas for Task/ValueTask-returning delegate mocks by @thomhurst in https://github.com/thomhurst/TUnit/pull/6896 + +### v1.70.1 + +* fix: don't run DedicatedThreadExecutor continuations inline on the dedicated thread by @thomhurst in https://github.com/thomhurst/TUnit/pull/6898 ## Public API -No public API change. +#### Core_Library + +```diff +(patch too large — open the compare link) +``` ## Library code (src/) -- `src/TUnit.Mocks.SourceGenerator/Builders/MockImplBuilder.cs` (+31 −14) -- `src/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs` (+5 −1) -- `src/TUnit.Mocks.SourceGenerator/Builders/MockWrapperTypeBuilder.cs` (+46 −10) -- `src/TUnit.Mocks.SourceGenerator/Discovery/GeneratedNameCollisionDetector.cs` (+1 −6) -- `src/TUnit.Mocks.SourceGenerator/Discovery/MemberDiscovery.cs` (+69 −5) -- `src/TUnit.Mocks.SourceGenerator/Discovery/MockTypeIdentity.cs` (+17 −0) -- `src/TUnit.Mocks.SourceGenerator/Discovery/SharedMemberSurfaceResolver.cs` (+57 −0) -- `src/TUnit.Mocks.SourceGenerator/MockGenerator.cs` (+21 −3) -- `src/TUnit.Mocks.SourceGenerator/Models/MockExplicitInterfaceSlot.cs` (+5 −1) -- `src/TUnit.Mocks.SourceGenerator/Models/MockMemberModel.cs` (+18 −0) -- `src/TUnit.Mocks.SourceGenerator/Models/MockTypeModel.cs` (+12 −0) -- `src/TUnit.Mocks/TUnit.Mocks.InternalsAccess.targets` (+25 −0) -- `src/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.ServiceDefaults/ExampleNamespace.ServiceDefaults.csproj` (+2 −2) +- `src/TUnit.Analyzers/AbstractTestClassWithDataSourcesAnalyzer.cs` (+3 −3) +- `src/TUnit.Analyzers/AnalyzerReleases.Unshipped.md` (+2 −1) +- `src/TUnit.Analyzers/AssemblyTestHooksAnalyzer.cs` (+8 −8) +- `src/TUnit.Analyzers/BeforeHookAsyncLocalAnalyzer.cs` (+5 −1) +- `src/TUnit.Analyzers/ClassDataSourceConstructorAnalyzer.cs` (+3 −5) +- `src/TUnit.Analyzers/ClassHooksAnalyzer.cs` (+8 −8) +- `src/TUnit.Analyzers/CombinedDataSourceAnalyzer.cs` (+2 −2) +- `src/TUnit.Analyzers/ConflictingExplicitAttributesAnalyzer.cs` (+4 −4) +- `src/TUnit.Analyzers/ConsoleOutAnalyzer.cs` (+1 −1) +- `src/TUnit.Analyzers/DiagnosticIds.cs` (+1 −0) +- `src/TUnit.Analyzers/Extensions/AttributeExtensions.cs` (+1 −2) +- `src/TUnit.Analyzers/Extensions/MethodExtensions.cs` (+1 −2) +- `src/TUnit.Analyzers/Extensions/ParameterExtensions.cs` (+4 −4) +- `src/TUnit.Analyzers/Extensions/PropertyExtensions.cs` (+1 −1) +- `src/TUnit.Analyzers/Extensions/SymbolExtensions.cs` (+3 −3) +- `src/TUnit.Analyzers/Extensions/TypeExtensions.GloballyQualified.cs` (+116 −0) +- `src/TUnit.Analyzers/Extensions/TypeExtensions.cs` (+3 −11) +- `src/TUnit.Analyzers/ForbidRedefiningAttributeUsageAnalyzer.cs` (+3 −1) +- `src/TUnit.Analyzers/InheritsTestsAnalyzer.cs` (+2 −2) +- `src/TUnit.Analyzers/InstanceTestHooksAnalyzer.cs` (+8 −8) +- `src/TUnit.Analyzers/MissingTestAttributeAnalyzer.cs` (+2 −1) +- `src/TUnit.Analyzers/PublicMethodMissingTestAttributeAnalyzer.cs` (+3 −1) +- `src/TUnit.Analyzers/Resources.resx` (+10 −1) +- `src/TUnit.Analyzers/Rules.cs` (+3 −0) +- `src/TUnit.Analyzers/SingleTUnitAttributeAnalyzer.cs` (+7 −1) +- `src/TUnit.Analyzers/TestDataAnalyzer.cs` (+3 −3) +- `src/TUnit.Analyzers/TimeoutCancellationTokenAnalyzer.cs` (+97 −4) +- `src/TUnit.Assertions.Analyzers/AwaitAssertionAnalyzer.cs` (+8 −0) +- `src/TUnit.Assertions.Analyzers/AwaitValueTaskAssertThatAnalyzer.cs` (+3 −5) +- `src/TUnit.Assertions.Analyzers/CompilerArgumentsPopulatedAnalyzer.cs` (+14 −18) +- `src/TUnit.Assertions.Analyzers/Extensions/TypeExtensions.cs` (+1 −7) +- `src/TUnit.Assertions.Analyzers/GenerateAssertionAnalyzer.cs` (+2 −1) +- `src/TUnit.Assertions.Analyzers/MixAndOrOperatorsAnalyzer.cs` (+3 −3) +- `src/TUnit.Assertions.Analyzers/ObjectBaseEqualsMethodAnalyzer.cs` (+2 −3) +- `src/TUnit.Assertions.Analyzers/TUnit.Assertions.Analyzers.csproj` (+4 −0) +- `src/TUnit.Assertions.Analyzers/XUnitAssertionAnalyzer.cs` (+19 −0) +- `src/TUnit.Core.SourceGenerator/CodeGenerationHelpers.cs` (+2 −189) +- `src/TUnit.Core.SourceGenerator/CodeGenerators/Writers/AttributeWriter.cs` (+24 −23) +- `src/TUnit.Core.SourceGenerator/Extensions/AttributeDataExtensions.cs` (+53 −0) +- `src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs` (+243 −60) +- `src/TUnit.Core.SourceGenerator/Models/TestMethodSourceCode.cs` (+3 −1) +- `src/TUnit.Core/AmbientContexts.cs` (+120 −0) +- `src/TUnit.Core/Contexts/TestRegisteredContext.cs` (+28 −0) +- `src/TUnit.Core/Data/ThreadSafeDictionary.cs` (+12 −0) +- `src/TUnit.Core/Discovery/ObjectGraphDiscoverer.cs` (+88 −1) +- `src/TUnit.Core/EngineCancellationToken.cs` (+41 −2) +- `src/TUnit.Core/Executors/DedicatedThreadExecutor.cs` (+122 −105) +- `src/TUnit.Core/Helpers/ClassConstructorHelper.cs` (+5 −6) +- `src/TUnit.Core/Helpers/LazyAttributeDictionary.cs` (+73 −0) +- `src/TUnit.Core/Models/AssemblyHookContext.cs` (+3 −7) +- `src/TUnit.Core/Models/ClassHookContext.cs` (+3 −7) +- `src/TUnit.Core/Models/TestBuildContext.cs` (+8 −0) +- `src/TUnit.Core/Models/TestDiscoveryContext.cs` (+2 −3) +- `src/TUnit.Core/Models/TestSessionContext.cs` (+3 −7) +- `src/TUnit.Core/TUnit.Core.targets` (+1 −1) +- `src/TUnit.Core/TestBuilderContext.cs` (+69 −4) +- `src/TUnit.Core/TestContext.Dependencies.cs` (+3 −2) +- `src/TUnit.Core/TestContext.Events.cs` (+12 −7) +- `src/TUnit.Core/TestContext.Output.cs` (+45 −10) +- `src/TUnit.Core/TestContext.Parallelization.cs` (+5 −0) +- `src/TUnit.Core/TestContext.cs` (+22 −10) +- `src/TUnit.Core/TestDetails.cs` (+4 −0) +- `src/TUnit.Core/TestEntryFactory.cs` (+72 −0) +- `src/TUnit.Core/TestMetadata`1.cs` (+6 −1) +- `src/TUnit.Core/Tracking/ObjectTracker.cs` (+22 −10) +- `src/TUnit.Engine/Building/Interfaces/ITestBuilder.cs` (+2 −2) +- `src/TUnit.Engine/Building/TestBuilder.cs` (+263 −116) +- `src/TUnit.Engine/Building/TestBuilderPipeline.cs` (+2 −2) +- `src/TUnit.Engine/Events/EventReceiverRegistry.cs` (+39 −9) +- `src/TUnit.Engine/Extensions/TestContextExtensions.cs` (+14 −5) +- `src/TUnit.Engine/Extensions/TestExtensions.cs` (+19 −16) +- `src/TUnit.Engine/Framework/TUnitTestFramework.cs` (+10 −2) +- `src/TUnit.Engine/Helpers/DataSourceMetadataExtractor.cs` (+12 −5) +- `src/TUnit.Engine/Reporters/Aggregation/AtomicFile.cs` (+18 −0) +- `src/TUnit.Engine/Reporters/Aggregation/ReportAggregator.cs` (+17 −0) +- `src/TUnit.Engine/Reporters/Aggregation/ReportDataJson.cs` (+21 −6) +- `src/TUnit.Engine/Reporters/Aggregation/SegmentedBufferWriter.cs` (+125 −0) +- `src/TUnit.Engine/Reporters/Html/ActivityCollector.cs` (+104 −49) +- `src/TUnit.Engine/Reporters/Html/HtmlReportGenerator.cs` (+36 −13) +- `src/TUnit.Engine/Reporters/Html/HtmlReporter.cs` (+76 −24) +- `src/TUnit.Engine/Reporters/JUnitReporter.cs` (+3 −2) +- `src/TUnit.Engine/Services/EventReceiverOrchestrator.cs` (+16 −0) +- `src/TUnit.Engine/Services/ObjectLifecycleService.cs` (+31 −7) +- `src/TUnit.Engine/Services/PropertyInjector.cs` (+18 −1) +- `src/TUnit.Engine/Services/TestArgumentRegistrationService.cs` (+36 −16) +- `src/TUnit.Engine/Services/TestDependencyResolver.cs` (+32 −2) +- `src/TUnit.Engine/Services/TestExecution/RetryHelper.cs` (+1 −1) +- `src/TUnit.Engine/Services/TestExecution/TestContextRestorer.cs` (+20 −0) +- `src/TUnit.Engine/Services/TestExecution/TestCoordinator.cs` (+27 −13) +- `src/TUnit.Engine/Services/TestFilterService.cs` (+12 −6) +- `src/TUnit.Engine/TestExecutor.cs` (+27 −8) +- `src/TUnit.Engine/Utilities/ParallelMap.cs` (+19 −1) +- `src/TUnit.Mocks.SourceGenerator/Builders/MockDelegateFactoryBuilder.cs` (+88 −32) +- `src/TUnit.Mocks.SourceGenerator/Builders/MockImplBuilder.cs` (+12 −7) +- `src/TUnit.Mocks.SourceGenerator/Extensions/TypeSymbolExtensions.cs` (+29 −24) +- `src/TUnit.Reporting.Tool/TUnit.Reporting.Tool.csproj` (+1 −0) +- `src/TUnit.Templates/README.md` (+16 −1) +- `src/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.ServiceDefaults/ExampleNamespace.ServiceDefaults.csproj` (+5 −5) +- `src/TUnit.Templates/content/TUnit.FSharp/.template.config/dotnetcli.host.json` (+9 −0) +- `src/TUnit.Templates/content/TUnit.FSharp/.template.config/ide.host.json` (+9 −0) +- `src/TUnit.Templates/content/TUnit.FSharp/.template.config/template.json` (+10 −1) +- `src/TUnit.Templates/content/TUnit.FSharp/TestProject.fsproj` (+3 −0) +- `src/TUnit.Templates/content/TUnit.VB/.template.config/dotnetcli.host.json` (+9 −0) +- `src/TUnit.Templates/content/TUnit.VB/.template.config/ide.host.json` (+9 −0) +- `src/TUnit.Templates/content/TUnit.VB/.template.config/template.json` (+10 −1) +- `src/TUnit.Templates/content/TUnit.VB/TestProject.vbproj` (+3 −0) +- `src/TUnit.Templates/content/TUnit/.template.config/dotnetcli.host.json` (+9 −0) +- `src/TUnit.Templates/content/TUnit/.template.config/ide.host.json` (+9 −0) +- `src/TUnit.Templates/content/TUnit/.template.config/template.json` (+7 −0) +- `src/TUnit.Templates/content/TUnit/TestProject.csproj` (+4 −1) ## Commits -13 commits; dependency bumps not listed. +55 commits; dependency bumps not listed. + +- chore: update benchmark results (#6845) +- chore: update mock benchmark results (#6846) +- docs: consolidate agent instructions in AGENTS.md +- chore: update mock benchmark results (#6849) +- chore: update mock benchmark results (#6852) +- feat(templates): add enableDotCover flag (#6714) (#6844) +- fix: don't request semantic models for attribute syntax from other compilations (DevKit crash) (#6855) +- fix(ci): restore net472 PublicAPI tests on Windows (#6857) +- perf(html-report): stream report JSON through pooled chunks and overlap sidecar serialization (#6860) +- chore(renovate): cap Microsoft.Build packages below 18.10.0 (#6863) +- perf: shrink generated per-class test source static constructors (~40% less startup JIT) (#6859) +- refactor: remove unreachable decimal source-text path from GenerateAttributeInstantiation (#6856) +- perf: cut per-test allocations in discovery and execution (-61% at 10k tests) (#6861) +- perf: stop hashing per-test event receivers during registration (data-driven tests 2.9x faster at 10k) (#6858) +- +semver:minor - perf(analyzers): cut TUnit analyzer build time ~60% on large test projects (#6862) +- chore: update mock benchmark results (#6865) +- chore: update mock benchmark results (#6875) +- chore: update mock benchmark results (#6880) +- fix: preserve TRX results when session cleanup fails (#6879) +- chore: update mock benchmark results (#6884) +- fix: preserve JUnit results after session cancellation (#6882) +- feat: warn when setup hooks pass the test execution token (#6883) +- fix: complete DedicatedThreadExecutor tests only after CleanUp() returns (#6886) +- fix: skip Ctrl+C handling where Console.CancelKeyPress is unsupported (#6889) +- chore: update benchmark results (#6894) +- chore: update mock benchmark results (#6895) +- feat: let registration receivers clear parallel constraints and limiter (#6897) +- +semver:minor - fix(mocks): emit valid lambdas for Task/ValueTask-returning delegate mocks (#6896) +- fix: don't run DedicatedThreadExecutor continuations inline on the dedicated thread (#6898) -- chore: update mock benchmark results (#6826) -- chore: update mock benchmark results (#6830) -- fix(mocks): emit init accessors for init-only properties and indexers (#6833) -- fix(mocks): let one type be mocked regularly and wrapped in one compilation (#6835) -- fix(mocks): keep editors in sync with publicized project references (#6836) (#6837) +> Truncated by the GitHub compare API; the compare link above has the full list. diff --git a/docs/benchmarks.md b/docs/benchmarks.md index b2ff343..67c368e 100644 --- a/docs/benchmarks.md +++ b/docs/benchmarks.md @@ -2,7 +2,7 @@ Last Updated -These benchmarks were automatically generated on **2026-09-20** from the latest CI run. +These benchmarks were automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -29,7 +29,7 @@ These benchmarks compare TUnit against the most popular .NET testing frameworks: | Framework | Version Tested | | ------------ | -------------- | -| **TUnit** | 1.68.17 | +| **TUnit** | 1.69.21 | | **xUnit v3** | 4.0.1 | | **NUnit** | 4.6.1 | | **MSTest** | 4.4.1 | @@ -72,4 +72,4 @@ These benchmarks run automatically daily via [GitHub Actions](https://github.com Each benchmark runs multiple iterations with statistical analysis to ensure accuracy. Results may vary based on hardware and test characteristics. -*Last generated: 2026-09-20T00:35:50.559Z* +*Last generated: 2026-09-27T00:42:59.274Z* diff --git a/docs/benchmarks/engine/AsyncTests.md b/docs/benchmarks/engine/AsyncTests.md index 697e179..67f2706 100644 --- a/docs/benchmarks/engine/AsyncTests.md +++ b/docs/benchmarks/engine/AsyncTests.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-20** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -12,12 +12,12 @@ This benchmark was automatically generated on **2026-09-20** from the latest CI | Framework | Version | Mean | Median | StdDev | | --------------- | ------- | -------- | -------- | -------- | -| **TUnit** | 1.68.17 | 462.4 ms | 446.4 ms | 60.95 ms | -| NUnit | 4.6.1 | 825.0 ms | 806.8 ms | 75.79 ms | -| MSTest | 4.4.1 | 813.7 ms | 803.3 ms | 56.30 ms | -| xUnit3 | 4.0.1 | 937.9 ms | 933.5 ms | 96.22 ms | -| **TUnit (AOT)** | 1.68.17 | 132.2 ms | 131.9 ms | 5.90 ms | -| xUnit3\_AOT | 4.0.1 | 132.4 ms | 132.3 ms | 5.27 ms | +| **TUnit** | 1.69.21 | 392.7 ms | 391.8 ms | 7.27 ms | +| NUnit | 4.6.1 | 733.0 ms | 730.9 ms | 14.43 ms | +| MSTest | 4.4.1 | 704.9 ms | 706.3 ms | 9.77 ms | +| xUnit3 | 4.0.1 | 749.6 ms | 749.3 ms | 7.23 ms | +| **TUnit (AOT)** | 1.69.21 | 117.1 ms | 117.0 ms | 0.57 ms | +| xUnit3\_AOT | 4.0.1 | 120.0 ms | 119.8 ms | 1.01 ms | ## 📈 Visual Comparison @@ -33,4 +33,4 @@ Methodology View the [benchmarks overview](/docs/benchmarks/.md) for methodology details and environment information. -*Last generated: 2026-09-20T00:35:50.557Z* +*Last generated: 2026-09-27T00:42:59.273Z* diff --git a/docs/benchmarks/engine/BuildTime.md b/docs/benchmarks/engine/BuildTime.md index 7bca839..8ce5ff7 100644 --- a/docs/benchmarks/engine/BuildTime.md +++ b/docs/benchmarks/engine/BuildTime.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-20** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -14,10 +14,10 @@ Compilation time comparison across frameworks: | Framework | Version | Mean | Median | StdDev | | ------------- | ------- | ---------- | ---------- | -------- | -| **TUnit** | 1.68.17 | 1,062.5 ms | 1,050.6 ms | 70.63 ms | -| Build\_NUnit | 4.6.1 | 937.0 ms | 933.4 ms | 18.54 ms | -| Build\_MSTest | 4.4.1 | 1,097.7 ms | 1,088.1 ms | 67.60 ms | -| Build\_xUnit3 | 4.0.1 | 1,039.9 ms | 1,021.9 ms | 89.10 ms | +| **TUnit** | 1.69.21 | 985.8 ms | 973.0 ms | 42.92 ms | +| Build\_NUnit | 4.6.1 | 939.5 ms | 936.3 ms | 16.43 ms | +| Build\_MSTest | 4.4.1 | 1,127.6 ms | 1,140.8 ms | 91.05 ms | +| Build\_xUnit3 | 4.0.1 | 916.4 ms | 918.8 ms | 10.22 ms | ## 📈 Visual Comparison @@ -29,4 +29,4 @@ Methodology View the [benchmarks overview](/docs/benchmarks/.md) for methodology details and environment information. -*Last generated: 2026-09-20T00:35:50.559Z* +*Last generated: 2026-09-27T00:42:59.274Z* diff --git a/docs/benchmarks/engine/DataDrivenTests.md b/docs/benchmarks/engine/DataDrivenTests.md index 99cf99e..ac6651e 100644 --- a/docs/benchmarks/engine/DataDrivenTests.md +++ b/docs/benchmarks/engine/DataDrivenTests.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-20** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -12,12 +12,12 @@ This benchmark was automatically generated on **2026-09-20** from the latest CI | Framework | Version | Mean | Median | StdDev | | --------------- | ------- | --------- | --------- | --------- | -| **TUnit** | 1.68.17 | 369.64 ms | 355.16 ms | 50.290 ms | -| NUnit | 4.6.1 | 685.81 ms | 673.60 ms | 70.252 ms | -| MSTest | 4.4.1 | 721.79 ms | 716.63 ms | 95.349 ms | -| xUnit3 | 4.0.1 | 836.96 ms | 833.24 ms | 93.829 ms | -| **TUnit (AOT)** | 1.68.17 | 19.68 ms | 18.82 ms | 2.575 ms | -| xUnit3\_AOT | 4.0.1 | 19.58 ms | 19.46 ms | 0.430 ms | +| **TUnit** | 1.69.21 | 289.25 ms | 287.40 ms | 31.093 ms | +| NUnit | 4.6.1 | 515.18 ms | 497.71 ms | 62.971 ms | +| MSTest | 4.4.1 | 429.04 ms | 422.49 ms | 15.933 ms | +| xUnit3 | 4.0.1 | 523.52 ms | 521.92 ms | 11.117 ms | +| **TUnit (AOT)** | 1.69.21 | 11.94 ms | 11.94 ms | 0.481 ms | +| xUnit3\_AOT | 4.0.1 | 13.09 ms | 12.99 ms | 0.386 ms | ## 📈 Visual Comparison @@ -33,4 +33,4 @@ Methodology View the [benchmarks overview](/docs/benchmarks/.md) for methodology details and environment information. -*Last generated: 2026-09-20T00:35:50.557Z* +*Last generated: 2026-09-27T00:42:59.273Z* diff --git a/docs/benchmarks/engine/MassiveParallelTests.md b/docs/benchmarks/engine/MassiveParallelTests.md index a5a7086..a25dce5 100644 --- a/docs/benchmarks/engine/MassiveParallelTests.md +++ b/docs/benchmarks/engine/MassiveParallelTests.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-20** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -12,12 +12,12 @@ This benchmark was automatically generated on **2026-09-20** from the latest CI | Framework | Version | Mean | Median | StdDev | | --------------- | ------- | ---------- | ---------- | -------- | -| **TUnit** | 1.68.17 | 517.1 ms | 514.7 ms | 14.64 ms | -| NUnit | 4.6.1 | 1,218.2 ms | 1,216.5 ms | 14.19 ms | -| MSTest | 4.4.1 | 3,025.7 ms | 3,027.3 ms | 18.78 ms | -| xUnit3 | 4.0.1 | 1,344.2 ms | 1,340.6 ms | 26.17 ms | -| **TUnit (AOT)** | 1.68.17 | 220.9 ms | 220.3 ms | 1.61 ms | -| xUnit3\_AOT | 4.0.1 | 676.6 ms | 675.6 ms | 3.89 ms | +| **TUnit** | 1.69.21 | 476.5 ms | 476.9 ms | 2.99 ms | +| NUnit | 4.6.1 | 1,200.2 ms | 1,197.0 ms | 7.74 ms | +| MSTest | 4.4.1 | 3,001.3 ms | 2,999.0 ms | 16.32 ms | +| xUnit3 | 4.0.1 | 1,307.0 ms | 1,310.1 ms | 10.08 ms | +| **TUnit (AOT)** | 1.69.21 | 218.6 ms | 218.6 ms | 0.55 ms | +| xUnit3\_AOT | 4.0.1 | 675.0 ms | 674.8 ms | 1.69 ms | ## 📈 Visual Comparison @@ -33,4 +33,4 @@ Methodology View the [benchmarks overview](/docs/benchmarks/.md) for methodology details and environment information. -*Last generated: 2026-09-20T00:35:50.557Z* +*Last generated: 2026-09-27T00:42:59.273Z* diff --git a/docs/benchmarks/engine/MatrixTests.md b/docs/benchmarks/engine/MatrixTests.md index 87b1f36..41baf19 100644 --- a/docs/benchmarks/engine/MatrixTests.md +++ b/docs/benchmarks/engine/MatrixTests.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-20** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -12,12 +12,12 @@ This benchmark was automatically generated on **2026-09-20** from the latest CI | Framework | Version | Mean | Median | StdDev | | --------------- | ------- | ---------- | ---------- | -------- | -| **TUnit** | 1.68.17 | 398.1 ms | 396.6 ms | 11.23 ms | -| NUnit | 4.6.1 | 1,710.4 ms | 1,710.9 ms | 81.77 ms | -| MSTest | 4.4.1 | 1,606.0 ms | 1,583.4 ms | 69.78 ms | -| xUnit3 | 4.0.1 | 909.7 ms | 893.4 ms | 34.23 ms | -| **TUnit (AOT)** | 1.68.17 | 118.9 ms | 118.7 ms | 0.63 ms | -| xUnit3\_AOT | 4.0.1 | 277.1 ms | 278.2 ms | 4.53 ms | +| **TUnit** | 1.69.21 | 420.9 ms | 417.0 ms | 12.92 ms | +| NUnit | 4.6.1 | 1,603.6 ms | 1,595.4 ms | 22.14 ms | +| MSTest | 4.4.1 | 1,585.8 ms | 1,576.9 ms | 16.02 ms | +| xUnit3 | 4.0.1 | 931.1 ms | 932.7 ms | 22.66 ms | +| **TUnit (AOT)** | 1.69.21 | 118.8 ms | 118.8 ms | 1.28 ms | +| xUnit3\_AOT | 4.0.1 | 275.4 ms | 275.0 ms | 2.90 ms | ## 📈 Visual Comparison @@ -33,4 +33,4 @@ Methodology View the [benchmarks overview](/docs/benchmarks/.md) for methodology details and environment information. -*Last generated: 2026-09-20T00:35:50.558Z* +*Last generated: 2026-09-27T00:42:59.274Z* diff --git a/docs/benchmarks/engine/ScaleTests.md b/docs/benchmarks/engine/ScaleTests.md index 23d71b2..f3fa7a1 100644 --- a/docs/benchmarks/engine/ScaleTests.md +++ b/docs/benchmarks/engine/ScaleTests.md @@ -4,20 +4,20 @@ Last Updated -This benchmark was automatically generated on **2026-09-20** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 ## 📊 Results -| Framework | Version | Mean | Median | StdDev | -| --------------- | ------- | --------- | --------- | --------- | -| **TUnit** | 1.68.17 | 317.80 ms | 316.58 ms | 5.447 ms | -| NUnit | 4.6.1 | 588.01 ms | 584.35 ms | 16.332 ms | -| MSTest | 4.4.1 | 536.90 ms | 537.86 ms | 7.500 ms | -| xUnit3 | 4.0.1 | 648.73 ms | 645.63 ms | 10.657 ms | -| **TUnit (AOT)** | 1.68.17 | 20.73 ms | 20.53 ms | 2.060 ms | -| xUnit3\_AOT | 4.0.1 | 26.37 ms | 26.33 ms | 2.742 ms | +| Framework | Version | Mean | Median | StdDev | +| --------------- | ------- | --------- | --------- | ---------- | +| **TUnit** | 1.69.21 | 480.55 ms | 479.51 ms | 59.015 ms | +| NUnit | 4.6.1 | 736.26 ms | 742.84 ms | 77.199 ms | +| MSTest | 4.4.1 | 645.30 ms | 633.48 ms | 64.840 ms | +| xUnit3 | 4.0.1 | 949.20 ms | 942.15 ms | 149.225 ms | +| **TUnit (AOT)** | 1.69.21 | 33.10 ms | 33.93 ms | 4.168 ms | +| xUnit3\_AOT | 4.0.1 | 37.08 ms | 37.04 ms | 3.580 ms | ## 📈 Visual Comparison @@ -33,4 +33,4 @@ Methodology View the [benchmarks overview](/docs/benchmarks/.md) for methodology details and environment information. -*Last generated: 2026-09-20T00:35:50.558Z* +*Last generated: 2026-09-27T00:42:59.274Z* diff --git a/docs/benchmarks/engine/SetupTeardownTests.md b/docs/benchmarks/engine/SetupTeardownTests.md index e499806..0a230eb 100644 --- a/docs/benchmarks/engine/SetupTeardownTests.md +++ b/docs/benchmarks/engine/SetupTeardownTests.md @@ -4,20 +4,20 @@ Last Updated -This benchmark was automatically generated on **2026-09-20** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 ## 📊 Results -| Framework | Version | Mean | Median | StdDev | -| --------------- | ------- | ----------- | ----------- | --------- | -| **TUnit** | 1.68.17 | 446.02 ms | 439.30 ms | 48.695 ms | -| NUnit | 4.6.1 | 1,260.98 ms | 1,244.96 ms | 67.114 ms | -| MSTest | 4.4.1 | 1,256.00 ms | 1,256.06 ms | 95.100 ms | -| xUnit3 | 4.0.1 | 1,024.87 ms | 1,028.69 ms | 82.360 ms | -| **TUnit (AOT)** | 1.68.17 | 76.32 ms | 76.24 ms | 2.663 ms | -| xUnit3\_AOT | 4.0.1 | 187.51 ms | 186.82 ms | 3.003 ms | +| Framework | Version | Mean | Median | StdDev | +| --------------- | ------- | ----------- | ----------- | ---------- | +| **TUnit** | 1.69.21 | 484.28 ms | 485.09 ms | 38.536 ms | +| NUnit | 4.6.1 | 1,298.87 ms | 1,281.90 ms | 52.894 ms | +| MSTest | 4.4.1 | 1,294.22 ms | 1,292.73 ms | 56.599 ms | +| xUnit3 | 4.0.1 | 956.63 ms | 968.28 ms | 101.354 ms | +| **TUnit (AOT)** | 1.69.21 | 68.84 ms | 68.86 ms | 0.600 ms | +| xUnit3\_AOT | 4.0.1 | 177.81 ms | 177.72 ms | 0.871 ms | ## 📈 Visual Comparison @@ -33,4 +33,4 @@ Methodology View the [benchmarks overview](/docs/benchmarks/.md) for methodology details and environment information. -*Last generated: 2026-09-20T00:35:50.558Z* +*Last generated: 2026-09-27T00:42:59.274Z* diff --git a/docs/benchmarks/mocks.md b/docs/benchmarks/mocks.md index 27e9532..837abaa 100644 --- a/docs/benchmarks/mocks.md +++ b/docs/benchmarks/mocks.md @@ -2,7 +2,7 @@ Last Updated -These benchmarks were automatically generated on **2026-09-21** from the latest CI run. +These benchmarks were automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -71,4 +71,4 @@ These benchmarks run automatically daily via [GitHub Actions](https://github.com Each benchmark runs multiple iterations with statistical analysis to ensure accuracy. Results may vary based on hardware and test characteristics. -*Last generated: 2026-09-21T02:37:24.392Z* +*Last generated: 2026-09-27T02:37:02.890Z* diff --git a/docs/benchmarks/mocks/Callback.md b/docs/benchmarks/mocks/Callback.md index d45edaa..1d35f3f 100644 --- a/docs/benchmarks/mocks/Callback.md +++ b/docs/benchmarks/mocks/Callback.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-21** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -12,14 +12,14 @@ This benchmark was automatically generated on **2026-09-21** from the latest CI Callback registration and execution: -| Library | Mean | Error | StdDev | Allocated | -| --------------- | ----------- | --------- | --------- | --------- | -| **TUnit.Mocks** | 423.2 ns | 8.43 ns | 14.08 ns | 3.11 KB | -| Imposter | 273.2 ns | 5.03 ns | 9.19 ns | 2.66 KB | -| Mockolate | 220.6 ns | 4.41 ns | 4.53 ns | 1.8 KB | -| Moq | 56,781.9 ns | 769.60 ns | 682.23 ns | 13.29 KB | -| NSubstitute | 2,482.9 ns | 35.35 ns | 29.52 ns | 7.85 KB | -| FakeItEasy | 2,727.0 ns | 25.78 ns | 22.85 ns | 7.44 KB | +| Library | Mean | Error | StdDev | Allocated | +| --------------- | ------------ | --------- | --------- | --------- | +| **TUnit.Mocks** | 558.0 ns | 10.89 ns | 18.78 ns | 3.11 KB | +| Imposter | 403.4 ns | 7.95 ns | 9.47 ns | 2.66 KB | +| Mockolate | 272.3 ns | 4.22 ns | 3.95 ns | 1.8 KB | +| Moq | 107,933.1 ns | 955.06 ns | 797.51 ns | 13.29 KB | +| NSubstitute | 3,654.8 ns | 61.25 ns | 51.15 ns | 7.85 KB | +| FakeItEasy | 3,881.4 ns | 76.66 ns | 142.09 ns | 7.44 KB | @@ -27,14 +27,14 @@ Callback registration and execution: ### with args -| Library | Mean | Error | StdDev | Allocated | -| --------------- | ----------- | --------- | --------- | --------- | -| **TUnit.Mocks** | 498.9 ns | 6.54 ns | 5.47 ns | 3.2 KB | -| Imposter | 309.4 ns | 4.40 ns | 3.67 ns | 2.82 KB | -| Mockolate | 253.9 ns | 2.91 ns | 2.58 ns | 1.84 KB | -| Moq | 58,866.9 ns | 674.01 ns | 597.49 ns | 13.75 KB | -| NSubstitute | 2,741.8 ns | 44.45 ns | 41.58 ns | 8.41 KB | -| FakeItEasy | 3,266.3 ns | 49.16 ns | 41.05 ns | 9.4 KB | +| Library | Mean | Error | StdDev | Allocated | +| --------------- | ------------ | --------- | --------- | --------- | +| **TUnit.Mocks** | 640.0 ns | 12.57 ns | 12.91 ns | 3.2 KB | +| Imposter | 424.5 ns | 7.03 ns | 6.57 ns | 2.82 KB | +| Mockolate | 306.0 ns | 3.50 ns | 3.11 ns | 1.84 KB | +| Moq | 111,063.9 ns | 863.81 ns | 765.75 ns | 13.72 KB | +| NSubstitute | 4,236.5 ns | 79.06 ns | 73.96 ns | 8.41 KB | +| FakeItEasy | 4,933.9 ns | 60.25 ns | 53.41 ns | 9.4 KB | @@ -48,4 +48,4 @@ Methodology View the [mock benchmarks overview](/docs/benchmarks/mocks/.md) for methodology details and environment information. -*Last generated: 2026-09-21T02:37:24.392Z* +*Last generated: 2026-09-27T02:37:02.890Z* diff --git a/docs/benchmarks/mocks/CombinedWorkflow.md b/docs/benchmarks/mocks/CombinedWorkflow.md index 4a900fe..2ba73b3 100644 --- a/docs/benchmarks/mocks/CombinedWorkflow.md +++ b/docs/benchmarks/mocks/CombinedWorkflow.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-21** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -14,12 +14,12 @@ Full workflow: create → setup → invoke → verify: | Library | Mean | Error | StdDev | Allocated | | --------------- | ---------- | --------- | --------- | --------- | -| **TUnit.Mocks** | 1.878 μs | 0.0122 μs | 0.0102 μs | 6.23 KB | -| Imposter | 2.719 μs | 0.0225 μs | 0.0199 μs | 15.71 KB | -| Mockolate | 1.664 μs | 0.0090 μs | 0.0070 μs | 7.36 KB | -| Moq | 407.883 μs | 2.2183 μs | 2.0750 μs | 36.35 KB | -| NSubstitute | 18.794 μs | 0.0531 μs | 0.0471 μs | 26.72 KB | -| FakeItEasy | 18.191 μs | 0.3525 μs | 0.3462 μs | 25.52 KB | +| **TUnit.Mocks** | 2.063 μs | 0.0130 μs | 0.0122 μs | 6.23 KB | +| Imposter | 3.163 μs | 0.0509 μs | 0.0476 μs | 15.71 KB | +| Mockolate | 1.871 μs | 0.0229 μs | 0.0191 μs | 7.36 KB | +| Moq | 409.770 μs | 1.3919 μs | 1.2339 μs | 36.3 KB | +| NSubstitute | 19.723 μs | 0.1285 μs | 0.1073 μs | 26.72 KB | +| FakeItEasy | 19.149 μs | 0.0606 μs | 0.0567 μs | 25.52 KB | @@ -33,4 +33,4 @@ Methodology View the [mock benchmarks overview](/docs/benchmarks/mocks/.md) for methodology details and environment information. -*Last generated: 2026-09-21T02:37:24.392Z* +*Last generated: 2026-09-27T02:37:02.890Z* diff --git a/docs/benchmarks/mocks/Invocation.md b/docs/benchmarks/mocks/Invocation.md index d930a42..7c56879 100644 --- a/docs/benchmarks/mocks/Invocation.md +++ b/docs/benchmarks/mocks/Invocation.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-21** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -12,14 +12,14 @@ This benchmark was automatically generated on **2026-09-21** from the latest CI Calling methods on mock objects: -| Library | Mean | Error | StdDev | Allocated | -| --------------- | ---------- | ----------- | -------- | --------- | -| **TUnit.Mocks** | 277.8 ns | 69.12 ns | 3.79 ns | 128 B | -| Imposter | 303.1 ns | 47.55 ns | 2.61 ns | 168 B | -| Mockolate | 121.4 ns | 49.29 ns | 2.70 ns | 84 B | -| Moq | 855.3 ns | 298.05 ns | 16.34 ns | 376 B | -| NSubstitute | 761.6 ns | 116.64 ns | 6.39 ns | 304 B | -| FakeItEasy | 1,867.9 ns | 1,111.54 ns | 60.93 ns | 944 B | +| Library | Mean | Error | StdDev | Allocated | +| --------------- | ----------- | ----------- | --------- | --------- | +| **TUnit.Mocks** | 277.74 ns | 75.28 ns | 4.126 ns | 128 B | +| Imposter | 290.32 ns | 70.39 ns | 3.858 ns | 168 B | +| Mockolate | 104.55 ns | 16.36 ns | 0.897 ns | 84 B | +| Moq | 791.63 ns | 81.81 ns | 4.485 ns | 376 B | +| NSubstitute | 722.70 ns | 458.58 ns | 25.136 ns | 304 B | +| FakeItEasy | 1,737.95 ns | 1,034.16 ns | 56.686 ns | 944 B | @@ -27,14 +27,14 @@ Calling methods on mock objects: ### String -| Library | Mean | Error | StdDev | Allocated | -| --------------- | ---------- | --------- | -------- | --------- | -| **TUnit.Mocks** | 167.0 ns | 67.63 ns | 3.71 ns | 96 B | -| Imposter | 309.0 ns | 86.68 ns | 4.75 ns | 168 B | -| Mockolate | 105.0 ns | 77.58 ns | 4.25 ns | 60 B | -| Moq | 560.2 ns | 208.11 ns | 11.41 ns | 296 B | -| NSubstitute | 663.9 ns | 448.60 ns | 24.59 ns | 272 B | -| FakeItEasy | 1,706.2 ns | 332.62 ns | 18.23 ns | 776 B | +| Library | Mean | Error | StdDev | Allocated | +| --------------- | ----------- | ----------- | --------- | --------- | +| **TUnit.Mocks** | 171.11 ns | 160.94 ns | 8.822 ns | 96 B | +| Imposter | 298.89 ns | 83.26 ns | 4.564 ns | 168 B | +| Mockolate | 94.42 ns | 34.59 ns | 1.896 ns | 60 B | +| Moq | 562.45 ns | 222.27 ns | 12.183 ns | 296 B | +| NSubstitute | 667.74 ns | 34.01 ns | 1.864 ns | 328 B | +| FakeItEasy | 1,617.52 ns | 1,042.49 ns | 57.143 ns | 776 B | @@ -42,14 +42,14 @@ Calling methods on mock objects: ### 100 calls -| Library | Mean | Error | StdDev | Allocated | -| --------------- | ------------ | ------------- | ----------- | --------- | -| **TUnit.Mocks** | 28,103.4 ns | 10,908.88 ns | 597.95 ns | 12736 B | -| Imposter | 29,723.7 ns | 3,025.68 ns | 165.85 ns | 16800 B | -| Mockolate | 11,942.5 ns | 6,545.47 ns | 358.78 ns | 8400 B | -| Moq | 85,275.2 ns | 31,997.98 ns | 1,753.92 ns | 37600 B | -| NSubstitute | 74,783.4 ns | 10,780.57 ns | 590.92 ns | 30848 B | -| FakeItEasy | 191,219.3 ns | 112,040.45 ns | 6,141.32 ns | 94400 B | +| Library | Mean | Error | StdDev | Allocated | +| --------------- | ------------- | ------------ | ------------ | --------- | +| **TUnit.Mocks** | 27,171.32 ns | 7,492.01 ns | 410.662 ns | 12736 B | +| Imposter | 29,764.99 ns | 16,487.62 ns | 903.742 ns | 16800 B | +| Mockolate | 10,722.31 ns | 22,218.98 ns | 1,217.897 ns | 8400 B | +| Moq | 80,465.61 ns | 22,902.61 ns | 1,255.369 ns | 37600 B | +| NSubstitute | 71,093.26 ns | 33,879.58 ns | 1,857.054 ns | 30848 B | +| FakeItEasy | 182,113.88 ns | 65,007.53 ns | 3,563.282 ns | 94400 B | @@ -63,4 +63,4 @@ Methodology View the [mock benchmarks overview](/docs/benchmarks/mocks/.md) for methodology details and environment information. -*Last generated: 2026-09-21T02:37:24.392Z* +*Last generated: 2026-09-27T02:37:02.890Z* diff --git a/docs/benchmarks/mocks/MockCreation.md b/docs/benchmarks/mocks/MockCreation.md index b45b058..0c5fa0c 100644 --- a/docs/benchmarks/mocks/MockCreation.md +++ b/docs/benchmarks/mocks/MockCreation.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-21** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -14,12 +14,12 @@ Mock instance creation performance: | Library | Mean | Error | StdDev | Allocated | | --------------- | ----------- | --------- | --------- | --------- | -| **TUnit.Mocks** | 31.76 ns | 0.427 ns | 0.379 ns | 200 B | -| Imposter | 100.96 ns | 0.431 ns | 0.382 ns | 440 B | -| Mockolate | 23.21 ns | 0.348 ns | 0.325 ns | 160 B | -| Moq | 1,446.86 ns | 20.264 ns | 18.955 ns | 2048 B | -| NSubstitute | 2,033.47 ns | 22.279 ns | 20.840 ns | 5000 B | -| FakeItEasy | 1,872.78 ns | 22.003 ns | 20.581 ns | 2714 B | +| **TUnit.Mocks** | 26.29 ns | 0.292 ns | 0.273 ns | 200 B | +| Imposter | 86.33 ns | 0.606 ns | 0.567 ns | 440 B | +| Mockolate | 16.62 ns | 0.239 ns | 0.212 ns | 160 B | +| Moq | 1,346.99 ns | 16.351 ns | 15.294 ns | 2048 B | +| NSubstitute | 1,878.51 ns | 10.994 ns | 10.284 ns | 5000 B | +| FakeItEasy | 1,739.06 ns | 14.547 ns | 13.607 ns | 2715 B | @@ -29,12 +29,12 @@ Mock instance creation performance: | Library | Mean | Error | StdDev | Allocated | | --------------- | ----------- | --------- | --------- | --------- | -| **TUnit.Mocks** | 32.22 ns | 0.308 ns | 0.288 ns | 200 B | -| Imposter | 152.60 ns | 2.246 ns | 2.101 ns | 696 B | -| Mockolate | 19.23 ns | 0.336 ns | 0.298 ns | 176 B | -| Moq | 1,340.21 ns | 8.911 ns | 8.336 ns | 1912 B | -| NSubstitute | 2,011.38 ns | 16.544 ns | 15.476 ns | 5000 B | -| FakeItEasy | 1,838.05 ns | 36.530 ns | 42.068 ns | 2715 B | +| **TUnit.Mocks** | 26.49 ns | 0.252 ns | 0.235 ns | 200 B | +| Imposter | 134.63 ns | 1.052 ns | 0.933 ns | 696 B | +| Mockolate | 16.45 ns | 0.059 ns | 0.055 ns | 176 B | +| Moq | 1,323.73 ns | 7.731 ns | 6.853 ns | 1912 B | +| NSubstitute | 1,771.98 ns | 6.556 ns | 5.812 ns | 5000 B | +| FakeItEasy | 1,714.98 ns | 15.089 ns | 13.376 ns | 2715 B | @@ -48,4 +48,4 @@ Methodology View the [mock benchmarks overview](/docs/benchmarks/mocks/.md) for methodology details and environment information. -*Last generated: 2026-09-21T02:37:24.392Z* +*Last generated: 2026-09-27T02:37:02.890Z* diff --git a/docs/benchmarks/mocks/Setup.md b/docs/benchmarks/mocks/Setup.md index e35d457..9820629 100644 --- a/docs/benchmarks/mocks/Setup.md +++ b/docs/benchmarks/mocks/Setup.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-21** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -14,12 +14,12 @@ Mock behavior configuration (returns, matchers): | Library | Mean | Error | StdDev | Allocated | | --------------- | ------------ | ----------- | ----------- | --------- | -| **TUnit.Mocks** | 513.9 ns | 3.07 ns | 2.57 ns | 2.34 KB | -| Imposter | 826.0 ns | 8.78 ns | 8.22 ns | 6.12 KB | -| Mockolate | 305.0 ns | 3.34 ns | 3.13 ns | 1.41 KB | -| Moq | 431,926.9 ns | 2,913.99 ns | 2,725.75 ns | 28.63 KB | -| NSubstitute | 6,083.8 ns | 35.96 ns | 33.63 ns | 9.01 KB | -| FakeItEasy | 8,817.6 ns | 58.25 ns | 51.64 ns | 10.57 KB | +| **TUnit.Mocks** | 441.6 ns | 4.44 ns | 4.16 ns | 2.34 KB | +| Imposter | 625.7 ns | 11.65 ns | 11.45 ns | 6.12 KB | +| Mockolate | 254.0 ns | 2.48 ns | 2.20 ns | 1.41 KB | +| Moq | 239,940.3 ns | 1,208.53 ns | 1,009.17 ns | 28.56 KB | +| NSubstitute | 4,580.9 ns | 58.18 ns | 54.43 ns | 9.01 KB | +| FakeItEasy | 5,714.1 ns | 112.96 ns | 110.94 ns | 10.45 KB | @@ -27,14 +27,14 @@ Mock behavior configuration (returns, matchers): ### Multiple -| Library | Mean | Error | StdDev | Allocated | -| --------------- | ------------ | --------- | --------- | --------- | -| **TUnit.Mocks** | 781.9 ns | 4.15 ns | 3.88 ns | 3.15 KB | -| Imposter | 1,371.4 ns | 7.09 ns | 6.63 ns | 10.59 KB | -| Mockolate | 526.2 ns | 4.82 ns | 4.28 ns | 2.35 KB | -| Moq | 116,398.8 ns | 831.01 ns | 777.33 ns | 16.53 KB | -| NSubstitute | 12,664.7 ns | 249.74 ns | 256.46 ns | 20.5 KB | -| FakeItEasy | 8,239.5 ns | 102.88 ns | 85.91 ns | 11.82 KB | +| Library | Mean | Error | StdDev | Allocated | +| --------------- | ----------- | --------- | --------- | --------- | +| **TUnit.Mocks** | 626.8 ns | 4.57 ns | 3.81 ns | 3.15 KB | +| Imposter | 1,047.5 ns | 19.61 ns | 17.39 ns | 10.59 KB | +| Mockolate | 444.8 ns | 5.77 ns | 5.12 ns | 2.35 KB | +| Moq | 69,352.2 ns | 247.43 ns | 231.45 ns | 16.35 KB | +| NSubstitute | 8,940.9 ns | 153.79 ns | 128.42 ns | 20.31 KB | +| FakeItEasy | 5,413.7 ns | 105.86 ns | 144.91 ns | 11.71 KB | @@ -48,4 +48,4 @@ Methodology View the [mock benchmarks overview](/docs/benchmarks/mocks/.md) for methodology details and environment information. -*Last generated: 2026-09-21T02:37:24.392Z* +*Last generated: 2026-09-27T02:37:02.890Z* diff --git a/docs/benchmarks/mocks/Verification.md b/docs/benchmarks/mocks/Verification.md index 26d2663..c7909fe 100644 --- a/docs/benchmarks/mocks/Verification.md +++ b/docs/benchmarks/mocks/Verification.md @@ -4,7 +4,7 @@ Last Updated -This benchmark was automatically generated on **2026-09-21** from the latest CI run. +This benchmark was automatically generated on **2026-09-27** from the latest CI run. **Environment:** Ubuntu Latest • .NET SDK 10.0.401 @@ -14,12 +14,12 @@ Verifying mock method calls: | Library | Mean | Error | StdDev | Allocated | | --------------- | ------------- | ------------ | ------------ | --------- | -| **TUnit.Mocks** | 712.40 ns | 4.861 ns | 4.309 ns | 3008 B | -| Imposter | 842.11 ns | 10.410 ns | 9.737 ns | 4688 B | -| Mockolate | 453.26 ns | 4.011 ns | 3.349 ns | 2128 B | -| Moq | 346,685.21 ns | 1,434.223 ns | 1,119.747 ns | 24548 B | -| NSubstitute | 7,202.64 ns | 41.423 ns | 36.721 ns | 10064 B | -| FakeItEasy | 7,593.69 ns | 38.657 ns | 36.160 ns | 10722 B | +| **TUnit.Mocks** | 736.27 ns | 6.110 ns | 5.715 ns | 3008 B | +| Imposter | 676.74 ns | 3.401 ns | 3.181 ns | 4688 B | +| Mockolate | 398.05 ns | 1.672 ns | 1.483 ns | 2128 B | +| Moq | 237,988.85 ns | 1,730.571 ns | 1,534.106 ns | 24324 B | +| NSubstitute | 6,424.63 ns | 22.868 ns | 21.391 ns | 10064 B | +| FakeItEasy | 6,330.79 ns | 16.146 ns | 14.313 ns | 10722 B | @@ -29,12 +29,12 @@ Verifying mock method calls: | Library | Mean | Error | StdDev | Allocated | | --------------- | ------------ | ---------- | ---------- | --------- | -| **TUnit.Mocks** | 59.27 ns | 0.369 ns | 0.345 ns | 320 B | -| Imposter | 375.63 ns | 2.852 ns | 2.529 ns | 2400 B | -| Mockolate | 266.06 ns | 1.491 ns | 1.394 ns | 1144 B | -| Moq | 89,324.02 ns | 534.472 ns | 473.796 ns | 6918 B | -| NSubstitute | 4,056.30 ns | 34.456 ns | 32.230 ns | 7088 B | -| FakeItEasy | 3,938.06 ns | 27.526 ns | 24.401 ns | 5210 B | +| **TUnit.Mocks** | 53.83 ns | 0.150 ns | 0.140 ns | 320 B | +| Imposter | 318.25 ns | 0.569 ns | 0.504 ns | 2400 B | +| Mockolate | 234.47 ns | 0.589 ns | 0.522 ns | 1144 B | +| Moq | 62,316.71 ns | 366.024 ns | 285.767 ns | 6925 B | +| NSubstitute | 3,532.67 ns | 8.859 ns | 8.287 ns | 7088 B | +| FakeItEasy | 3,184.47 ns | 13.833 ns | 12.939 ns | 5210 B | @@ -44,12 +44,12 @@ Verifying mock method calls: | Library | Mean | Error | StdDev | Allocated | | --------------- | ------------- | ------------ | ------------ | --------- | -| **TUnit.Mocks** | 1,377.30 ns | 10.105 ns | 9.452 ns | 4472 B | -| Imposter | 2,019.22 ns | 25.754 ns | 24.090 ns | 11192 B | -| Mockolate | 1,267.96 ns | 13.265 ns | 12.408 ns | 5240 B | -| Moq | 473,399.64 ns | 3,315.600 ns | 3,101.414 ns | 34699 B | -| NSubstitute | 12,844.55 ns | 48.286 ns | 40.321 ns | 16763 B | -| FakeItEasy | 13,945.43 ns | 190.230 ns | 168.634 ns | 19233 B | +| **TUnit.Mocks** | 1,250.61 ns | 2.837 ns | 2.654 ns | 4472 B | +| Imposter | 1,650.72 ns | 5.101 ns | 4.522 ns | 11192 B | +| Mockolate | 1,046.23 ns | 4.805 ns | 4.494 ns | 5240 B | +| Moq | 347,352.06 ns | 2,834.234 ns | 2,512.475 ns | 34699 B | +| NSubstitute | 11,307.22 ns | 60.332 ns | 56.435 ns | 16762 B | +| FakeItEasy | 11,827.79 ns | 110.587 ns | 98.032 ns | 19456 B | @@ -63,4 +63,4 @@ Methodology View the [mock benchmarks overview](/docs/benchmarks/mocks/.md) for methodology details and environment information. -*Last generated: 2026-09-21T02:37:24.392Z* +*Last generated: 2026-09-27T02:37:02.890Z* diff --git a/docs/extending/code-coverage.md b/docs/extending/code-coverage.md index 53ede6d..9c24316 100644 --- a/docs/extending/code-coverage.md +++ b/docs/extending/code-coverage.md @@ -112,6 +112,26 @@ dotnet run --configuration Release --coverage --coverage-settings coverage.confi arguments: '--configuration Release --coverage --coverage-output $(Agent.TempDirectory)/coverage/' ``` +## JetBrains dotCover + +dotCover (in Rider, ReSharper and the dotCover command-line tools) supports per-test coverage for TUnit projects. This requires the `JetBrains.dotCover.Framework` package, a small Microsoft.Testing.Platform extension that is inert when dotCover is not attached. + +When creating a new project from the `TUnit` template in C#, F# or VB, pass `--enable-dotcover` (lowercase; the option is case-sensitive): + +``` +dotnet new TUnit -n MyTests --enable-dotcover + +dotnet new TUnit -n MyTests --language F# --enable-dotcover + +dotnet new TUnit -n MyTests --language VB --enable-dotcover +``` + +Or add the package to an existing project: + +``` +dotnet add package JetBrains.dotCover.Framework +``` + ## Troubleshooting **Coverage files not generated?** diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 9ed112c..fd16132 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -10,6 +10,8 @@ Assuming you have the .NET SDK installed, run: A new test project will be created for you with some samples of different test types and tips. When you're ready to get going, delete them and create your own! +Optional: add `--enable-dotcover` to include the `JetBrains.dotCover.Framework` package for per-test coverage in dotCover, Rider and ReSharper. + ## Manually First create an empty .NET console application: diff --git a/docs/reference/tunit0075.md b/docs/reference/tunit0075.md new file mode 100644 index 0000000..42b7b64 --- /dev/null +++ b/docs/reference/tunit0075.md @@ -0,0 +1,23 @@ +# TUnit0075: Use the hook cancellation token for setup + +**Severity:** Warning + +Setup hooks receive a `CancellationToken` that includes their own timeout. This applies both to an explicit `[Timeout]` and to `TUnitSettings.Default.Timeouts.DefaultHookTimeout`. The token exposed by `TestContext.Execution.CancellationToken` represents test cancellation; it does not include the setup hook's timeout. + +TUnit0075 reports a direct use of the injected test context's token as a cancellation argument to an operation that a `[Before(Test)]` or `[BeforeEvery(Test)]` hook awaits or returns. For example, `await InitializeAsync(context.Execution.CancellationToken)` and `return InitializeAsync(context.Execution.CancellationToken)` both trigger the warning. Expression-bodied hooks are checked too. + +## How to fix it + +Add a `CancellationToken` parameter at the end of the hook's parameter list if it does not already have one, then pass that parameter to the setup operation. For example, change `InitializeAsync(context.Execution.CancellationToken)` to `InitializeAsync(cancellationToken)` in a hook declared as `public Task Setup(TestContext context, CancellationToken cancellationToken)`. + +The operation must cooperate with cancellation. Passing the correct token lets it observe the hook timeout; it does not forcibly stop work that ignores cancellation. + +## Scope + +The rule checks the direct `context.Execution.CancellationToken` property chain, where `context` is the hook's `TestContext` parameter. It recognizes direct `await`, `await` with `ConfigureAwait`, and returns, including branches of conditional expressions such as `return useCache ? Task.CompletedTask : InitializeAsync(context.Execution.CancellationToken)`. + +Overrides of virtual setup hooks are checked even when the override does not repeat `[Before(Test)]`. The rule follows the override chain; a method that hides a base hook with `new` does not inherit that hook's role. + +It does not follow tokens through local variables or helper methods, inspect nested lambdas or local functions, or check tokens from other contexts. It does not apply to ordinary tests or methods used only for cleanup. Reading cancellation state, such as `context.Execution.CancellationToken.IsCancellationRequested`, is not reported. + +See [Hook Parameters](/docs/writing-tests/hooks.md#hook-parameters) for the supported hook signatures. diff --git a/docs/writing-tests/hooks.md b/docs/writing-tests/hooks.md index 2e4396c..7d8c039 100644 --- a/docs/writing-tests/hooks.md +++ b/docs/writing-tests/hooks.md @@ -84,6 +84,10 @@ public async Task Setup(TestContext context, CancellationToken cancellationToken * CancellationToken only: `public async Task Hook(CancellationToken ct) { }` * Both: `public async Task Hook(TestContext context, CancellationToken ct) { }` +In setup hooks, pass the injected `CancellationToken` to setup operations, including operations returned directly from a hook. It observes the hook's `[Timeout]` or `TUnitSettings.Default.Timeouts.DefaultHookTimeout` when no explicit timeout is set. `context.Execution.CancellationToken` represents test cancellation and does not include that hook timeout, so using it for setup can leave the operation running after the hook's token is cancelled. + +[TUnit0075](/docs/reference/tunit0075.md) warns about directly passing the test context's token to an operation awaited or returned by a `[Before(Test)]` or `[BeforeEvery(Test)]` hook, including conditional branches and overrides of virtual setup hooks. Reading test cancellation state, such as `context.Execution.CancellationToken.IsCancellationRequested`, is still valid. + **Context types by hook level:** | Hook Level | Context Type | diff --git a/llms.txt b/llms.txt index ef7c75e..5f79bac 100644 --- a/llms.txt +++ b/llms.txt @@ -98,6 +98,7 @@ - [Environment Variables](/docs/reference/environment-variables.md): TUnit supports configuration through environment variables, allowing you to set defaults without modifying command-line arguments. This is particularly useful for CI/CD pipelines and development environments. - [Programmatic Configuration](/docs/reference/programmatic-configuration.md): Overview - [Test Configuration](/docs/reference/test-configuration.md): TUnit supports having a testconfig.json file within your test project. +- [TUnit0075: Use the hook cancellation token for setup](/docs/reference/tunit0075.md): Severity: Warning - [Troubleshooting & FAQ](/docs/troubleshooting.md): FAQ - [AOT Compatibility and Generic Tests](/docs/writing-tests/aot.md): TUnit's source generation mode provides compile-time safety and performance benefits, but requires specific patterns for advanced scenarios like generic tests and complex data sources. - [Data Driven Tests](/docs/writing-tests/arguments.md): Inject compile-time known data via [Arguments(...)] attributes. The attribute takes an array of arguments that must match the test method's parameter count and types. Multiple [Arguments] attributes repeat the test once per attribute: