dotCover 2018.1 Help

Working with Unit Tests in Current Document

Discovering Tests in the current document

dotCover discovers unit test classes and single unit tests of all supported frameworks right in the editor and adds the corresponding action indicators next to each item in the editor:

dotCover shows different indicators for unit tests in the editor
  • ThemedIcon UnitTestingOptionsPage Screen Gray - the method is a unit test and you can run and debug it.
  • ThemedIcon UnitSession Screen Gray - the class is a unit test class and you can run and debug containing tests.
  • ThemedIcon TestMethodSuccess Screen Gray - the unit test passed during the last execution.
  • ThemedIcon TestFixtureSuccess Screen Gray - tests in the unit test class passed during the last execution.
  • ThemedIcon TestMethodFail Screen Gray - the unit test failed during the last execution.
  • ThemedIcon TestFixtureFail Screen Gray - at least one test in the unit test class failed during the last execution.
  • ThemedIcon TestMethodIgnored Screen Gray - the unit test was ignored during the last execution.
  • ThemedIcon TestFixtureIgnored Screen Gray - all tests in the unit test class were ignored during the last execution.

Executing and covering tests in the current document

There are several ways to run, debug or cover unit tests in the current document. You can use action indicators, main menu or shortcuts:

  • To run, debug or cover a single test or all tests in a test class, click on the action indicator next to it. In the action list, choose Run / Debug or Cover for a test or Run All /Debug All or Cover All for a test class.
    dotCover Unit Testing Recognizing Unit Tests test
  • Alternatively, you can use the Run Unit Tests / Debug 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 / Ctrl+T D or N/A shortcuts correspondingly. These commands work differently depending on the caret position or selection in the editor:
    • To run, debug or cover a single test or all tests in a test class, set the caret at the test/test class name, or anywhere inside its declaration in the editor.
    • To run several tests, select the desired tests in the editor.
    • To run all tests in the current file, either select all or set the caret outside test classes.
  • You can run execution or coverage analysis for one of the covering tests of a specific statement by selecting a test in the navigation pop-up and clicking Cover Tests ThemedIcon JetBrainsDotCoverPresentationVsResourcesUnitTestingCoverageCover Screen Gray :
    dotCover show covering tests

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 pressing Ctrl+T T or choosing ReSharper | Unit Tests | Repeat Previous Run in the menu.

Last modified: 20 August 2018