问题
Visual studio unit testing starts all tests when I use "Start Debugging" from Debug menu, instead just ones selected in Test List editor or Test results window. It's really annoying since I use shortcut to start projects not only while testing, and number of times I just hit that key automatically and VS starts all tests instead just one or two that I am currently debugging.
Can this be changed to just run selected tests in Test List Editor ?
UPDATE : I am aware of start commands under Test menu, but problem is that that shortcut is "hardcoded" in my brain and I use it every day number of times while debugging winforms and ASP.NET projects, and in unit test case it starts all tests
回答1:
Under Tools->Options, go to the Environment->Keyboard screen, then select the task you want to run when you press [F5]. Click in the "Press shortcut keys:" box (or press [Alt]+P), and then press [F5]. You'll see that it tells you that [F5] is currently used by Debug.Start. Click on the Assign button (or press [Alt]+S) to change [F5] to be what you want it to be. To restore the original functionality, repeat the above process but with Debug.Start as the item you're assigning the shortcut key to. (Or click on the Reset button if there's nothing else you want to preserve.)
回答2:
There are various options to run subsets (or all) tests under the debugger (or not debugging) under the Test menu. Further options are available on the Test View and Test Results tool windows.
The tool window specific commands include running selected tests.
来源:https://stackoverflow.com/questions/6678455/visual-studio-unit-testing-start-debugging-starts-all-tests