Translate

Friday 12 February 2016

VS2015, NUGet and NUnit Test Adapter bug

Is it a VS 2015 bug or a NuGet one - there are so many weird bugs whenever NuGet is used to install packages!

One such bug can be replicated by following the below bullet-ed steps:

  1. Install NUnitTestAdapter with NUGet (not the one with the WithFramework) in your NUnit test project. Set the test project's target framework version to "4.5"
  2. Check the Test Explorer and the target framework Settings of the project to ensure both synchronize.
  3. Add another project (say, for example, a class library to be tested from your NUnit test project). Set your project's target framework version to "4.5.2"
  4. Add reference to NUnit v2.6.4 (not v3.0 and not through NUGet) after downloading it from NUnit dot org and add some tests in your test project. 
  5. Build solution. You should see some warnings as below.

Open the Test Explorer window. from Test->Windows->Test Explorer and click Run all... No tests will appear in the Test Explorer because the tests cannot be discovered due to Build errors!!

Warnings are errors? Rhetorical question, of course.


Change the other project to target the same framework version as your test project's and rebuild.

Now check out the Test Explorer.