1

My problem is very similar to NUnit Unit tests not showing in Test Explorer with Test Adapter installed, in that I couldn't get the NUnit tests to appear in the Test Explorer (despite multiple rebuilds, setting the Test architecture to x64, etc). I rebuilt and rebuilt, and despite having NUnit 3 and the NUnit 3 Test Runner installed into my Solution (via Tools -> NuGet Package Manager -> Manage NuGet Packages For Solution...) I couldn't get the tests to appear.

On the advice of another response to the above question, I installed the NUnit 3 Test Runner as an Extension (which modified all of Visual Studio, not just my project).

After the extension is installed (and I do Yet Another Rebuild :) ) all my tests are listed in the Test Explorer.

Question: Why do are the tests shown in the Test Explorer for the Visual Studio-wide NUnit 3 Test Runner Extension, but NOT in the Solution-specific NUnit 3 Test Runner NuGet package?

What's even weirder is that the exact same project, with the per-Solution NuGet packages for NUnit, work just fine on my personal computer (WITHOUT the NUnit Extensions installed), using Visual Studio 2017 Community edition. It's only when I .ZIP the project and email it to another computer (which runs Visual Studio 2017 Enterprise) where I have this problem.

I'd prefer to install NUnit into the solution so that I can hand out copies to my students and have the project be completely self-contained.

Does anyone have any advice on how to further dig into the problem with the per-Solution NuGet package? I'm kinda stymied since the only obvious thing to try is "rebuild it again and see if that helps" :), so any thoughts on stuff to try / strategies to use would be great.

MikeTheTall
  • 3,214
  • 4
  • 31
  • 40
  • 1
    From what I know the NuGet adds the dlls to your project. You need the adapter itself to actually run the tests using Nunit installed as you did (and maybe you installed it before on your community edition - check the NuGet package manager to verify). So it makes sense that if you ZIP the project, the adapter doesn't "transfer" with it as it is an extension of the IDE. My suggestion would be to tell your students to install the extension themsleves (easily done via NuGet package manager) – Sam Oct 23 '17 at 14:05
  • I may be confused about this - I thought that a Visual Studio Extension modified the local installation of VS itself, meaning that all users on the one computer, for all their projects, had access to the functionality. I thought that a NuGet package, installed into the solution, modified the project and only that one project. It 'followed' the project (since it's part of the project) and therefore all it's functionality should go with it, too. Is that not the case? – MikeTheTall Oct 23 '17 at 17:05
  • If you downloaded the Nunit Adapter from the extensions it should affect VS locally for all users. Are you installing this on a computer accessible to students as well or your private PC? Anyway, Nunit adapter also has a NuGet which installs/adds the adapter DLL's to the solution which is what you might be looking for to ZIP and pass to your students. Try downloading both NuGet packages: adapter and nunit itself and see that it does add them to your //packages folder. Then you can send move it without worrying about installing extensions. – Sam Oct 24 '17 at 05:54
  • 3
    We highly recommend using the NuGet package over the extension. Microsoft is moving away from extensions for test adapter because they do not support multi-targeting and .NET Core. Clearly there is a problem with your setup and it may take some back and forth to help you. This probably isn't the best place to deal with it. Please enter and issue at https://github.com/nunit/nunit3-vs-adapter/issues and we can help you there. – Rob Prouse Oct 24 '17 at 15:37
  • Also, if you upload the zipped project here or attach it to an issue on github (@RobProuse link above), we could check that out for you. – Terje Sandstrøm Oct 25 '17 at 22:20
  • Wow! Thanks for the help, @RobProuse and @Terje-Sandstrom! I'll go enter an issue and attach the .ZIP file! – MikeTheTall Oct 26 '17 at 07:20

1 Answers1

1

At this point it looks like the Virtual Machine that I'm running the tests in thinks that the project is being run from a network drive. .Net has different rules for running code remotely and by default doesn't want to execute remote code (which seems reasonable :) ).

It's worth pointing out that NUnit should (and does!) work just fine in a VM where the project is saved onto a virtual disk - it's just the 'network drive'/file share that's causing the problem.

MikeTheTall
  • 3,214
  • 4
  • 31
  • 40