Skip to content

pavdro/teamcity-dotcover

 
 

Repository files navigation

dotCover intergation with

NuGet TeamCity.dotCover License

Provides the TeamCity integration with dotCover via the Visual Studio Test Platform. This package is an alternative way to run .NET tests under dotCover described in this post.

Supported SDK

  • .NET Core SDK 2.0+

Supported platforms

Supported OS

  • Windows

Usage scenarios

In brief, you can create a test project and run tests collecting code coverage statistics in 3 lines:

dotnet new mstest
dotnet add package TeamCity.dotCover
dotnet test

where mstest is the one of dotnet project templates.

The command dotnet add package TeamCity.dotCover adds the TeamCity integration with dotCover by referencing the TeamCity dotCover integration package.

The final test project might look like the following:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>    
    <TargetFrameworks>net45;netcoreapp2.0</TargetFrameworks>    
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
    <PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
    <PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
    <PackageReference Include="TeamCity.dotCover" Version="2019.1.1" />    
  </ItemGroup>  
</Project>

To run tests under dotCover use the .NET CLI plugin for TeamCity or any other TeamCity runners which allow running a command equivalent to:

dotnet test

or

dotnet msbuild /t:VSTest

Passing dotCover arguments

If you want to specify any argument you’ve used previously with dotCover, you can do this by simply adding the environment variable starting by TC_DC_ prefix to the variable name.

E.g., to specify an assembly filters, use the environment variable TC-DC_Filters instead of --Filters:

SET TC_DC_Filters=-:MyTests

Diganostics

To gather diagnostics information use the environment variable TC_DC_TRACE_FILE and specify path to a trace file there. For instance:

SET TC_DC_TRACE_FILE=c:\temp\trace.txt

Important notes

  • Avoid specifying code coverage options in runners because the TeamCity dotCover integration package already runs your tests under dotCover.
  • The gathering of code coverage statistics is turned off when tests are not running under TeamCity (for instance when tests are running locally).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%