Testing tools in Visual Studio for Mac
Applies to: Visual Studio for Mac Visual Studio
Visual Studio for Mac testing tools can help you and your team develop and sustain high standards of code excellence. Unit tests can be written and run using the Microsoft unit test framework (MSTest), xUnit, or NUnit.
To get started with testing, you can create a new test project in your solution by right-clicking your solution and choosing the Add > New Project... menu. Then choose one of the Test categories on the left-side of the dialog (For example, the Web and Console > Tests category). Select the type of test project you want to create, and then select Next. Follow the instructions in the dialogs that appear and then a new test project will be added to your solution.
For more information about unit testing your .NET Core applications and selecting unit test frameworks, see the Unit testing in .NET Core and .NET Standard documentation.
The Unit Tests window is used to run unit tests and is opened using the View > Tests menu. Unit tests in your solution are automatically discovered and shown in this window. Here you can run all of the tests or a set of tests that you've selected.
When editing a C# class that contains unit tests, you can run tests by right clicking in the test class or a test method and choosing the Run Test(s) or Debug Test(s) menu. Choosing the Run Test(s) menu item will run the tests in the test window, choosing the Debug Test(s) menu will do the same and attach the debugger so you can troubleshoot your code.
As tests are running, a Test Results window appears so you can review successful or failed tests, and the output from running those tests.