1

I'm using NUnit framework v3.12.0 and NUnit3TestAdapter v3.17.0 (latest) in VS2015. The problem I have is that it does not discover any test. I've tried deleting Temp files, and it is not working. The only way it works is by changing, every time I want to run it, the NUnit3TestAdapter version to any other. As you can realize, it is a waste of time.

This is the error it throws: An exception occurred while test discoverer 'NUnit3TestDiscoverer' was loading tests. Exception: Object reference not set to an instance of an object.

Any clue on how to solve this??

What I have tried so far:

  • restarting VS
  • cleaning and rebuilding solution
  • deleting Temp files
  • removing references, uninstalling and installing test adapter extension

Error image

packages

ales172
  • 51
  • 1
  • 8

2 Answers2

1

I was helped by the transition to Visual Studio 2019, where the tests are running normally.

Completely uninstalling and reinstalling Visual Studio c using the Visual Studio Uninstaller utility did not help.

This is quite strange, for some reason, even reinstalling Windows 10 and Visual Studio did not help.

  • I'm sorry, can you clarify -- are you saying that switching to Visual Studio 2019 solves this problem? – C. Peck May 18 '21 at 20:12
  • Yes, it solves. I had a similar problem. Switching to Visual Studio 2019 helped me. https://ru.stackoverflow.com/questions/1174316/nunit-test-adapter-%d0%bf%d0%b5%d1%80%d0%b5%d1%81%d1%82%d0%b0%d0%b5%d1%82-%d0%be%d1%82%d0%ba%d1%80%d1%8b%d0%b2%d0%b0%d1%82%d1%8c-%d1%82%d0%b5%d1%81%d1%82%d1%8b-%d0%bf%d0%be%d1%81%d0%bb%d0%b5-%d0%bd%d0%b5%d1%81%d0%ba%d0%be%d0%bb%d1%8c%d0%ba%d0%b8%d1%85-%d0%b7%d0%b0%d0%bf%d1%83%d1%81%d0%ba%d0%be%d0%b2-%d1%82%d0%b5%d1%81%d1%82%d0%be%d0%b2 – Рашид Кашапов May 19 '21 at 10:20
1

There is a bug on VS2015 and VS2017. The workaround that worked for me is the following:

  1. Go to Test->Test Settings->Default Processor Architecture
  2. Switch from x64 to x86 (or vice versa if your original architecture is x86)
  3. Rebuild solution
  4. Repeat step 2, but switch back to the original setting
  5. Rebuild solution

This seems to kick the NUnit test adapter in the head and it displays the tests in Test Explorer.

  • I've tried it but it worked for me just once. Then I had to repeat process – ales172 Mar 26 '22 at 14:37
  • 1
    Yes, that's right. Short of restarting VS, this is the only workaround. Unfortunately, whenever you change the code and rebuild, you have to repeat these steps. Maybe a macro doing all this can be made and bound to a keyboard shortcut to facilitate the procedure, but basically, you have to do this every time you want to see your tests after you have changed the code. – Vladimir Stokic Mar 28 '22 at 14:14