25

I am inside the IDE and I can run all the unit tests in a file but is there any way to run all test in a project or solution at once?

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
leora
  • 188,729
  • 360
  • 878
  • 1,366

7 Answers7

33

Right click on the project or solution in the VS solution-explorer and choose 'Run Unit Tests' Or go to the Resharper menu, choose Unit-Testing and choose one of the options from there.

Will Dean
  • 39,055
  • 11
  • 90
  • 118
26

If you learn executing menu commands with Alt-Letters, you can execute many commands fast even if they don't have direct shortcuts. Especially, if shortcuts are two-key combos.

As for running all tests in solution the command is Alt-RUN, i.e. Alt-R for ReSharper menu, U for Unit Testing, and N for all tests in solution.

Ilya Ryzhenkov
  • 11,782
  • 1
  • 40
  • 50
17

I'm surprised no one mentioned it here, but pretty much all resharper commands can be assigned to specific custom keyboard shortcuts. Go to Tools --> Options --> Keyboard, and find the command you're interested (just type "resharper" in the "show commands containing" text field & you'll find them all). In this specific instance, the "Run All Tests from Solution" command is "ReSharper.UnitTest_RunSolution".

In ReSharper 9.x, the command name is ReSharper.ReSharper_UnitTestRunSolution.

ESV
  • 7,620
  • 4
  • 39
  • 29
Alconja
  • 14,834
  • 3
  • 60
  • 61
  • This is what I do. I have it mapped to control-shift-x. Makes it nice and fast to run all tests. – Jamie Penney Jun 29 '09 at 00:56
  • This is the solution I was looking for, but Ilya's ALT+RUN solution over is even better! – Tomas Aug 19 '09 at 11:41
  • 4
    I use `CTRL+T, CTRL+T` to run tests based on context (current test/fixture); `CTRL+T, CTRL+D` to debug based on context; `CTRL+T, CTRL+S` to run tests for the solution & `CTRL+T, CTRL+E` to re-run the existing test session... I find holding `CTRL` & hitting `TT` or `TS` quicker & easier than typing out `RUN` (which needs two hands), but each to their own... (it is cool that they got the menu alt-keys to spell out RUN though). – Alconja Aug 19 '09 at 23:35
  • @Alconja : What did you replace the original CTRL-T (find type) with? Or do you not use it? CTRL-U is already associated with unit test commands. I would have used that instead... – Kevin Coulombe Jul 27 '12 at 17:47
  • @KevinCoulombe - I used IntelliJ IDEA in my pre-.NET Java days and have been on Resharper since the early versions, so I use the "ReSharper 2.x or IntelliJ IDEA" keyboard shortcut scheme as my base. So find type is CTRL-N, leaving CTRL-T free. – Alconja Jul 28 '12 at 12:38
6

Open ReSharper->Windows->Unit Test Explorer and select everything, then hit the run button

Matt Briggs
  • 41,224
  • 16
  • 95
  • 126
6

Sometimes, Resharper won't be able to see the tests until you manually rebuild them. So if you can't see the tests in resharper, or resharper isn't running all the tests in the solution, just rebuild them first.

neilhighley
  • 688
  • 7
  • 8
  • 1
    This turned out to be my problem, thanks. Build-Rebuild (alt+b, r). Then run all tests (ctrl+t, ctrl+l) found them all. – Andrew M Oct 10 '17 at 15:03
1

Resharper 7 default shortcut:

Run all tests from solution: Ctrl+U,L

Ofiris
  • 6,047
  • 6
  • 35
  • 58
0

It may be that your unit tests are not fully detected within Unit Test explorer. In that case, restarting Visual Studio helped resolve that problem.

Wolfgang Grinfeld
  • 870
  • 10
  • 11