Nunit-console: No suitable tests found

Created on 13 Mar 2019  路  5Comments  路  Source: nunit/nunit-console

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

  • NUnit 2 Test adapter (2.1.1)
  • Specflow 2017.2.7

Nuget

  • NUnit 2.6.4
  • Specflow 1.9.0
  • NUnit.ConsoleRunner 3.9.0

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

answered question

All 5 comments

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.

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?

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?

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.

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

Was this page helpful?
0 / 5 - 0 ratings