xunit.runner.visualstudio
.RunSettings
filedotnet test
command line switches
Beginning with version 2.5.1 of xunit.runner.visualstudio
, you can provide xUnit.net configuration
settings via RunSettings. This includes a .RunSettings
file to be used by Test Explorer,
dotnet test
, and vstest.console.exe
, as well as by command line switches directly
when calling dotnet test
.
RunSettings are expressed as XML, and XML element names are case-sensitive. Please carefully verify that you are using
the correct casing for the XML element names. This also applies to the command line switches for dotnet test
,
as they are transparently translated into XML elements behind the scenes.
.RunSettings
file
The .RunSettings
file is simply an XML file with a specific format. You will place your values inside an xUnit
section in the configuration file. For example, to disable app domains and parallelization:
For more information on using .RunSettings
files, please see the
Visual Studio documentation.
dotnet test
command line switches
When passing RunSettings via the dotnet test
command line, you will format them as xUnit.key=value
pairs.
For example, to disable app domains and parallelization:
dotnet test path/to/myproject -- xUnit.AppDomain=denied xUnit.ParallelizeTestCollections=false
For more information on using command line switches for RunSettings with dotnet test
, please see the
dotnet test documentation.
Key | Supported Values |
---|---|
AppDomain xunit.runner.visualstudio 2.5.1+ Test Framework v1-v2 |
Set this value to determine whether App Domains are used. By default, they
will be used when available (the
Valid values: |
DiagnosticMessages xunit.runner.visualstudio 2.5.1+ Test Framework v2+ |
Set this value to
Valid values: |
FailSkips xunit.runner.visualstudio 2.5.1+ Test Framework v1+ |
Set this to
Valid values: |
InternalDiagnosticMessages xunit.runner.visualstudio 2.5.1+ Test Framework v2+ |
Set this value to
Valid values: |
LongRunningTestSeconds xunit.runner.visualstudio 2.5.1+ |
Set this value to enable long-running (hung) test detection. When the runner is
idle waiting for tests to finished, it will report that fact once the timeout
has passed. Use a value of NOTE: Long running test messages are diagnostic messages. You must enable diagnostic messages in order to see the long running test warnings.
Valid values: Any integer >= 0 |
MaxParallelThreads xunit.runner.visualstudio 2.5.1+ Test Framework v2+ |
Set this to override the maximum number of threads to be used when parallelizing
tests within this assembly. Use a value of
As of v2 Test Framework 2.8.0+ and
Valid values: Any integer >= -1, a multiplier, |
MethodDisplay xunit.runner.visualstudio 2.5.1+ Test Framework v2+ |
Set this to override the default display name for test cases. If you set this
to
Valid values: |
MethodDisplayOptions xunit.runner.visualstudio 2.5.1+ Test Framework v2+ |
Set this to automatically perform transforms on default test names. This value
can either be
Valid values: |
NoAutoReporters xunit.runner.visualstudio 2.5.1+ Test Framework v1+ |
Set this to
Valid values: |
ParallelAlgorithm xunit.runner.visualstudio 2.8.0+ Test Framework v2 2.8.0+ |
Set this to change the way tests are scheduled when they're running in parallel. For more
information, see Running Tests in Parallel.
Note that the algorithm only applies when you have enabled
test collection parallelism, and are using a limited number of
threads (i.e., not
Valid values: |
ParallelizeAssembly xunit.runner.visualstudio 2.5.1+ Test Framework v2+ |
Set this to
Valid values: |
ParallelizeTestCollections xunit.runner.visualstudio 2.5.1+ Test Framework v2+ |
Set this to
Valid values: |
PreEnumerateTheories xunit.runner.visualstudio 2.5.1+ Test Framework v2+ |
Set this to
This value does not have a default, because it's up to each individual test runner
to decide what the best default behavior is. The Visual Studio adapter, for example,
will default to
Valid values: |
ReporterSwitch xunit.runner.visualstudio 2.5.1+ Test Framework v1+ |
Set this value to use a different reporter than the default. There are four reporters
that ship with
Note: In order to see the reporter output, you will need to change the verbosity level of
the console reporter. In Visual Studio, you can do this by opening the Options settings,
navigating to
Valid values: |
ShadowCopy xunit.runner.visualstudio 2.5.1+ Test Framework v1-v2 |
Set this to
Valid values: |
ShowLiveOutput xunit.runner.visualstudio 2.8.1+ Test Framework v2 |
Set this to
Valid values: |
StopOnFail xunit.runner.visualstudio 2.5.1+ Test Framework v2+ |
Set this to
Valid values: |