Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2017 and NUnit 3.9 No test is available

Tags:

I am using the latest VS2017 version 15.6.4, NUnit3TestAdapter 3.10.0 and Nunit version 3.9.0.0.

When I try to run a unit test in Test Explorer the test are grayed out, when I right click and and run selected tests I see the following error: No test is available Here is how my test class looks

    [TestFixture]     public partial class ListViewBOTest     {     [Test]      public void TestSearch_DateTime()       {         Assert.AreEqual(1,0);       }      } 

Here is a screenshot of my tests

Text from output:

[3/26/2018 10:53:55 AM Informational] ------ Run test started ------ [3/26/2018 10:53:55 AM Informational] NUnit Adapter 3.10.0.21: Test execution started [3/26/2018 10:53:55 AM Informational] Running all tests in C:\Projects\MVPPlant\DEV\CMMSdg.Plant\CMMSdg.Plant\Sln.2010\CMMSdg.Plant.BusinessObjects.Test\bin\Debug\CMMSdg.Plant.BusinessObjects.Test.dll [3/26/2018 10:53:56 AM Informational] NUnit failed to load C:\Projects\MVPPlant\DEV\CMMSdg.Plant\CMMSdg.Plant\Sln.2010\CMMSdg.Plant.BusinessObjects.Test\bin\Debug\CMMSdg.Plant.BusinessObjects.Test.dll [3/26/2018 10:53:56 AM Informational] NUnit Adapter 3.10.0.21: Test execution complete [3/26/2018 10:53:56 AM Warning] No test is available in C:\Projects\MVPPlant\DEV\CMMSdg.Plant\CMMSdg.Plant\Sln.2010\CMMSdg.Plant.BusinessObjects.Test\bin\Debug\CMMSdg.Plant.BusinessObjects.Test.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. [3/26/2018 10:53:56 AM Informational] ========== Run test finished: 0 run (0:00:01.0435303) ========== 
like image 389
Helen Araya Avatar asked Mar 26 '18 16:03

Helen Araya


People also ask

Why are my NUnit tests ignored?

Ignored tests are displayed by the runners as warnings in order to provide a reminder that the test needs to be corrected or otherwise changed and re-instated.

What is NUnit test adapter?

The NUnit Test Adapter allows you to run NUnit tests inside Visual Studio. The current release, version 2-0, is designed to work with Studio 2012 (All updates), Visual Studio 2013 (All updates) and Visual Studio 2015 (tested with all pre-releases, checked April 2015).

How do I add a NUnit reference in Visual Studio 2019?

Right-click the References item and then click Add Reference. Select Project | Add Reference from Visual Studio's main menu. In the Reference Manager, click Browse. Browser for nunit.


2 Answers

Make sure you have installed the NUnit3 Test Adapter from here

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

like image 140
Peter Morris Avatar answered Oct 10 '22 15:10

Peter Morris


Can you check the following steps and see if it works?

  1. In the Visual Studio menu, go to Test > Test Settings > Default Processor Architecture and make a note if X86 is selected or X64
  2. Now go to the Build section in the Properties window of the project where the tests are written. Make sure the Platform target drop-down is selected to either Any CPU or at least it matches the architecture from the above step 1.

Now if you build the solution and try running those tests, you should see that they are now running.

like image 29
hem Avatar answered Oct 10 '22 13:10

hem