Home | Forums

Clover.NET Solution Instrumenter

CloverSolution - Visual Studio solution instrumenter

CloverSolution is the Clover.NET instrumenter for Visual Studio solutions. It works by creating a Clovered version of your Visual Studio solution. It can also be used to Clover individual Visual Studio projects.

Any projects which are not Cloverable (i.e. any non C# and non VB projects) are dropped from the Clovered version of the solution. Once Clovered, you can build the Clovered version of the solution from the command line using devenv.com. You may optionally have the outputs from the Clovered version of your solution appear in the approriate location within you normal solution directory structure.

The coverage database and recordings generated by CloverSolution and the Clovered code are compatible with all other methods provided by Clover.NET for instrumenting code. This means that you may, for example, view the code coverage results from a Clovered solution within your IDE using the Clover.NET Visual Studio plugin.

Usage

CloverSolution [options]

Options

The CloverSolution control options are detailed below. If you just type CloverSolution, it will show a summary of all options. Most options have both a long and short format. Use of the long format is recommended for use in build systems such as make since the system is more readable and maintainable. For command line usage, the short options may be more convenient

Long Name Short Name Required Description
--initstring -i No This option specifies the location of the coverage database maintained by CloverSolution. If the database does not exist, CloverSolution will create it. This parameter is optional If you do not provide it, Clover.NET will create the coverage database as clover.cdb in the output directory.
--solution -s No This options specifies the solution file you wish to Clover. If you do not specify a solution you must specify at least one Visual Studio project file.
--project -p No This options specifies a Visual Studio project file. You may specify more than one project file and may do so in addition to a solution file. If CloverSolution detects that a dependent project is not included in the list of projects which are to be Clovered, it will give a warning.
--destdir -d No The --destdir option tells CloverSolution where to place the instrumented solution. The solution directory structure is retained in the destination directory. If this option is not specified, it defaults to a directory CloverBuild.
--preserve No This option instructs CLoverSolution to generate Clovered versions of your project file so that the build outputs are written to the same location as the normal outputs of the corresponding project. This means that the Clovered output will overwrite your normal build output.
--config No Select the config you wish to build. Although solutions support multiple configs, CloverSolution needs to know which config to use when instrumenting code so that the appropriatre preprocessor defines are used to determine which code is to be Clovered. This defaults to Debug if not specified.
--flushinterval -f No Normally Clover.NET writes out coverage information when the containing AppDomain is unloaded. In most cases that means that the coverage recording is written out when the application closes. In some circumstances you may not want to shut down the application being tested. By selecting a flush interval (in milliseconds), instrumentation will include additional code to write out the coverage recording at regular intervals.
--noassign -na No Do not instrument boolean expressions which contain assignments. Ordinarily Clover.NET instruments all boolean expressions. In some conditions that instrumentation can affect the compiler's ability to determine whether an uninitialized variable has been used. With this option Clover.NET will not attempt to instrument such expressions.
--debug No Turns on debug level logging. This will give more information than verbose level
--verbose -v No Turns on verbose level logging. This gives more information about the progress of the Instrumenter
--clean -c No Performs a full re-Clovering of all source code. Normally when Clovering a solution, Clover.NET will not copy re-Clover files which have not changed.
--keyfile -k No The location of the the keyfile to use when signing code. Normally Clover.NET can locate the keyfile when it is specified as a literal in the code. Where it is specified through a constant, you may use this option to let Clover.NET know the location of the key file.
--additional -a No Specifies an additional file or directory to be copied to the Clovered solution. In some instances a solution may require files which are not listed in the solution projects. These files need to be specified manually. CloverSolution will determine where these files occur relative to the current solution and copy them to the corresponding location in the Clovered solution.
--exclude No Exclude a file or directory from Clovering. When a source file is excluded from Clovering, a copy will still be made in the Clovered solution area. This copy will not have any instrumentation and will not appear in any Clover.NET reports. This option is useful where, for example, you solution contains a Test project and you do not want to see tests in your coverage results.
--include No The include option specifies a directory or file which is to be Clovered when generating the Clovered solution. If you do not specify any includes, all eligible files are Clovered. If you specify any includes, only files listed in the include specifications will be Clovered. Other elgible files will be copied across but will not be instrumented. Some files may still be modified to update items such as key file references, etc. When a directory is specified, all files under that diretcory are included.
--webmap -w No Map an ASP project URL to a local file. You may specify multiple mappings with separate --webmap options. The syntax for this options is url=file. The url can be a prefix of the URL actually used in the solution file. In this case the filename of the project is formed by the given file and the remainder of the project URL. This allows you to map the URL to a local folder if there are multiple webapps in the solution.
--findroot -r No Normally Clover.NET maps the solution file into the destdir directory, which defaults to CloverBuild. When a solution contains projects above the solution directory, Clover.NET remaps these solutions to the destdir to avoid writing anything outside the destdir location. If your solution depends on the directory structure, you can specify this option. Clover.NET will then attempt to determine the "solution space" and map the root of that space into the destdir. This means that the Clovered solution file may be mapped to a directory further down in the destdir directory hierarchy.

Examples

CloverSolution -s Test.sln

This example creates, or updates, a coverage database at CloverBuild\clover.cdb. All of the source files in the Test solution's projects are Clovered and the result is written out to the CloverBuild directory.

CloverSolution -p src\Clover\Clover.csproj -p src\Tests\Tests.csproj --exclude src\Tests

This example Clovers the Test and Clover projects and excludes the Test code from instrumentation.