No test found. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again

前端 未结 30 1870
广开言路
广开言路 2020-12-05 04:00

I am in the process of upgrading our existing solution to .Net 4.6.1 and have been unable to get our unit tests to run during a server build. Locally they run as expected an

30条回答
  •  隐瞒了意图╮
    2020-12-05 04:25

    If you are running your tests inside docker using multistage building and tests aren't found. Make sure you copy all files not only project files like below Dockerfile section.

    FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
    WORKDIR /src
    COPY ["MainProject/FirstApp.csproj", "MainProject/"]
    COPY ["TestProject/*", "TestProject/"]
    
    RUN dotnet restore "TestProject/TestProject.csproj"
    RUN dotnet build "TestProject/TestProject.csproj" -c Release
    RUN dotnet test "TestProject/TestProject.csproj" -c Release
    

提交回复
热议问题