Starting then running all unit tests in a solution can take a very long time.
This suggestion is migrated to Developer Community. Please use below link to view the current status.
We have over 200 projects, 2900+ unit tests. It takes over a minute some times to get to the point where it can start listing all the unit tests in the test window, and start executing. We have latest gen Core I7, 8GB 64 bit windows, and it is still a pain. Maybe this area needs 're-imagining', as I can understand the complexities of managing this large number of projects/tests, but it is not working well for us.
Thank you for the feedback. We will look at how best to address this.
Visual Studio Team
Simon Vane commented
This has been dramatically improved in Visual Studio 2017 update 15.6. I have been using it since it was in preview and it solves a number of testing problems including discovery time and tests no being recognised when copy / pasted. Not perfect but a massive step forward.
Dr. Roman Becker commented
Over 6 minutes(!) for VS 2017 to discover 3 tests in a 3 projects C++ solution on an i7/16GB/Win10 machine with no other program running! You definitely have to do something about it.
[21.03.2018 09:10:44 Informational] ------ Discover test started ------
[21.03.2018 09:17:01 Informational] ========== Discover test finished: 3 found (0:06:17,8997798)
Simon Vane commented
Come on Microsoft, this is 6 years old and TDD is still a dreadful experience in Visual Studio, including VS2017. Why do you not think this is important enough to resolve?
Mark Nugent commented
This is also a problem in Visual Studio Enterprise 2017. Takes roughly a minute every time from when I choose Debug Tests to when the debugger hits the breakpoint at the start of the unit test. Note that I have only 1 unit test.
Alexandre Defalque commented
Still the same problem with Visual Studio 2015 Update 3:
------ Discover test started ------
========== Discover test finished: 615 found (0:00:51,9361931) ==========
Around 50s to discover the tests. This makes the unit tests experience in Visual Studio really but really painful.
any resolution on this so far/
I am working on Microsoft.Azure.Mobile.Server (github) and test discovery is taking forever. I've been waiting for about 10 min and still waiting. Not the fastest machine but not the slowest either. Something is seriously wrong.
Eric J. Peters commented
For me, this is not a test runner problem... It's a test discovery problem. Once the long delay in test discovery completes, they run just as quickly as they always have.
A couple notes to maybe help find the problem... In my scenario, the solution / number of tests hasn't significantly changed in the last 6 months, but the time to discover has gone from rapid to unbearably slow for all the developers on my team. We're not sure which update caused it, but it's clear an update slowed things down.
We've all tried numerous things -- restarting VS, restarting PC, uninstalling R#, clearing various caches, re-checkout of source, build clean, reinstall VS... Nothing seems to really help.
Also, when adding new tests to a class, it will run old tests, but will take the same long discovery before the newly written tests can be run. This destroys our capability to do TDD effectively.
Thanks for your help!
This was not an issue in VS2013 but is extremely painful in VS2015. The vstest.discoveryengine.x86.exe process seem to be idling too! What is going on?
In the past week I've noticed this same issue/delay at my company. When I try debugging a single test there is about a 40 second delay before my breakpoint is hit and I can debug. This was a huge problem considering I debug hundreds of tests daily. I realized it started happening a week ago shortly after some changes were made on my network by my network admin. I discovered that if I disabled my network card, then debug a test, it hits my breakpoint instantly. So for some reason the problem is related to VS trying to communicate over the internet prior to running any of my tests. As a temporary work-around I'm disabling my NIC when debugging tests. This is a pain but seems to get me around the problem until the network issues are resolved. Does anyone know why VS makes calls over the internet prior to running tests?
Слава Антонов commented
Same issue. Ten minutes for discovering 450 tests :-(
I had the same trouble, but it is resolved if I disable my Virus Scanner!
Ian Ceicys commented
I am seeing the same slowness on Visual Studio 2015 Update 2.
Are there any recommendations on how to speed up the test execution discovery?
No improvements seen after VS2015 Update 2 install.
Sometimes VS run tests immediatly, sometimes it takes up to several minutes (!) and during that time I see that SQL Server instance used by VS to store test results, consumes 100% of CPU core.
I am experiencing the same problem with Visual Studio 2015 Professional Edition using MSTest and the built in Test Runner.
3 simple tests running in 100ms but the tests dicovery taking 5 seconds!
For Test First Delevopment this is a pain.
Robert Evans commented
I am seeing the same behavior with VS2015 and NUnit3 Test Adapter. It is taking 1-2 minutes to discover only 29 unit tests. This is ridiculous. Has anyone been able to get an update on a fix for this?
Similor problem as Alvin, we have a solution with 14 projects. Only one project is a test project containing about 50 unit tests. Discovery takes almost a minute in Visual Studio 2015 (after each build!!!), the same project in VS2013 only takes a few seconds to detect the unit tests.
Erik Öjebo commented
For me, the issue was resolved by unchecking the testsettings file under Test => Test Settings in the main menu of Visual Studio (2015).
I had major problems with this, with a discover phase taking ~1.5 minutes. After disabling the testsettings file the discovery took ~6 seconds instead.
With VS 2015, it's taking >1min just to "begin" running 1 testcase...
1. This did not happen with VS2013 - so there's a major perf regression here.
2. Suggestion - That test case is right in front of me. If i selected that specific single test to run, why does it need to try and "discover" every testcase under the solution? In this scenario, test discovery can happen in the background if needed, but i don't want it to impact my perf of testing X manually selected testcases.
aside: RPS Tests?
Jeff Krauser commented
I just updated from 2013 to 2015 with resharper. Tests I ran in 2013 to 5-20 secords are now taking 5-10 minutes and longer. I used to run 350 unit tests in around 30 minutes. First 3 I am running took over 21 minutes and in this run I have 230 more to complete. This is insane. I am having a new desktop prepared and will re-install everything. Running OS7. What the heck happened. These are tests designed to stress and test the complete system but this is rediculous. I even updated code to 2015 standards. Complete rebuilds etc.