pedron
pedron

Reputation: 237

Visual Studio Code - .NET Core Test Explorer

I am trying to run tests through .NET Core Test Explorer plugin for Visual Studio Code. I have a folder with all my code in it, including source code for the project AND the test code. The Test Explorer doesn't find the tests, and i've set the: "dotnet-test-explorer.testProjectPath" setting to the actual folder, but still nothing.

Any ideas on how to get the VSC's Core Test Explorer to actually find my tests? These are all *.cs files. thanks

Upvotes: 9

Views: 10045

Answers (1)

Maciej Pulikowski
Maciej Pulikowski

Reputation: 2517

It is a problem with your name of the test csproj.

In .NET Core Test Explorer extension's details we can read:

the glob pattern "+(testProjectOne|testProjectTwo)" or "*/Tests.csproj" should add both of the test projects.

However, default templates name of csproj are different.

For instance - dotnet new nunit has a project name projectName.TestProject.csproj. So, it is not included in the glob pattern.

Two solutions:

  1. Change project name to projectName.Tests.csproj
  2. Change settings of .NET Core Test Explorer to

    "dotnet-test-explorer.testProjectPath": "*/*.TestProject.csproj"

Upvotes: 6

Related Questions