Reputation: 4892
So I'm moving from Visual Studio 2015 with ReSharper to Visual Studio 2017 and I'm trying to remove ReSharper from my workflow.
I know what CTRL+R,T runs either a whole TestClass or all tests depending on where you run it. It seems selecting something inside a single unit test still runs the whole test class.
Is it possible to run a single unit test?
I'm also missing right-clicking a folder in solution explorer and running all the tests in it.
Is there an extension which provides this tiny feature?
Upvotes: 5
Views: 6261
Reputation: 453
You can have a new filter criteria in the search box of test explorer . In the filter drop down , you can select a full name option and there you can give your namespace .
It will list entire test files located under that namespace. You can then select all of the test file and do "Run selected tests".
Upvotes: 0
Reputation: 5241
In the TestExplorer
you can group tests by Class
(there is a Group By
button in the toolbar as shown in the image) then it will group tests by their classes and you can right-click on a group an click Run Selected Tests
.
Upvotes: 0
Reputation: 8725
CTRL+R, T
is by defualt is assign to TestExplorer.RunAllTestsInContext
.
TestExplorer.RunAllTestsInContext
is works as the following based on the cursor:
So it seems that TestExplorer.RunAllTestsInContext
is what you are looking for...
To make sure what key may is assign to this feature click on Tools -> options -> Environment -> Keyboard
, in the search bar write: TestExplorer.RunAllTestsInContext
then you'll be able to see keymap/ set new one.
I'm also missing right-clicking a folder in solution explorer and running all the tests in it.
Is there an extension which provides this tiny feature?
As I know there is no such a tool basically because folders don't have any restriction on code in C#. The correct way to do such a thing is to use `TestCategory attribute.
Upvotes: 3
Reputation: 845
You can run a single unit test from the Tests Explorer
window. When you have done it once, you can rerun the last tests run using Ctrl+R, L
. So if the last run you have done is a single unit test, it will be the only one to be rerun.
Sadly, it seems there is no shortcut to run the unit test under cursor.
Regarding the other part of your question, with the Tests Explorer
window you can have tests grouped by namespace, project, class or result and then run all tests of a specific group. Maybe it can fit our needs?
Hope this help.
Upvotes: 0