Precept.TestPlatform
Precept's test runner: a Microsoft.Testing.Platform
test framework that discovers and executes Precept tests. A test project starts here — this
package brings in Precept.Core, makes the project an executable and generates its entry point.
dotnet add package Precept.TestPlatform
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);
}
}
There is no Main and no OutputType to write. The first build leaves a commented precept.json
in the project.
One thing a NuGet package cannot do for you: on the .NET 10 SDK, dotnet test has to be told to use
Microsoft.Testing.Platform, in a global.json at the repository root — the SDK reads it from the
directory dotnet test is run in and upward, not from the project's.
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
Without it dotnet test fails with "Testing with VSTest target is no longer supported". Running the
test binary directly — dotnet run -- --list-tests — works either way.
Part of Precept, a .NET 10 test automation framework. Full documentation: running a suite · execution model · filtering · configuration · environment variables