Is there a way I can tell the R# (5.x) test runner to run all the MSpec specs in the current file?
Something like the Ctrl+R + Ctrl+T shortcut of the Visual Studio test runner is what I'm after, be it a shortcut or a context menu command.
Doesn't the menu item ReSharper -> Unit Tests -> Run Unit Tests do what you want to?
When your cursor is placed between two tests methods, it will run all tests in the current class. When your cursor is placed outside a test class, it will run all tests in the current file.
Related
Is there any way to run unit tests directly from the text editor, somehow clicking/right clicking on the unit test source or left margin? (a la ReSharper)
VS has a build in Test Explorer. Please go to Test --> Test Explorer.
I am trying to run all unit tests in a certain folder. When I click on that folder and select "Run All Tests" Resharper opens a window showing all my tests but all the tests have a "?" next to it which says "Pending Unknown. Derived Unknown".
If I click on single test and then say "Run Test" then it works fine.
When debugging a unit test through either the TEST menu or the right-click context menu, VS2013 always ignores the breakpoint in the unit test after making a code change to the current c# test class. Debugging a second time causes the breakpoint to be hit.
My suspicion is that this has to do with VS2013's new feature "Keep Test Execution Engine Running".
You can toggle that feature in Visual Studio's menu via "TEST - Test Settings".
You might also be able to specify that behaviour by using a runsettings file with KeepExecutorAliveAfterLegacyRun set to false: http://msdn.microsoft.com/en-us/library/vstudio/jj635153.aspx.
I know I can click items in the test-explorers and run individual tests from there, but I would like to be able to right click or use a shortcut key to run the test of the method that has the current focus in the editor.
There doesn't appear to be a "run test" item available.
The best (but non-free) option is ReSharper:
Alternatives are:
NUnit Test Adapter (free)
TestDriven.Net (non-free)
NUnitForVS (free; Visual Studio 2008–2010 only)
Visual Studio has two default keybindings for unit testing :-
CTRL-R then CTRL-T : Debug the current unit test 'context'
(ie where the cursor is currently flashing).
CTRL-R then T : Run the current unit test 'context' (as above).
How can I rebind these to use nUnit? Currently, they only support MSTest.
I also have ReSharper installed, if that's any help.
I grab nUnit via NuGet. I don't manually install nUnit via some msi, fwiw.
I got this on Tool -> Options -> Environment -> Keyboard
Theres 2 resharper commands, search for contextrun and assign Ctrl+R, T and for contextdebug and assign Ctrl+R,Ctrl+T
Look in Resharper->Unit Tests menu. There are options to run tests. I use Run All Tests from Solution (Ctrl+R, Ctrl+U - for me R and U stand for Run Unit tests). If You have NUnit Tests it will run them. It will run MSTest tests also.
To change key bindings go to VS2010 menu Tools->Options. Then select Keyboard on left and enter 'runsol' in 'Show commands containing' textbox. Assign Your preferred key binding.