.okf/testing.md
| Piece | Detail |
|---|---|
| Framework | xunit.v3 (MTP v2, no VSTest adapter), Shouldly, FakeItEasy |
| Test TFM | net10.0 (Tests/Directory.Build.props) |
| Unit | Tests/UnitTests/FastEndpoints, …/FastEndpoints.Testing, …/FastEndpoints.AspVersioning (+ legacy Swagger unit commented in slnx) |
| Integration | Tests/IntegrationTests/FastEndpoints (main), OpenApi, OpenApi.Kiota, OData, Agents |
| AOT | Tests/NativeAotTests/NativeAotCheckerTests + NativeAot.slnx |
| Helpers package | Src/Testing → FastEndpoints.Testing (AppFixture, fixtures, Bogus) |
| Main SUT | TestHarness/Web (Web.Program) |
| Other SUTs | OData, OpenApi.Kiota, Sandbox, NativeAotChecker |
Integration projects reference harness + FastEndpoints.Testing + often remote messaging testing helpers.
Root global.json sets "test": { "runner": "Microsoft.Testing.Platform" } so dotnet test uses MTP on the .NET 10 SDK (required after xunit.v3 4.0).
# Full solution tests (matches GitHub publish workflow)
dotnet test FastEndpoints.slnx -c Release --verbosity minimal --filter "ExcludeInCiCd!=Yes"
# By tree (Azure pipeline workingDirectory Tests)
dotnet test Tests/**/*.csproj -c Release --filter "ExcludeInCiCd!=Yes"
# Targeted
dotnet test Tests/UnitTests/FastEndpoints/Unit.FastEndpoints.csproj
dotnet test Tests/IntegrationTests/FastEndpoints/Int.FastEndpoints.csproj --filter FullyQualifiedName~BindingTests
AOT tests: use NativeAot.slnx (publish workflow currently has AOT test step commented out; re-check before assuming CI runs AOT).
[Priority]: TestBase / TestBaseWithAssemblyFixture apply [TestClass(DisableParallelization = true)], [TestCaseOrderer], and [TestMethodOrderer]. xunit.v3 4 default parallel mode is Collections (same class already serial). The TestClass flag is ignored in that mode and only applies if a project enables ParallelMode.All. Method + case orderers restore [Priority] across [Fact] methods and theory rows. No consumer attribute needed.AppFixture caches one factory per fixture type; override OnCachedWafDisposedAsync() for one-shot teardown of the shared factory (cached mode + [assembly: EnableAdvancedTesting]).AppFixture<Web.Program>, override ConfigureServices / SetupAsync for clients and test doubles (RegisterTestCommandHandler, event receivers, etc.).Sut.SetupAsync.[Trait("ExcludeInCiCd", "Yes")] skips in CI (job-queue timing, some binding cases).Int.OpenApi.Kiota sets IsTestingPlatformApplication=false and IsTestProject=false when CI (GitHub) or TF_BUILD (Azure) is true (heavy Kiota gen; MTP keys off the former). Local dotnet test FastEndpoints.slnx still runs it.FastEndpoints, FastEndpoints.OpenApi, and FastEndpoints.Agents disable test-collection parallelization (process-wide FastEndpoints state). Azure and GitHub publish pipelines also rewrite the FastEndpoints runner config.Tests/UnitTests, Tests/IntegrationTests/FastEndpoints/RPCTests, and Tests/NativeAotTests folders. Do not stand up a second in-process event hub with default storage types (see gotchas.md).Tests/IntegrationTests/FastEndpoints.OpenApi/release-*.http and release-*.json (plus release-versioning-*).OpenApiExportMode; public IsExportMode / IsNotExportMode (+ per-format wrappers) on IHost / IHostApplicationBuilder..http goldens: set _updateSnapshots = true in HttpSnapshotTests.cs, rundotnet test Tests/IntegrationTests/FastEndpoints.OpenApi/Int.OpenApi.csproj --filter FullyQualifiedName~HttpSnapshotTests,_updateSnapshots = false, re-run the same filter. JSON goldens use the same flag in SnapshotTests.cs.TestHarness/Web (or domain harness) when pipeline/HTTP involved.Unit.FastEndpoints references Generator + Web).InternalsVisibleTo (public key in props).Tests/Directory.Build.propsSrc/Testing/AppFixture.Waf.csTests/IntegrationTests/FastEndpoints/Sut.csTests/IntegrationTests/FastEndpoints/Int.FastEndpoints.csproj.github/workflows/publish-to-nuget.yml