Class DotNetTest
- Namespace
- DotNetDo
- Assembly
- DotNetDo.Core.dll
Builds selected test projects and runs their tests with the repository's test runner mode.
public sealed record DotNetTest : DotNetTargetCommand, IEquatable<ExecOptions>, IEquatable<ToolCommand>, IEquatable<ToolCommand<ExecResult>>, IEquatable<ExecToolCommand>, IEquatable<DotNetTargetCommand>, IEquatable<DotNetTest>Inheritance
Implements
Remarks
The repository selects VSTest or Microsoft.Testing.Platform for dotnet test through global.json or
DOTNET_TEST_RUNNER. The command detects that mode from its working directory, renders shared options for it, and
fails before execution when VSTest or TestingPlatform options don't match it.
Test report files, such as TRX or JUnit XML, aren't published to the CI server by this command. In Azure Pipelines,
add a PublishTestResults@2 step after the task, with condition: succeededOrFailed() so that results
from failing runs are published too. Set testResultsFormat to VSTest for TRX files or JUnit for
JUnit XML. With Microsoft.Testing.Platform,
DotNetTestingPlatformConfig.PublishAzureDevOpsTestResults can publish results directly instead.
Constructors
DotNetTest()
Creates a command with defaults for the current build locality.
public DotNetTest()Properties
Architecture
Shorthand target architecture combined with the default runtime identifier.
public string? Architecture { get; init; }Property Value
ArtifactsPath
Places outputs for all projects beneath this artifacts root, separated by project.
public string? ArtifactsPath { get; init; }Property Value
CommandParts
Gets every canonically ordered rendered command fragment.
protected override IReadOnlyList<string?> CommandParts { get; }Property Value
Configuration
Selects the named build configuration.
public string? Configuration { get; init; }Property Value
Framework
Selects one target framework declared by the project.
public string? Framework { get; init; }Property Value
ListTests
Discovers and lists tests without executing them.
public bool ListTests { get; init; }Property Value
NoBuild
Skips building before the operation; required outputs must already exist.
public bool NoBuild { get; init; }Property Value
NoLogo
Suppresses the startup banner and copyright message.
public bool NoLogo { get; init; }Property Value
NoRestore
Skips implicit restore; assets must already be current.
public bool NoRestore { get; init; }Property Value
OperatingSystem
Shorthand target operating system combined with the default runtime identifier.
public string? OperatingSystem { get; init; }Property Value
ResultsDirectory
Places test results and generated artifacts in this directory.
public string? ResultsDirectory { get; init; }Property Value
Runtime
Targets the specified runtime identifier, such as win-x64.
public string? Runtime { get; init; }Property Value
TestEnvironment
Sets test-host environment variables as NAME=VALUE.
public IReadOnlyList<string> TestEnvironment { get; init; }Property Value
TestingPlatform
Options that apply only when the repository runs dotnet test with Microsoft.Testing.Platform.
public DotNetTestingPlatformConfig? TestingPlatform { get; init; }Property Value
VSTest
Options that apply only when the repository runs dotnet test with VSTest.
public DotNetVSTestConfig? VSTest { get; init; }