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

前端 未结 30 1755
广开言路
广开言路 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:22

    My build was not finding the tests either. My setup and solution for finding the tests are as follows.

    I use VSTS (Visual Studio Team Services) and have a build that is configured to refresh the NUGET packages on every build. I am using NUnit and found that running the following NUGET command (from the package manager console in Visual Studio) to add NUnitTestAdapter library to my test project and the checking in the packages.config made the tests run in my VSTS build.

    Install-Package NUnitTestAdapter
    

    As Maurice mentions in the Comment to this post for NUnit3 use the following NUGET package (Look for other utils on the link. i.e: dotnet CLI and Paket CLI)

    Install-Package NUnit3TestAdapter
    

    Hope this helps.

    0 讨论(0)
  • 2020-12-05 04:22
    1. Install Nunit and NUnitTestAdapter latest version from NUGET package.
    2. Go to -> Test -> Test Settings -> Default processor architecture -> Change to X64
    3. Build the solution.
    4. This will resolve Run Test and Debugger issue in unit testing and it will start working.
    0 讨论(0)
  • 2020-12-05 04:22

    I fixed this by issue in VS 2017 & 4.6.2 test project with the following steps:

    1. Remove references to Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll and extensions
    2. Install the Microsoft.VisualStudio.QualityTools.UnitTestFramework.Updated nuget package
    0 讨论(0)
  • 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
    
    0 讨论(0)
  • 2020-12-05 04:26

    I use MSTest.

    I installed from Nuget the latest version of MSTest.TestFramework and replaced OOB Remove references to Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

    Then Installed from neget the latest version of Microsoft.TestPlatform

    It allowed me to run test with a command:

    ".\packages\Microsoft.TestPlatform.16.6.1\tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" "UnitTestProject1\bin\Debug\UnitTestProject1.dll" /logger:trx
    

    But I got the same error. The root cause of the error that I didn't specify a test adapter which parses the assembly and finds tests.

    Solution:

    1. Install a nuget package "MSTest.TestAdapter"

    2. Specify a test adapter in the end of a command:

      /TestAdapterPath:".\packages\MSTest.TestAdapter.2.1.2\build_common"

    0 讨论(0)
  • 2020-12-05 04:27

    Found a way! Probably not the most orthodox but it did helped me out in a hurry:

    1. Update the MSTest.TestAdapter and MSTest.TestAdapterFramework packages to the 1.4.0 from the Tools > NuGet Package Manager.
    2. The clean the solution and run the tests again.

    I don't think is anything particular with the version, but updating it certainly cleans whatever reference is bad in the solution/project.

    0 讨论(0)
提交回复
热议问题