5

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?

ditoslav
  • 4,563
  • 10
  • 47
  • 79

4 Answers4

3

CTRL+R, T is by defualt is assign to TestExplorer.RunAllTestsInContext.

TestExplorer.RunAllTestsInContext is works as the following based on the cursor:

enter image description here

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.

enter image description here

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.

Community
  • 1
  • 1
Old Fox
  • 8,629
  • 4
  • 34
  • 52
0

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.

Guillaume Pascal
  • 845
  • 1
  • 9
  • 19
  • Thanks for this answer. Unfortunately I already knew this and Im looking for something more flexible. I dont want to search through 10000 unit tests – ditoslav Mar 17 '17 at 18:32
  • I am aware that this is suboptimal for your needs, but I think this is the best you can achieve without any extension. However, I personally do not have any small extension to suggest to you. – Guillaume Pascal Mar 17 '17 at 19:51
0

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.

enter image description here

Mahdi Ataollahi
  • 4,544
  • 4
  • 30
  • 38
0

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".

Praveen M
  • 443
  • 2
  • 11