Possible to turn off automatic run of tests in Visual Studio 2017 every time I build my local solution? - visual-studio-2017

I have a solution that includes many tests, but I don't want to automatically run the tests every single time I build. Is there a way to do this in Visual Studio 2017?
I've checked Tools/Options. I've searched for this question in Stack Overflow, but don't find this question.
I've also checked the Solution Properties, but I don't see anything.
This question isn't a duplicate of this Stack Overflow question How to Prevent automatic test execution because it deals with the web portal and not Visual Studio 2017 IDE, itself.

Have you tried disabling "Run Tests After Build" from the Test Explorer window's toolbar? It should be the first button on the toolbar.
To open the Test Explorer window, go to Test -> Windows -> Test Explorer.

You first go to Test in the main menu, then go to Windows and then under the Windows, Run Tests After the Build button

Related

How to disable test discovery in visual studio 2017?

I have some solutions with a bunch of projects and we have no unit test project in these solutions. However Visual Studio 2017 is still trying to discover unit tests and slowing down our process.
https://imgur.com/a/89Vt1P6
I looked at the runsettings xml file but there was nothing in there to disable it
https://learn.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file
any idea how we turn this unnecessary stuff off for some of our solutions?
Thanks
This was driving me crazy too. One day it just started running test discovery after every build, and switching my output pane to "Test" which is annoying.
How I fixed it in VS 2015 (may be the same for 2017),
disable (uncheck) this setting:
Test menu --> Test Settings --> Keep Test Execution Engine Running

Keyboard shortcut for debugging the LAST test run in Visual Studio IDE (2013)

I know there are several VS keyboard shortcuts for running unit tests, but the one I really can't find and would like is to be able to run the last executed test in debug mode.
Ctrl+R, L will repeat the last run, but not in debug mode.
If you are debugging a test, and it changes context to the code you are actually running, and then you stop the test, is there a way to start that test in debug mode again using just the keyboard?
I wanted the same thing.
Based on the technique found in the following post
Visual Studio 2012 debug tests keyboard shortcut
I searched for TestExplorer.DebugSelectedTests and assigned a shortcut key to it.
At least in VS2015 (and hopefully in VS 2013) even while debugging changes context to the code you are actually running. The test remains selected in the test explorer window. So, you can run your shortcut key combo and the test will debug again.
Hope this solves the problem for you too.
I know this question was for Visual Studio 2013, but got google go me here.
In Visual Studio 2019 is a shortcut for that Ctrl+R,D:
If you are using ReSharper, you can use Ctrl+U, D to rerun a test in Debug mode.
https://www.jetbrains.com/resharper/features/unit_testing.html

How can I continuously run unit tests in Visual Studio 2012 Professional?

