Vstest.console.exe can't find nunit tests

痴心易碎 提交于 2020-01-24 05:03:40

问题


I have VS 2017 and .net 4.6

On trying to run via cmd prompt using vstest.console:

vstest.console.exe bin\Release\Tests.dll /UseVsixExtensions:true

I am getting warning "No test is available in /bin/Release/test.dll Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again."

So, I tried listing the tests but it doesn't show any tests.

vstest.console.exe bin\Release\Tests.dll /ListTests /UseVsixExtensions:true

Unit tests class file is as shown below.

[TestFixture]
public class class1
    {
    static void StartTest(string[] args)
    {

    }

 [Test] [Category("Regression_Test")]   
    public void TS1()
    {

    }
}

I tried googling for similar issue but didn't find anything that would work. Any help is really appreciated


回答1:


Have you actually installed the NUnit 3 test adapter as a vsix?

If you are using the more usual approach of installing via nuget, you need to tell vstest.console.exe where to find the adapter using the /TestAdapterPath option.




回答2:


Like Charlie already mentioned. Just install the nuget package in your project and everything ist fine!

https://www.nuget.org/packages/NUnit3TestAdapter/


The old NUnit 3 Test Adapter extenion won't be supported anymore in future!

https://marketplace.visualstudio.com/items?itemName=NUnitDevelopers.NUnit3TestAdapter#overview

NOTE: - EARLY WARNING: Please observe that VSIX test adapters will be deprecated in the upcoming Visual Studio 2019. Please add the nuget adapter package to your solutions instead. See further information here and here



来源:https://stackoverflow.com/questions/47539018/vstest-console-exe-cant-find-nunit-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!