nunit / nunit-console

NUnit Console runner and test engine
MIT License
217 stars 152 forks source link

No suitable tests found #569

Closed michaelrobayoGasTag closed 5 years ago

michaelrobayoGasTag commented 5 years ago

To anyone who can help,

I have been trying to run Unit tests which have been created using Specflow and locally it works, I run the following command and I get the results I want:

nunit3-console.exe GasTag.Tests.dll --where "cat == unit"

I am trying to automate this process in a CI/CD pipeline in a CMD Azure DevOps task and I just can't for the life of me understand whats going wrong.

I build the correct sln and it outputs everything to the following directory:

D:\a\1\s\Tests\GasTag.Tests\bin\Debug

The file 'GasTag.Tests.dll' is listed when I list the directory contents but I get the following error when trying the same cmd:

1) Invalid : D:\a\1\s\Tests\GasTag.Tests\bin\Debug\GasTag.Tests.dll
No suitable tests found in 'D:\a\1\s\Tests\GasTag.Tests\bin\Debug\GasTag.Tests.dll'.
Either assembly contains no tests or proper test driver has not been found.

I am using the following versions:

VSIX

Nuget

I understand one of the first responses will be to update specflow/nunit versions but unfortunately these versions need to be at this level in order to run UI tests through Microsoft AppCenter.

Any help would be greatly appreciated!

Regards, Michael

CharliePoole commented 5 years ago

In order for your NUnit V2 tests to run under the NUnit 3 console, you clearly have the NUnt V2 Framework Driver extension installed. Is it installed in your Azure environment? The command nunit3-console --list-extensions will tell you.

michaelrobayoGasTag commented 5 years ago

Wow thanks for getting back so quick! There was me thinking this wasn't going to go anywhere :)

So I've run this locally and got the following:

  Extension Point: /NUnit/Engine/NUnitV2Driver
    Extension: NUnit.Engine.Drivers.NUnit2FrameworkDriver (.NET 2.0)
  Extension Point: /NUnit/Engine/TypeExtensions/IService
  Extension Point: /NUnit/Engine/TypeExtensions/ITestEventListener
    Extension: NUnit.Engine.Listeners.TeamCityEventListener (.NET 2.0) (Disabled)
  Extension Point: /NUnit/Engine/TypeExtensions/IDriverFactory
  Extension Point: /NUnit/Engine/TypeExtensions/IProjectLoader
    Extension: NUnit.Engine.Services.ProjectLoaders.NUnitProjectLoader (.NET 2.0)
      FileExtension: .nunit
    Extension: NUnit.Engine.Services.ProjectLoaders.VisualStudioProjectLoader (.NET 2.0)
      FileExtension: .sln .csproj .vbproj .vjsproj .vcproj .fsproj
  Extension Point: /NUnit/Engine/TypeExtensions/IResultWriter
    Extension: NUnit.Engine.Addins.NUnit2XmlResultWriter (.NET 2.0)
      Format: nunit2

And on Azure I get:

  Extension Point: /NUnit/Engine/NUnitV2Driver
  Extension Point: /NUnit/Engine/TypeExtensions/IService
  Extension Point: /NUnit/Engine/TypeExtensions/ITestEventListener
  Extension Point: /NUnit/Engine/TypeExtensions/IDriverFactory
  Extension Point: /NUnit/Engine/TypeExtensions/IProjectLoader
  Extension Point: /NUnit/Engine/TypeExtensions/IResultWriter

Not sure why I'm only getting the extension points returned, are these VSIX based extensions?

michaelrobayoGasTag commented 5 years ago

I'm looking into how to install the missing .vsix during the build process in Azure, I'm sure that's where this thread is going to go so hoping this could fix this issue?

CharliePoole commented 5 years ago

Vsix is a format for installing extensions to Visual Studio. Here we are talking about an extension to the NUnit engine. You install it using the ame method you used to install NUnit ConsoleRunner. To just add the NUnit V2 framework driver, use package NUnit.Extension.NUnitV2Driver.

Alternatively, to install a number of common extensions replace NUnit.ConsoleRunner (just the runner) with NUnit.Console. It looks like you probably did that locally.

michaelrobayoGasTag commented 5 years ago

@CharliePoole its working now! Thanks so much for your help, so happy to finally get this sorted :)

shashikantn commented 10 months ago

@CharliePoole : Similar to this, I am trying to upgrade NUnit 2.6.1 to Nunit.3.8.1. I am using Nant for build purpose, as it doesn't support Nunit3, I am trying to nunit console. But, nunit console 3.16.0 works fine on a new project but not on migrating project, throws below error. 1) Invalid : C:\IEF_Repo\IEF\bin\Business.Common.dll No suitable tests found in 'C:\IEF_Repo\IEF\bin\Business.Common.dll'. Either assembly contains no tests or proper test driver has not been found.

On Running - nunit3-console --list-extensions Runtime Environment OS Version: Microsoft Windows NT 6.2.9200.0 Runtime: .NET Framework CLR v4.0.30319.42000

Installed Extensions Extension Point: /NUnit/Engine/NUnitV2Driver Extension: NUnit.Engine.Drivers.NUnit2FrameworkDriver(.NET 2.0) Version: 3.9.0.0 Path: C:\IEE_Repo\IEE\tools\nunit\addins\nunit.v2.driver.dll Extension Point: /NUnit/Engine/TypeExtensions/IService Extension Point: /NUnit/Engine/TypeExtensions/ITestEventListener Extension: NUnit.Engine.Listeners.TeamCityEventListener(.NET 2.0) (Disabled) Version: 1.0.7.0 Path: C:\IEE_Repo\IEE\tools\nunit\addins\teamcity-event-listener.dll Extension Point: /NUnit/Engine/TypeExtensions/IDriverFactory Extension Point: /NUnit/Engine/TypeExtensions/IProjectLoader Extension: NUnit.Engine.Services.ProjectLoaders.NUnitProjectLoader(.NET 2.0) Version: 3.7.0.0 Path: C:\IEF_Repo\IEF\tools\nunit\addins\nunit-project-loader.dll FileExtension: .nunit Extension: NUnit.Engine.Services.ProjectLoaders.VisualStudioProjectLoader(.NET 2.0) Version: 3.9.0.0 Path: C:\IEF_Repo\IEF\tools\nunit\addins\vs-project-loader.dll FileExtension: .sln .csproj .vbproj .vjsproj .vcproj .fsproj Extension Point: /NUnit/Engine/TypeExtensions/IResultWriter Extension: NUnit.Engine.Addins.NUnit2XmlResultWriter(.NET 2.0) Version: 3.6.0.0 Path: C:\IEF_Repo\IEF\tools\nunit\addins\nunit-v2-result-writer.dll Format: nunit2

OsirisTerje commented 10 months ago
  1. This is too little information.
  2. You're writing into a closed issue. If you have tried what is described above, and it doesn't work for you, you have another issue than this one. So, create a new issue.
  3. Please create a small repro so that it is possible to understand what you're trying to do. Upload it, or point to a repo.