VSTestSettings Class

Summary

Contains settings used by VSTestRunner.
Namespace
Cake.Common.Tools.VSTest
Base Types
graph BT Type-->Base0["ToolSettings"] click Base0 "/api/Cake.Core.Tooling/ToolSettings" Base0-->Base1["object"] Type["VSTestSettings"] class Type type-node

Syntax

public sealed class VSTestSettings : ToolSettings

Properties

Name Value Summary
AllowPreviewVersion bool
Gets or sets a value indicating whether tools from a preview edition of Visual Studio should be used.

If set to true, VSTest from a Preview edition (e.g. Visual Studio 2022 Preview) will be considered to be used.

ArgumentCustomization Func<ProcessArgumentBuilder, ProcessArgumentBuilder>
Gets or sets the argument customization. Argument customization is a way that lets you add, replace or reuse arguments passed to a tool. This allows you to support new tool arguments, customize arguments or address potential argument issues.
Inherited from ToolSettings
Diag FilePath
Gets or sets a path which makes VSTest write diagnosis trace logs to specified file.
EnableCodeCoverage bool
Gets or sets a value indicating whether to enable data diagnostic adapter 'CodeCoverage' in the test run. Default settings are used if not specified using settings file.
EnvironmentVariables IDictionary<string, string>
Gets or sets search paths for files, directories for temporary files, application-specific options, and other similar information.
Inherited from ToolSettings
FrameworkVersion VSTestFrameworkVersion
Gets or sets the target .NET Framework version to be used for test execution.
HandleExitCode Func<int, bool>
Gets or sets whether the exit code from the tool process causes an exception to be thrown.

If the delegate is null (the default) or returns false, then an exception is thrown upon a non-zero exit code.

If the delegate returns true then no exception is thrown.

This can be useful when the exit code should be ignored, or if there is a desire to apply logic that is conditional on the exit code value.

Inherited from ToolSettings
InIsolation bool
Gets or sets a value indicating whether to run tests within the vstest.console.exe process. This makes vstest.console.exe process less likely to be stopped on an error in the tests, but tests might run slower. Defaults to false.
Logger string
Gets or sets the name of your logger. Possible values: - A blank string (or null): no logger - "trx": Visual Studio's built-in logger - "AppVeyor": AppVeyor's custom logger which is available only when building your solution on the AppVeyor platform - any custom value: the name of your custom logger.
NoWorkingDirectory bool
Gets or sets a value indicating whether or not to opt out of using an explicit working directory for the process.
Inherited from ToolSettings
Parallel bool
Gets or sets a value indicating whether the tests are executed in parallel. By default up to all available cores on the machine may be used. The number of cores to use may be configured using a settings file.
PlatformArchitecture VSTestPlatform
Gets or sets the target platform architecture to be used for test execution.
PostAction Action<IProcess>
Gets or sets a delegate which is executed after the process was started.
Inherited from ToolSettings
ResultsDirectory DirectoryPath
Gets or sets the result directory. Test results directory will be created in specified path if not exists. VSTest.Console.exe flag /ResultsDirectory.
SettingsFile FilePath
Gets or sets the settings filename to be used to control additional settings such as data collectors.
SetupProcessSettings Action<ProcessSettings>
Gets or sets a delegate to configure the process settings.
Inherited from ToolSettings
TestAdapterPath DirectoryPath
Gets or sets a value that makes VSTest use custom test adapters from a given path (if any) in the test run.
TestCaseFilter string
Gets or sets an expression to run only tests that match, of the format <property>Operator<value>[|&<Expression>] where Operator is one of =, != or ~ (Operator ~ has 'contains' semantics and is applicable for string properties like DisplayName). Parenthesis () can be used to group sub-expressions. Examples: Priority=1 (FullyQualifiedName~Nightly|Name=MyTestMethod).
ToolPath FilePath
Gets or sets the tool path.
Inherited from ToolSettings
ToolTimeout TimeSpan?
Gets or sets optional timeout for tool execution.
Inherited from ToolSettings
UseVsixExtensions bool?
Gets or sets a value overriding whether VSTest will use or skip the VSIX extensions installed (if any) in the test run.
WorkingDirectory DirectoryPath
Gets or sets the working directory for the tool process.
Inherited from ToolSettings

Extension Methods

Name Value Summary
Dump<VSTestSettings>() string
Get a basic string representation of specified object.
Requires the Cake.Incubator addin
IsIn<VSTestSettings>(VSTestSettings[]) bool
Checks if the source is contained in a list
Requires the Cake.Incubator addin
NotNull<VSTestSettings>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Ftp addin
NotNull<VSTestSettings>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Issues addin
ThrowIfNull<VSTestSettings>(string, string) T
Throws a System.ArgumentNullException with a specific message if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ThrowIfNull<VSTestSettings>(string) T
Throws a System.ArgumentNullException if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ToDictionary() IDictionary<string, object>
Requires the Cake.DeployParams addin
ToStringWithNullMarkup() string
Returns the string value or a Not set> markup suitable for Spectre.Console.
Requires the Cake.Issues addin
WithAppVeyorLogger() VSTestSettings
Log to the AppVeyor logger (which is only available when building your solution on the AppVeyor platform).
WithArgumentCustomization<VSTestSettings>(Func<ProcessArgumentBuilder, ProcessArgumentBuilder>) T
Sets the tool argument customization delegate.
WithEnvironmentVariable<VSTestSettings>(string, string) T
Sets or adds tool environment variable.
WithExpectedExitCode<VSTestSettings>(int) T
Sets expected exit code using WithHandleExitCode<T>(T, Func<int, bool>).
WithHandleExitCode<VSTestSettings>(Func<int, bool>) T
Sets delegate whether the exit code from the tool process causes an exception to be thrown.
WithLogger(string) VSTestSettings
Log to a custom logger.
WithNoWorkingDirectory<VSTestSettings>(bool) T
Sets whether the tool should use a working directory or not.
WithoutAnyLogger() VSTestSettings
Do not Log.
WithPostAction<VSTestSettings>(Action<IProcess>) T
Sets a delegate which is executed after the tool process was started.
WithSetupProcessSettings<VSTestSettings>(Action<ProcessSettings>) T
Sets a delegate to configure the process settings.
WithToolPath<VSTestSettings>(FilePath) T
Sets the tool path.
WithToolSettings<VSTestSettings>(Action<VSTestSettings>) T
Provides fluent null guarded tool settings action.
WithToolTimeout<VSTestSettings>(TimeSpan) T
Sets the tool timeout.
WithVisualStudioLogger() VSTestSettings
Log to a trx file.
WithWorkingDirectory<VSTestSettings>(DirectoryPath) T
Sets the tool working directory.