Vstest.console.exe can't find nunit tests
Asked Answered
C

3

6

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

Coffman answered 28/11, 2017 at 19:0 Comment(0)
S
8

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.

Stevenson answered 29/11, 2017 at 18:33 Comment(1)
I've installed NUnit 3 Test Adapter via Nuget, does /TestAdapterPath need to point to the NUnit3.TestAdapter.dll? - I can't get this to work...Stevestevedore
V
2

Use this way:

"<full_path_of_exe>\vstest.console.exe" "<full_path_of_dll>\NUnitTestProject.dll" /TestAdapterPath:"<point_to_the_FOLDER_where_your_NUnit3.TestAdapter.dll_is>"
Versed answered 5/2, 2021 at 21:4 Comment(0)
P
-1

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

Panda answered 29/11, 2018 at 9:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.