-
Notifications
You must be signed in to change notification settings - Fork 727
How to run and debug unit tests
Gregg Miskelly edited this page Jun 6, 2018
·
6 revisions
The C# extension currently supports running and debugging a unit test via CodeLens annotations on test methods. Just click the 'run test' or 'debug test' links:

- Because
dotnet testwill run the test code in a child process, it isn't possible to configure a "unit test debugging" configuration in launch.json - There currently isn't a VS Code command to run the current test, though there is an issue for this in the backlog.
- You can tweak debugging options for unit tests by opening your VS Code settings file (ex: File->Preferences->Settings on Windows), and configuring the
"csharp.unitTestDebuggingOptions"setting. See example below.
Example User Settings file with unit test debugging options:
{
"window.zoomLevel": 0,
"csharp.unitTestDebuggingOptions": {
"sourceFileMap": {
"c:\\example\\folder\\where\\library\\was\\built": "/folder/where/my/library/is/now"
}
}
}Documentation
- Change Log
- Main repo documentation.
- Branches and Releases
- Installing Pre-Releases
- Installing without internet connectivity
Configuration
- Configuring Snap installs of dotnet-sdk
- Configuring Arch Linux for Unity development
- Configuring Arch Linux for Razor development
- Installing the .NET Core Debugger on Arch Linux
Developer Guide