Precept.TestPlatform
Precept is a test framework for .NET 10, built on Microsoft.Testing.Platform
(MTP). This package is its test runner: it implements MTP's ITestFramework, so Precept controls
how tests are discovered, scheduled, retried and reported, while the platform runs them under
dotnet test, dotnet run, IDE test explorers and TRX reporting.
A test project starts here. This package brings in Precept.Core, makes the project an
executable and generates its entry point. There is no Main and no OutputType to write.
dotnet add package Precept.TestPlatform
[TestSuite("Checkout")]
public class CheckoutTests
{
[Test("A customer can check out")]
[Retry(2, DelayMilliseconds = 200)]
public async Task Checkout()
{
var response = await Rest.Post("/orders")
.WithJsonBody(new { sku = "ABC", quantity = 2 })
.SendAsync();
await Assert.That(response).ToHaveStatusAsync(HttpStatusCode.Created);
}
}
The first build writes a commented precept.json into the project. That file, its
precept.{environment}.json overlays and PRECEPT_* environment variables configure the run.
On the .NET 10 SDK, dotnet test has to be told to use Microsoft.Testing.Platform. Put this
global.json at the repository root. The SDK reads it from the directory you run dotnet test in
and upward, not from the project's directory:
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
Without it dotnet test fails with "Testing with VSTest target is no longer supported". Running
the test binary directly with dotnet run -- --list-tests works either way.
Part of Precept, a .NET 10 test framework built on Microsoft.Testing.Platform. Full documentation: installing · writing tests · running a suite · execution model · filtering · configuration