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

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

    Try running vstest.console.exe with --diag:diag.txt and inspect the output. For me it was DLL load failures for test adapters from my working directory:

    TpTrace Information: 0 : 14976, 1, 2020/03/10, 15:34:22.120, 57158093583, vstest.console.exe, AssemblyResolver.OnResolve: Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter: Failed to load assembly. Reason:System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Directory\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

    File name: 'file:///C:\Directory\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

    I worked around this by adding <loadFromRemoteSources enabled="true"/> under <runtime> in vstest.console.exe.config

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

    I am having the same issue. I am using Visual Studio 2017 Community Edition.

    I used these steps to successfully discover all my test cases and successfully run it:

    • First go to Extensions and Updates, install NUnit3 Test Adapter. If you already have, just enable it.

    • Restart your Visual Studio 2017, it will automatically prompt to
      install your extension, if a prompt says to end task to continue
      installing, just click "End Task".

    • After that, rebuild your Test Project and all test cases will now be identified and you can now start running your test cases.

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

    This problem surfaces for Visual Studio 2017 again. Most likely another bug but the same outcome.

    One workaround that seems to work is to uninstall Microsoft Visual Studio 2017 Remote Debugger from the affected machine.

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

    I got this error and was able to resolve it.

    1. I use Visual Studio Professional 2017
    2. In VS, I navigated to Tools --> Extensions And Updates
    3. At the top of the menu, I'd noticed that my NUnit adapter was disabled
    4. I clicked the [Enable] button
    5. I was able to initiate tests without errors.
    0 讨论(0)
  • 2020-12-05 04:21

    I fixed this problem by reinstalling all testing related NuGet packages for the project: Xunit, Xunit.runner.vistualstudio, Microsoft.Net.Test.Sdk

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

    I faced the similar issue when tried nUnit in VS 2017 and it's not a core project. Installing NUnit3TestAdapter fixed the issue.

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