Project templates
Precept ships dotnet new templates, so a new suite starts with environment switching,
precept.json overlays and a first test already in place.
Install them from NuGet:
dotnet new install Precept.Templates
Run the same command again after a new release. It installs the newer version over the older one.
Create a project:
# Plain C# tests + Precept.Web
dotnet new precept-web -n Checkout.Web.Tests
# Reqnroll feature tests + Precept.Web
dotnet new precept-web-reqnroll -n Checkout.Web.Reqnroll.Tests
Each template includes:
global.jsonset toMicrosoft.Testing.Platform, whichdotnet teston .NET 10 needs. It is in the right place for a project that is a repository of its own. Inside a larger repository, move itstestsection into the rootglobal.json: the SDK reads the file from the directory you rundotnet testin, not from the project's, and a nested one also replaces the root's SDK pin for that subtree.precept.jsonwithEnvironment: localand web defaults: headless Chromium at a 1080p viewport.precept.staging.json, an overlay forstaging, used with--precept-environment staging.- A starter test, either plain C# or a
.featurefile with its steps.
The templates leave build configurations alone: Debug and Release as the SDK defines them, and
nothing bound to PreceptEnvironment. How an environment is chosen is up to you. See
Environments, including
a configuration per environment.
Precept.Web uses Playwright. The first time a launch finds no browser to drive, it installs the
one it is configured for; see Browsers. To install it up front instead:
pwsh bin/Debug/net10.0/playwright.ps1 install chromium