In VS2010, one can Run or Debug Tests in Current Context.
That made it easy to click on a test I had just added or modified and run it (Ctrl-R T) or debug it (Ctrl-R Ctrl-T). (or with my gaming keyboard... G1 ;-)
The only way I can find to run a specific test is to locate it in Test Explorer and run it from there. That requires shifting my focus away from the code I'm working on.
Is there something equivalent to Current Context in Visual Studio 2012?
To start debugging: In the Visual Studio editor, set a breakpoint in one or more test methods that you want to debug. Because test methods can run in any order, set breakpoints in all the test methods that you want to debug. In Test Explorer, select the test method(s) and then choose Debug on the right-click menu.
Testing Explorer# The Testing Explorer is a tree view to show all the test cases in your workspace. You can select the beaker button on the left-side Activity bar of Visual Studio Code to open it. You can also run/debug your test cases and view their test results from there.
When you are editing code (rather than paused in the debugger), right-click a line of code in your app and choose Run to Cursor (or press Ctrl to F10). This command starts debugging and sets a temporary breakpoint on the current line of code.
It turns out that one can right-click on the source code of any of:
public void MyTest()
)public class MyTestClass
)namespace My.Project.Test
)and get a context menu to either run or debug tests within each given scope. (Note: Text in Context Menu does not change)
This has proven the most useful method of selectively running tests for me.
I was just looking for this myself and happen to come across this tidbit.
If you right click inside the test you want to debug in the current context and select run tests or debug tests it will only run that one.
If may appear that all the other tests in that file fail according to the test explorer, but it should work.
https://connect.microsoft.com/VisualStudio/feedback/details/745762/cant-run-or-debug-tests-in-current-context
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With