Stécy
Stécy

Reputation: 12339

Using TeamCity 9.1.3, how to call dotCover from nunitlauncher with parameters?

I've setup a MSBuild file with several targets.

In one of the target I am calling

<Exec Command="$(teamcity_dotnet_nunitlauncher) v4.0 X86 NUnit-2.5.9 @(UnitTestDlls)"/>

where @(UnitTestDlls) is a group of items containing the DLL I want to unit tests. I do it this way since from the web interface I cannot dynamically build a list of DLL to unit test.

Anyway, this is working fine but now I would like to add coverage analysis with DotCover.

In the past we used PartCover as follows:

<Exec Command="$(teamcity_dotnet_nunitlauncher) v4.0 X86 NUnit-2.5.9 @(UnitTestDlls) 
               /partcover:%22$(PartCoverConsole)%22 /partcover-arguments:%22--register 
               --output $(PartCoverXmlOutputFile) --include [*]* --exclude [Accessibility]* 
               --exclude [*]Microsoft* --exclude [*test*]* --exclude [*Test*]* --exclude [*JetBrains*]*
               --exclude [*nunit*]* --exclude [*log4net*]*
               @(ExternalLibraries-&gt;'--exclude [%(Filename)]* ','')%22"/>

and it was working great.

I tried changing the /partcover argument to /dotcover but it would seem that the launcher does not support arguments for dotcover !

Upvotes: 1

Views: 278

Answers (1)

Maria
Maria

Reputation: 526

You should specify dotCover.exe as an executable and pass NUnitLauncher as the target executable argument to dotCover.

<Exec Command="[path_to_dotCover]\dotCover.exe cover /TargetExecutable=&quot;$(teamcity_dotnet_nunitlauncher)&quot; /TargetArguments=&quot;v4.0 X64 NUnit-2.5.9 @(UnitTestDlls)&quot; /Output=&quot;[path_to_workdir]\[snapshot_name].dcvr&quot;" WorkingDirectory="[path_to_workdir]"/>

Upvotes: 1

Related Questions