Last post Jun 05, 2018 07:26 AM by nguyenhuyen020589
Jun 07, 2017 03:12 PM|gib9898_00|LINK
Ever since I migrated over to Visual Studio 2017 from 2015, I've been having issues getting my unit tests to be discovered. I have a project with 824 unit tests. Visual Studio 2015 had no trouble discovering them. Then when I opened the project in 2017,
no tests were discovered. I tried clearing the solution, rebuilding the solution, rebuilding the Test project, "Run All", etc. but nothing works.
An even bigger issue is that this is affecting Visual Studio 2015. When I go back to VS2015, I find my unit tests are no longer discoverable there too.
SOMETIMES what sort of works is when I update Nuget packages or install new ones. The project has had NUnit since the beginning but Nuget gives me the option to update it. Further, I can also install NUnit3TestAdaptor, NUnitTestAdapter, and NUnit.Runners
(which installs a whole bunch of dependency packages). I say SOMETIMES this works because it's hit and miss (different combinations at different times, something nothing), and because it only ever ends up discovering 77 out of the 824 unit tests I have in
The last thing I tried, in VS2017, was to undo all my changes to the Test project (which consisted only of all the package installs and updates). I've done this before to no avail, but somehow magically this time it worked: all 824 tests showed up! By UNINSTALLING
all additional packages and updates.
So then I open VS2015 <-- There they were! Awesome! I opened VS2017 and... they're gone. Cleaned solution, rebuilt, rebuilt Test project in particular, clicked "Run All" and... nothing. I'm back at square one.
This looks to me like it's a problem with VS2017. When you start it up, and it tries to discover any unit tests, it fails. It not only fails, but it messes things up for other versions of Visual Studio.
Does anyone know what's going on here and how to fix it?
Jun 08, 2017 05:14 AM|EvenMa|LINK
I found that you had been posted a thread similar as this, they are the same issue , I‘m still tracking the thread.
In this thread, I read your description several times, there has some key points.
(1) The test methods are all could discover in VS2015 at the beginning.
(2) After upgrade to VS2017 ,some of the test methods couldn’t discover, at this time, in VS2015, get the same result.
(3) When undo all changes to the test project, they are both working fine in VS2015 and VS2017.
What did you change on the test project, you said had installed the newest version of NUnit by NuGet, besides that, there has any changes on the code?
I’m not sure why, as I said before, the rule to discover test methods in NUnit has never been changed.
Could you provide the simple test project for us to find the issue?
If you have any other questions, please feel free to contact me any time.
Jun 08, 2017 04:25 PM|gib9898_00|LINK
Besides updating NUnit, I also installed NUnitTestAdapter, NUnit3TestAdapter, and NUnit.Runners. The last one also installed a bunch of dependencies:
Then I undid these and all of a sudden my unit tests showed up.
I also came across this article which explains that VS2017 changed the way it deals with unit tests:
I tried its recommendations but to no avail.
Jun 15, 2017 03:01 AM|zxj|LINK
Try clearing temp files located in the %TEMP% directory
Note: This path is generally at C:\Users\(yourusername)\AppData\Local\Temp
Jun 05, 2018 07:26 AM|nguyenhuyen020589|LINK
Thanks for the help