| File: Commands\Test\CliConstants.cs | Web Access |
| Project: src\sdk\src\Cli\dotnet\dotnet.csproj (dotnet) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.DotNet.Cli.Commands.Test; internal static class CliConstants { public const string ServerOptionKey = "--server"; public const string HelpOptionKey = "--help"; public const string DotNetTestPipeOptionKey = "--dotnet-test-pipe"; public const string ServerOptionValue = "dotnettestcli"; public const string ArtifactPostProcessingToolName = "internal-merge-artifacts"; public const string ArtifactPostProcessingManifestOptionKey = "--manifest"; public const string SemiColon = ";"; public static readonly string[] SolutionExtensions = [".sln", ".slnx", ".slnf"]; public const string ProjectExtensionPattern = "*.*proj"; public const string SolutionExtensionPattern = "*.sln"; public const string SolutionXExtensionPattern = "*.slnx"; public const string SolutionFilterExtensionPattern = "*.slnf"; public const string BinLogFileName = "msbuild.binlog"; public const string DLLExtension = ".dll"; public const string TestTraceLoggingEnvVar = "DOTNET_CLI_TEST_TRACEFILE"; /// <summary> /// Overrides how long a relaunched artifact post-processing host may run, in seconds. /// '0' removes the bound entirely. Absent, non-numeric or negative values keep the default. /// </summary> public const string TestArtifactPostProcessingTimeoutEnvVar = "DOTNET_CLI_TEST_ARTIFACT_POST_PROCESSING_TIMEOUT_SECONDS"; } internal static class TestStates { internal const byte Discovered = 0; internal const byte Passed = 1; internal const byte Skipped = 2; internal const byte Failed = 3; internal const byte Error = 4; internal const byte Timeout = 5; internal const byte Cancelled = 6; } internal static class SessionEventTypes { internal const byte TestSessionStart = 0; internal const byte TestSessionEnd = 1; } internal static class DisplayMessageLevels { // These values flow over IPC as a single byte and must stay stable. internal const byte Information = 0; internal const byte Warning = 1; internal const byte Error = 2; } internal static class HandshakeMessagePropertyNames { internal const byte PID = 0; internal const byte Architecture = 1; internal const byte Framework = 2; internal const byte OS = 3; internal const byte SupportedProtocolVersions = 4; internal const byte HostType = 5; internal const byte ModulePath = 6; internal const byte ExecutionId = 7; internal const byte InstanceId = 8; internal const byte IsIDE = 9; // Reports which command-line execution mode the test host is running in, // so the SDK can detect mismatches such as a help/list-tests option leaking // from RunArguments or launchSettings.json into what the SDK thinks is a // normal run. Values come from HandshakeMessageExecutionModes. // Optional property — older Microsoft.Testing.Platform versions don't send // it, in which case the SDK falls back to its previous (no-validation) behavior. internal const byte ExecutionMode = 10; // Reply-only capability that tells Microsoft.Testing.Platform where to open // the reverse channel used for server-initiated session cancellation. internal const byte ServerControlPipeName = 12; // Optional 1-based retry attempt number. Multiple test host instances, such as shards, // can belong to the same attempt. Older hosts omit it, so the SDK retains instance-based // retry inference as a compatibility fallback. internal const byte AttemptNumber = 13; // Semicolon-separated reverse-DNS artifact kinds and lowercase file extensions // supported by post-processors registered in the test application. internal const byte SupportedPostProcessorKinds = 14; internal const byte SupportedPostProcessorExtensionsLegacy = 15; } internal static class HandshakeMessageExecutionModes { // Standard test run. internal const string Run = "run"; // The test host is going to print command-line help (e.g. --help, -?). internal const string Help = "help"; // The test host is going to discover tests (e.g. --list-tests). internal const string Discover = "discover"; // The host is running a non-test tool. internal const string Tool = "tool"; } internal static class HandshakeMessageHostTypes { internal const string TestHost = "TestHost"; internal const string ArtifactPostProcessor = "ArtifactPostProcessor"; } internal static class ProtocolConstants { /// <summary> /// The protocol versions that are supported by the current SDK. Multiple versions can be present and be semicolon separated. /// </summary> // 1.2.0 adds AzureDevOpsLogMessage (serializer id 11) forwarding; 1.3.0 adds DisplayMessage (serializer id 12) forwarding. // NOTE: 1.4.0 (the reverse server-control pipe / server-initiated cancellation) is intentionally NOT advertised yet: // it is a separate, larger feature that is out of scope here. internal const string SupportedVersions = "1.0.0;1.1.0;1.2.0;1.3.0"; } internal static class ServerControlKinds { internal const byte CancelSession = 1; } internal static class ProjectProperties { internal const string IsTestingPlatformApplication = "IsTestingPlatformApplication"; internal const string IsTestProject = "IsTestProject"; internal const string TargetFramework = "TargetFramework"; internal const string TargetFrameworks = "TargetFrameworks"; internal const string Configuration = "Configuration"; internal const string Platform = "Platform"; internal const string TargetPath = "TargetPath"; internal const string ProjectFullPath = "MSBuildProjectFullPath"; internal const string RunCommand = "RunCommand"; internal const string RunArguments = "RunArguments"; internal const string RunWorkingDirectory = "RunWorkingDirectory"; internal const string AppDesignerFolder = "AppDesignerFolder"; internal const string TestTfmsInParallel = "TestTfmsInParallel"; internal const string BuildInParallel = "BuildInParallel"; internal const string IsTraversal = "IsTraversal"; internal const string ProjectReferenceItemName = "ProjectReference"; }