dotCover 2016.1 Help

Working with Unit Tests in Project or Solution

In this topic:

Discovering unit tests in solution

dotCover adds the Unit Test Explorer Window to Visual Studio. Using this window, you can explore and run, debug or cover unit tests in the entire solution. The window displays all tests from the supported frameworks in the solution. Note that unit tests from a project only appear in the window after the project is built. Tests from currently opened files are updated automatically, new tests from these files appear in the Unit Test Explorer as soon as you create them.

Unit Test Explorer displays test from the entire solution

To open Unit Test Explorer, choose ReSharper | Unit Tests | Unit Tests or ReSharper | Windows | Unit Tests in the main menu or press Ctrl+Alt+T.

Unit Test Explorer allows you to do the following:

  • Explore tests in the solution: browse all unit tests in a list or tree view, search tests and filter by a substring, regroup unit tests by project, namespace, category, etc.
  • Navigate to source code of any test or test class by double-clicking it in the view.
  • run, debug or cover selected tests.
  • Create unit tests sessions from selected tests and test classs and/or add selected items to the current test session.
  • Export all tests from solution to a text, XML, or HTML file.

Executing and covering unit tests in project or solution

You can run, debug or cover tests from the Unit Test Explorer, Solution Explorer, or Class View. Unit Test Explorer gives you the advantage to see only tests and test classs , while using other windows you need to know, which projects, files, and classes contain tests.

  • To execute tests from Unit Test Explorer, select the desired tests and click Run Unit Tests toolbar__run_selected_tests / Debug Unit Tests uts_toolbar_debug_selected_tests or Cover Unit Tests ThemedIcon.JetBrainsDotCoverPresentationVsResourcesUnitTestingCoverageCover.Screen.[Gray] on the toolbar or use the corresponding shortcuts (Ctrl+T,R / Ctrl+T,D or Ctrl+T,H ).
  • To run, debug or cover tests from Solution Explorer or Class View, select one or more items ( classs, files, folders, projects) that contain tests, and use the Run Unit Tests / or Cover Unit Tests commands, which are available in the main menu (ReSharper | Unit Tests), in the context menu or with Ctrl+T,R / or Ctrl+T,H shortcuts correspondingly.
  • To run, debug or cover all tests in solution, choose ReSharper | Unit Tests | Run All Tests from Solution / ReSharper | Unit Tests | Cover All Tests from Solution in the main menu or press Ctrl+T,L / Ctrl+T,K .

Whatever way you choose to run, debug or cover tests, you will see the execution progress, results and output in the Unit Test Sessions Window. If there is an open unit test session, the executed tests are added in this session. If there are no test sessions or the existing ones are locked, then a new tests session is created.

If necessary, you can always repeat execution or coverage analysis of the tests that you executed last by choosing ReSharper | Unit Tests | Repeat Previous Run in the menu or pressing Ctrl+T,T.

Last modified: 19 August 2016