Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm developing a .NET Core app and I need to make some tests for Repository. Nevertheless, I had some problem for Net Core Test explorer configuration. When I settle down the test project path, it couldn't be seen it in Test explorer tree. I did everything and followed all possible steps (https://learn.microsoft.com/en-us/dotnet/core/tutorials/testing-library-with-visual-studio-code?pivots=dotnet-7-0) without success. So, I'd like someone to help to configure the Test Explorer global path given this project structure:

├── NetCoreApi
    ├── Controllers
    ├── Data
    ├── Models
    ├── NetCoreApi.Tests
    │   ├── NetCoreApi.Tests.csproj
    │   ├── UnitTest1.cs
    │   ├── Usings.cs  
    ├── NetCoreApi.csproj
    ├── NetCoreApi.sln
    ├── Program.cs
    ├── Properties
    ├── Dockerfile
    ├── appsettings.Development.json
    ├── appsettings.json
    ├── bin 


What I have tried:

I tried the following step (Test a .NET class library using Visual Studio Code - .NET | Microsoft Learn[^]) and it didn't worked as expected. Later, I move to setting.json and settle a new:

"dotnet-test-explorer.testProjectPath": "NetCoreApi.Tests/NetCoreApi.Tests.csproj"


But test explorer tree didn't recognize the project folder.
Posted
Updated 2-Oct-23 2:55am
v3

1 solution

Why are you putting a project within another project? Each project should be it's own branch set.
NetCoreApi.sln
  ├── NetCoreApi.csproj
  │     ├── project folders and files goes here
  ├── NetCoreApi.Tests.csproj
  │     ├── project folders and files goes here

If you have many projects in a solution, then you can use virtual folders to group "like" projects:
NetCoreApi.sln
  ├── App
  │     ├── projects go here
  ├── Database
  │     ├── projects go here
  ├── Libraries
  │     ├── projects go here
  ├── Tests
  │     ├── projects go here
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900