Visual Studio 2012 added a "Run tests after build" button in the Unit Test Explorer, but it seems that option is not available in the Professional edition. In fact, my "Unit Test Explorer" is just called "Test Explorer", and doesn't have that button at all:
Are there any extensions which can replace this missing feature? Something that integrates with the existing test explorer UI would be ideal. (Free options are also preferred, since if I could convince my corporate overlords to shell out for VS Ultimate/Premium, this wouldn't be an issue anyway)
I remapped my F6 key to TestExplorer.RunAllTests instead of the default of Build.BuildSolution
Build.BuildSolution gets remapped to Ctrl-Shift-B when you do that.
It works well because now my F6 reflex RunAllTests saves any modified files, builds my solution and runs my unit tests.
The only thing I had to change is my window layout so that I can see the Test Explorer Window, that way I know if any tests failed.
Updating the answer with a link to a blog I wrote about this
The "Run Tests After Build" and "Profile Test" features are available in Premimum and Ultimate editions of Visual Studio 2012.
NCrunch is not free but it's well worth the money and superior to any and all test running features in Visual Studio, regardless of edition.
You could also have a look at http://www.continuoustests.com/ aka Mighty Moose.
It's not quite as slick as NCrunch, but it is free.

How to profile unit tests in Visual Studio 2012?

Is it possible to profile MSTest unit tests in Visual Studio 2012 Ultimate without using any external profiling tools?
This feature was added back in the upcoming Visual Studio 2012 Quarterly Update 1. Right-click the test you want to profile in the Test Explorer and select "Profile Test" from the context menu.
In Visual Studio it was a really powerful feature !
As you, I can not find it in VS2012 (no references in MSDN or in blogs, ...)
Now, the only solution I have found for profiling Unit Test is to Attach the Profiler to a Process called vstest.executionengine.x86.exe (x86 for me but this could be different for 64 bits)
You can do this in the Tab "Performance Explorer" after a right click.
Once the profiler is starting, you can run as many tests as you want. Then stop profiling and you will see all details of this session.
There are 2 caveats with this technique :
for some reasons, the process is missing in the list. Maybe it stops when idle. Start just one test te see it.
You have to Attach the Profiler for every sessions. I don't find yet a way to script it.
Hope this will help you.
In Visual Studio 2015, follow the instructions Cybermaxs gives, but select TE.ProcessHost.Managed. Unfortunately, there appear to be two of them, so you must select the one with higher CPU usage.
With VS 2019/2022 you attach to the testhost process while running your tests. Just run your tests in debug, and stop execution on breakpoint, then you can find that process to attach.

My ReSharper Gutter Icons for Unit Tests aren't showing

I've installed ReSharper 4.1 and Gallio 3.0.5, but I don't get the gutter icons for unit tests. The tests seem to run fine in the Test Explorer, but I don't have icons next to the tests in code. What could be causing this? I previously had the MbUnit 2.4 ReSharper plugin installed, but it should be uninstalled now.
I did this to get them to show up again. Maybe it was an overkill.
Uninstall ReSharper
Uninstall Gallio
Delete %appdata%\JetBrains folder
Install ReSharper
Start Visual Studio
Close Visual Studio
Install Gallio
Start Visual Studio
I think the key was deleting the %appdata%\JetBrains folder, because there could have been some old plugin files in there.
Another really late answer here, but if you don't have Resharper Code Analysis enabled then the gutter icons won't show up. Had to help a teammate figure this out yesterday.
Maybe a bit long ago, but if someone stumbles on this question...
I had the same problem with Resharper 2016.2
Resharper -> Options -> Code Inspection -> Settings
In my case the project containing the unit test was listed in the "Files and folders" list under "Elements to skipp". After I had removed the project, the icon appeared again.
using Visual Studio 2017, fixed mine using the Code Analysis icon in the upper right corner of the code window missing the gutter test icons.
The analysis was suspended because of the large test file. Had to hit resume twice, then icons finally reappeared.
I've had this issue a number of times when doing clean installs. Sometimes the gallio-resharper plugin installs perfectly, sometimes it does not. I tried the steps above to no avail.
I found this link: http://confluence.jetbrains.net/display/ReSharper/Deploying+plugin
And did the following
Created a Plugins folder in "C:\Program Files (x86)\JetBrains\ReSharper\v5.1\Bin\"
Copied the resharper plugin files from GallioBundle-3.3.458.0.zip\bin\ReSharper into this folder
Suspended and resumed resharper in Visual Studio 10 by using the button in Tools|Options|Resharper
After this, the plugin got enabled.
I am running W7x64 professional.
Hope this can be of help to other people as well. :-)
Suspend and Resume Resharper may work. It was working for me.
Try the following steps, they worked for me,
Open the Resharper installer
check if any item is asking for repare, if yes then click on install.
Now open visual studio and go to resharper option
if the first option is "why dot cover is diabled", click on it.
and enable the dot cover by either taking the free trial or logging in with your resharper id.
It will take few seconds to refresh
You will get back those icons for running or debugging unit test.