dotCover
 
Get dotCover

Analyze Coverage of Web Apps with Command Line Tool

Last modified: 11 February 2024

If you want to automate coverage of a web application (for example, in continuous integration), you can use the dotCover command-line tool.

Unlike manual coverage, where you get coverage snapshots by clicking the Get Snapshot button, the command-line tool gets a snapshot only once the profiled process correctly finishes its work. Thus, to get a snapshot, you should either correctly stop IIS in the system or run a second instance of the command-line tool and explicitly send the "get snapshot and kill process" command to the first running instance. How does the second instance know about the first one? It's quite simple: when running the first instance, you specify its ID using the /Instance=<ID> argument. Then you can use this ID to send commands to the instance.

The coverage process is performed somewhat differently depending on your coverage target and whether IIS or IIS Express is used to host the application. There are three main coverage scenarios:

  1. Get coverage of a web application (IIS Express/IIS).

  2. Get coverage of tests and (optionally) web application. The application and tests are started separately.

  3. Get coverage of tests. The application is started by tests.