Friday, August 7, 2020

Visual Studio 2015 doesn't discover unit tests

 

Some things I've noticed I have to do from time to time to get tests to show up properly.

  1. If your solution is in a protected drive that you need administrator access to read/write, sometimes only a portion of the tests come up. Definitely run VS as administrator in that case.

  2. If your solution is 64 bit, make sure that Test > Test Settings > Default Processor Architecture is set to x64. Sometimes it gets set to x86. Set it to x64, then rebuild.

  3. Sometimes just restarting Visual Studio does the trick because the test explorer will start up again.

  4. Don't forget to actually build the test project/solution. (If you want it to get built with the rest of the projects, right-click on your solution > Properties > Configuration Properties > Configuration > check the "Build" box for your test project)

  5. Ensure the tests are in a public section of your test class


https://stackoverflow.com/questions/25304425/visual-studio-2013-doesnt-discover-unit-tests



How to install   NUnit Test Adapter 


http://nunit.org/nunitv2/docs/2.6.4/vsTestAdapter.html



NUnit Test Adapter for Visual Studio

Installation

Beginning with version 0.95 there are two ways of installing the adapter within Visual Studio. See Note 1 below for info on how to choose.

  1. Use the Extension Manager
  2. Add it as a Nuget package to your solution. (New in 0.95, requires VS 2012 Update 1 or higher)

Installing With the Extension Manager

To install the NUnit Test Adapter using the Extension Manager, follow these steps:

  1. From within Visual Studio 2012, 2013 or 2015, select Tools | Extension Manager.
  2. In the left panel of the Extension Manager, select Online Extensions.
  3. Locate (search for) the NUnit Test Adapter in the center panel and highlight it.
  4. Click 'Download' and follow the instructions.

Use the Extension Manager to ensure that the NUnit Test Adapter is enabled.

Installing the Nuget Package

To add it is a Nuget package, you must have an active solution, then follow these steps:

  1. From Tools menu, use Library Package Manager, select Manage NuGet packages for solution
  2. In the left panel, select Online
  3. Locate (search for) NUnit Test Adapter in the center panel and highlight it
  4. You will find two packages, one without framework and one with framework. See note 2 below for which to choose.
  5. Click 'Install'
  6. In the "Select Projects" dialog, you need to select at least one project to add the adapter to, see notes below.




No comments:

Post a Comment

Health Benefits of Cashews

  Benefits of Cashews. Healthy food is an integral part of healthy body. Regular exercises such as Yoga and healthy diet is important to...