Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run NUnit test in VS Code with .NET TEST EXPLORER

I would like to run unit tests from .NET TEST EXPLORER, not the command line. I can run tests when navigating to the unit test directory and executing dotnet test.

But selecting .NET TEST EXPLORER shows:

Please open or set the test project and ensure your project compiles

Is it related to the NUnit nature of the test project?
Project does compile. How do I set the test project?

like image 782
SwiftArchitect Avatar asked Jan 16 '19 01:01

SwiftArchitect


2 Answers

In VISUAL STUDIO CODE, select the Settings wheel (Manage) > Extensions > Workspace Settings > Test Project Path

Enter the relative path to the unit test project: MyProject.Test/MyProject.Test.csprojx.

like image 50
SwiftArchitect Avatar answered Oct 26 '22 23:10

SwiftArchitect


Select the Settings wheel (Manage)
-> Extensions
-> Workspace Settings
-> Test Project Path

Enter:

*Tests*

if you have "Tests" in your project's name.

Source: Interactive Unit Testing with .NET Core and VS Code By John V. Petersen

like image 37
Seibernaut Avatar answered Oct 27 '22 01:10

Seibernaut