Running the tests
There are several ways to execute the tests of a suite.
To execute all the tests in a suite project, simply execute the following command in the preferred shell
This command will take care of building the source code, if it was needed.
The test utility supports several flags: a complete list can be accessed by executing
dotnet test -hin the console.
The .NET Core SDK includes a file system watcher utility that automatically executes a command when a file in a watched folder is modified. This utility can be used to automatically execute all tests when a file is modified.
To use the file system watcher, simply execute the following command in your preferred shell while being in the folder of your test suite project
dotnet watch test
Visual Studio Code is a lean code editor that relies on add-ons (also known as extensions) to support the workloads of the user.
This extension extends the editor providing lightweight development tools for .NET Core, including a basic support for unit testing. Specifically, this extension gives the developer the possibility to run or debug specific tests or set of tests.
Visual Studio Code also embeds a terminal. This terminal can be used to run tests from the command line like explained earlier.
Unlike Visual Studio Code, Visual Studio has a built-in support for C# and unit tests written in this language.
Among the built-in amenities offered by Visual Studio there is the Test Explorer: a panel that displays all the tests available in the solution. From there, developers can run tests or group of tests and see their outcome.