Configuration Files (XML)

DEPRECATION WARNING:
Configuration via App.config file is officially deprecated and will not be supported in v3. The documentation page exists for historical purposes. You should convert to JSON-based configuration at your earliest convenience.

Below is a list of supported keys and values (the version column is the version of xunit.runner.utility where the configuration element support was added). The configuration items should be added to the <appSettings> section of your App.config file.

Key Supported Values
xunit.appDomain
[Runners v2 2.1+]

Set this value to determine whether app domains are used. By default, they will be used when available (the ifAvailable value). If you set this to required, it will require that app domains are available; if you set this to denied, it will not use app domains. Note that only desktop runners (and desktop unit tests) can use app domains, so this value will be ignored when used with non-desktop runners or with unit tests that are not targeting the desktop CLR.

Default value: ifAvailable
Supported by: xUnit.net v1 and v2

xunit.diagnosticMessages
[Runners v2 2.0+]

Set this value to true to include diagnostic information during test discovery and execution. Each runner has a unique method of presenting diagnostic messages.

Default value: false
[Runners v2 2.0+]
Supported by: xUnit.net v2

xunit.longRunningTestSeconds
[Runners v2 2.2+]

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 0 to disable the feature, or a positive integer value to enable the feature (time in seconds).

NOTE: Long running test messages are diagnostic messages. You must enable diagnostic messages in order to see the long running test warnings.

Default value: 0 (disabled)
Supported by: xUnit.net v1 and v2

xunit.maxParallelThreads
[Runners v2 2.0+]

Set this to override the maximum number of threads to be used when parallelizing tests within this assembly. Use a value of 0 to indicate that you would like the default behavior; use a value of -1 to indicate that you do not wish to limit the number of threads used for parallelization.

Default value: the number of logical processors in your PC
Supported by: xUnit.net v2

xunit.methodDisplay
[Runners v2 2.0+]

Set this to override the default display name for test cases. If you set this to method, the display name will be just the method (without the class name); if this set this value to classAndMethod, the default display name will be the fully qualified class name and method name.

Default value: classAndMethod
Supported by: xUnit.net v2

xunit.methodDisplayOptions
[Runners v2 2.4+]

Set this to automatically perform transforms on default test names. This value can either be all, none, or a comma-separated combination of one or more of the following values:

  • replaceUnderscoreWithSpace Replaces all underscores with spaces
  • useOperatorMonikers Replaces operator names with matching symbols
    • eq becomes =
    • ne becomes !=
    • lt becomes <
    • le becomes <=
    • gt becomes >
    • ge becomes >=
  • useEscapeSequences Replaces escape sequences in the format Xnn or Unnnn with their ASCII or Unicode character equivalents. Examples:
    • X2C becomes ,
    • U1D0C becomes
  • replacePeriodWithComma Replaced periods with a comma and a space. This option is typically only useful if methodDisplay is classAndMethod.

Default value: none
Supported by: xUnit.net v2 2.4 beta 1 or later

xunit.parallelizeAssembly
[Runners v2 2.0+]

Set this to true if this assembly is willing to participate in parallelization with other assemblies. Test runners can use this information to automatically enable parallelization across assemblies if all the assemblies agree to it.

Default value: false
Supported by: xUnit.net v1 and v2

xunit.parallelizeTestCollections
[Runners v2 2.0+]

Set this to true if the assembly is willing to run tests inside this assembly in parallel against each other. Tests in the same test collection will be run sequentially against each other, but tests in different test collections will be run in parallel against each other. Set this to false to disable all parallelization within this test assembly.

Default value: true
Supported by: xUnit.net v2

xunit.preEnumerateTheories
[Runners v2 2.0+]

Set this to true to pre-enumerate theories so that there is an individual test case for each theory data row. Set this to false to return a single test case for each theory without pre-enumerating the data ahead of time (this is how xUnit.net v1 used to behave). This is most useful for developers running tests inside Visual Studio, who wish to have the Code Lens test runner icons on their theory methods, since Code Lens does not support multiple tests from a single method.

Default value: true
Supported by: xUnit.net v2

xunit.shadowCopy
[Runners v2 2.1+]

Set this to true to use shadow copying when running tests in separate app domains; set to false to run tests without shadow copying. When running tests without app domains, this value is ignored.

Default value: true
Supported by: xUnit.net v1 and v2

Copyright © .NET Foundation. Contributions welcomed at https://github.com/xunit/xunit/tree/gh-pages.