Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc updates for MSTest #43786

Merged
merged 9 commits into from
Dec 3, 2024
Merged
2 changes: 1 addition & 1 deletion docs/core/testing/mstest-analyzers/mstest0021.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ms.author: amauryleve
| **Enabled by default** | No |
| **Default severity** | Info |
| **Introduced in version** | 3.4.0 |
| **Is there a code fix** | No |
| **Is there a code fix** | Yes, starting with 3.7.0 |

## Cause

Expand Down
6 changes: 6 additions & 0 deletions docs/core/testing/unit-testing-platform-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The platform will automatically detect and load the *[appname].testconfig.json*

When using [Microsoft.Testing.Platform.MSBuild](https://www.nuget.org/packages/Microsoft.Testing.Platform.MSBuild), you can simply create a *testconfig.json* file that will be automatically renamed to *[appname].testconfig.json* and moved to the output directory of the test project.

Starting with Microsoft.Testing.Platform 1.5, you can use the command-line argument `--config-file` to specify the path to the *testconfig.json*. This file takes precedence over the *[appname].testconfig.json* file.

> [!NOTE]
> The *[appname].testconfig.json* file will get overwritten on subsequent builds.

Expand All @@ -38,3 +40,7 @@ Environment variables can be used to supply some runtime configuration informati

> [!NOTE]
> Environment variables take precedence over configuration settings in the *testconfig.json* file.

### `TESTINGPLATFORM_UI_LANGUAGE` environment variable
Evangelink marked this conversation as resolved.
Show resolved Hide resolved

Starting with Microsoft.Testing.Platform 1.5, this environment variable sets the language of the platform for displaying messages and logs using a locale value such as `en-us`. This language takes precedence over the Visual Studio and .NET SDK languages. The supported values are the same as for Visual Studio. For more information, see the section on changing the installer language in the [Visual Studio installation documentation](/visualstudio/install/install-visual-studio).
2 changes: 2 additions & 0 deletions docs/core/testing/unit-testing-platform-extensions-fakes.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ To use the new extension with an existing project, update the existing `Microsof
- </Reference>
+ <PackageReference Include="Microsoft.Testing.Extensions.Fakes" Version="17.11.0-beta.24319.3" />
```

If you are using MSTest.Sdk 3.7 or later, use the `EnableMicrosoftTestingExtensionsFakes` property to enable the extension and don't add the package reference.
71 changes: 55 additions & 16 deletions docs/core/testing/unit-testing-platform-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,56 +183,95 @@ To run a test project in CI add one step for each test executable that you wish

The list below described only the platform options. To see the specific options brought by each extension, either refer to the extension documentation page or use the `--help` option.

- **`@`**

Specifies the name of the response file. The response file name must immediately follow the @ character with no white space between the @ character and the response file name.

Options in a response file are interpreted as if they were present at that place in the command line. Each argument in a response file must begin and end on the same line. You cannot use the backslash character (\) to concatenate lines. Using a response file helps for very long commands that might exceed the terminal limits. You can combine a response file with inline command-line arguments. For example:

```console
./TestExecutable.exe @"filter.rsp" --timeout 10s
```

where *filter.rsp* can have the following contents:

```rsp
--filter "A very long filter"
```

Or a single rsp file can be used to specify both timeout and filter as follows:

```console
./TestExecutable.exe @"arguments.rsp"
```

```rsp
--filter "A very long filter"
--timeout 10s
```

- **`--config-file`**

Specifies a [*testconfig.json*](unit-testing-platform-config.md) file.

- **`--diagnostic`**

Enables the diagnostic logging. The default log level is `Trace`. The file is written in the output directory with the following name format, `log_[MMddHHssfff].diag`.
Enables the diagnostic logging. The default log level is `Trace`. The file is written in the output directory with the following name format, `log_[MMddHHssfff].diag`.

- **`--diagnostic-filelogger-synchronouswrite`**

Forces the built-in file logger to synchronously write logs. Useful for scenarios where you don't want to lose any log entries (if the process crashes). This does slow down the test execution.
Forces the built-in file logger to synchronously write logs. Useful for scenarios where you don't want to lose any log entries (if the process crashes). This does slow down the test execution.

- **`--diagnostic-output-directory`**

The output directory of the diagnostic logging, if not specified the file is generated in the default _TestResults_ directory.
The output directory of the diagnostic logging, if not specified the file is generated in the default _TestResults_ directory.

- **`--diagnostic-output-fileprefix`**

The prefix for the log file name. Defaults to `"log_"`.
The prefix for the log file name. Defaults to `"log_"`.

- **`--diagnostic-verbosity`**

Defines the verbosity level when the `--diagnostic` switch is used. The available values are `Trace`, `Debug`, `Information`, `Warning`, `Error`, or `Critical`.
Defines the verbosity level when the `--diagnostic` switch is used. The available values are `Trace`, `Debug`, `Information`, `Warning`, `Error`, or `Critical`.

- **`--exit-on-process-exit`**
Evangelink marked this conversation as resolved.
Show resolved Hide resolved

Exit the test process if dependent process exits. PID must be provided.

- **`--help`**

Prints out a description of how to use the command.
Prints out a description of how to use the command.

- **`-ignore-exit-code`**

Allows some non-zero exit codes to be ignored, and instead returned as `0`. For more information, see [Ignore specific exit codes](./unit-testing-platform-exit-codes.md#ignore-specific-exit-codes).
Allows some non-zero exit codes to be ignored, and instead returned as `0`. For more information, see [Ignore specific exit codes](./unit-testing-platform-exit-codes.md#ignore-specific-exit-codes).

- **`--info`**

Displays advanced information about the .NET Test Application such as:
Displays advanced information about the .NET Test Application such as:

- The platform.
- The environment.
- Each registered command line provider, such as its, `name`, `version`, `description` and `options`.
- Each registered tool, such as its, `command`, `name`, `version`, `description`, and all command line providers.
- The platform.
- The environment.
- Each registered command line provider, such as its `name`, `version`, `description`, and `options`.
- Each registered tool, such as its `command`, `name`, `version`, `description`, and all command-line providers.

This feature is used to understand extensions that would be registering the same command line option or the changes in available options between multiple versions of an extension (or the platform).
This feature is used to understand extensions that would be registering the same command line option or the changes in available options between multiple versions of an extension (or the platform).

- **`--list-tests`**

List available tests. Tests will not be executed.
List available tests. Tests will not be executed.

- **`--minimum-expected-tests`**

Specifies the minimum number of tests that are expected to run. By default, at least one test is expected to run.
Specifies the minimum number of tests that are expected to run. By default, at least one test is expected to run.

- **`--results-directory`**

The directory where the test results are going to be placed. If the specified directory doesn't exist, it's created. The default is `TestResults` in the directory that contains the test application.
The directory where the test results are going to be placed. If the specified directory doesn't exist, it's created. The default is `TestResults` in the directory that contains the test application.

- **`--timeout`**
Evangelink marked this conversation as resolved.
Show resolved Hide resolved

A global test execution timeout. Takes one argument as string in the format `<value>[h|m|s]` where `<value>` is float.

## MSBuild integration

Expand Down
Loading