Executing tests
September 6, 2026 ยท View on GitHub
Executing tests from Visual Studio
Execute tests from Test Explorer in an IDE version with Microsoft Testing Platform support. Follow the docs on creating test projects so the tests can show up. See xUnit's IDE setup instructions if tests aren't discovered.
Executing tests from the command line
In a CI environment you'd execute tests with the dotnet command line tool. These are the steps we recommend for CI builds:
Use .NET SDK 10 or later and select Microsoft Testing Platform in the solution's global.json, preserving any existing SDK settings:
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
- Build the solution with
dotnet buildin Release mode. We recommend using our .NET Analyzers for static code analysis and applying the code analysis switches on this step and during thedotnet publishones later. - Publish the web app's project with
dotnet publishin Release mode, optionally also with ReadyToRun. Note that since the web app shouldn't really reference your UI test projects this doesn't publish those. Remove or don't publish the refs folder. That way, Razor Runtime Compilation will be switched off, which removes an unnecessary and slow step when executing UI tests. - Publish the UI test project(s) with
dotnet publishin Release mode. - Run the UI tests with
dotnet test --project path/to/Tests.csproj --configuration Release --no-build. To run a solution, use--solution path/to/Solution.slnx. Note that by default, the app will run in the Development environment, which is what we need for testing. - Optionally, if you want to reuse the build agent, kill the following processes that might remain after UI testing (the KillLeftoverProcesses.bat script can do this):
- chromedriver.exe
- dotnet.exe
- geckodriver.exe
- msedgedriver.exe
Also see what to configure, especially for multi-agent build machines and tuning parallelization.
Use --report-trx to write TRX results and --report-gh for GitHub Actions annotations and job summaries. These switches require the corresponding reporting packages, which the Lombiq test SDK includes. The test-dotnet action in Lombiq GitHub Actions enables both. xUnit supports existing --filter expressions, and xunit.runner.json continues to configure parallelism.