Reputation: 12339
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->'--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
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="$(teamcity_dotnet_nunitlauncher)" /TargetArguments="v4.0 X64 NUnit-2.5.9 @(UnitTestDlls)" /Output="[path_to_workdir]\[snapshot_name].dcvr"" WorkingDirectory="[path_to_workdir]"/>
Upvotes: 1