LinuxCommandLibrary

dotnet-test

test runner for .NET projects

TLDR

Run tests

$ dotnet test
copy
Run tests in specific project
$ dotnet test [tests/Tests.csproj]
copy
Run with filter
$ dotnet test --filter "[FullyQualifiedName~UnitTests]"
copy
Run specific test
$ dotnet test --filter "Name=[TestMethodName]"
copy
Run with verbosity
$ dotnet test --verbosity [detailed]
copy
Run without build
$ dotnet test --no-build
copy
Generate coverage report
$ dotnet test --collect:"XPlat Code Coverage"
copy

SYNOPSIS

dotnet test [project] [options]

DESCRIPTION

dotnet test executes unit tests in .NET projects using the configured test framework adapter. It supports popular testing frameworks including MSTest, NUnit, and xUnit through their respective NuGet packages.
The command discovers test methods through framework-specific attributes, executes them, and reports results including pass/fail status, execution time, and detailed failure information. It integrates with code coverage tools and CI/CD pipelines through various loggers and output formats.

PARAMETERS

--filter expression

Filter tests by expression.
--no-build
Don't build before testing.
--no-restore
Don't restore before testing.
-v, --verbosity level
Verbosity (quiet, minimal, normal, detailed).
--logger logger
Test logger.
--collect data
Enable data collector.
--blame
Run tests in blame mode.
-r, --results-directory dir
Results directory.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community