Part Cover support in EAP 5.0

I've been trying to get part cover working in the latest EAP 5.0 build 10181 but having problems.  If I fill in the new .NET Coverage form elements (see below) do I still need to make a call in my msbuild file as indicated at the bottom?  IF someone could provide me with a sample that would be great!!  I've had a look in the docs but considering that it is an EAP I don't think the docs have been finished.

TeamCityPartCover.jpg



<ItemGroup>
        <TestAssemblies Include="$(BuildProjectFolderPath)\..\..\..\Binaries\Debug\*Tests*.dll" />
  </ItemGroup>

  <Target Name="AfterTest">
         <CallTarget Targets="RunTests" />
  </Target>

  <Target Name="RunTests">
    <Exec Command="$(teamcity_dotnet_nunitlauncher) v2.0 x86 NUnit-2.5.0 /partcover:&quot;C:\Tools\Gubka Bob\PartCover .NET 2\PartCover.exe&quot; /partcover-arg:--output /partcover-arg:c:\result.xml @(TestAssemblies)" />
  </Target>



 


Thanks!!

5 comments
Comment actions Permalink

.NET coverage works implicitly. You do not need to modify your build script to make it work.You either to not need to provide explit arguments to
$(teamcity_dotnet_nunitlauncher).

Please use the following build script to run tests:
  <Target Name="RunTests">
    <Exec Command="$(teamcity_dotnet_nunitlauncher) v2.0 x86 NUnit-2.5.0 @(TestAssemblies)" />
  </Target>

Set up .NET coverage from the Web UI in the way, that was shown in the picture.
Please, note, paths to xslt files in the last field should be relative to checkout folder or absolute.
Update it to C:\Tools\Gubka Bob\PartCover .NET 2\xslt\Report By Assembly.xslt

This should be enough to have .NET Coverage with PartCover.

Let me know the result.

0
Comment actions Permalink

Cool thanks. It seemed that the path to the XSLT file was the problem.  Is there anyway to prevent my tests from running twice or is that something to accept if I want to use code coverage?

0
Comment actions Permalink

It should not report tests twice. Please check you do not start tests for the same assembly twice. You may simply check iot be disabling .NET coverage and running the build. There should be the same number of tests.

0
Comment actions Permalink

I've disabled the .Net Code Coverage and the tests are still being run twice so at least we know that it is not that causing the problem.  Also TeamCity is reporting ignored tests where a test actually doesn't exist.  For example in the sample build log I have attached, the following two 'Ignored' tests aren't tests but just folders/namespaces

[Tests.Company.Product.Server.Data.NHibernateMaps] Test ignored: Tests.Company.Product.Server.Data.NHibernateMaps
[Tests.Company.Product.Server.Services] Test ignored: Tests.Company.Product.Server.Services

The following tests are run twice:


[Company.Product.Tests.dll] Tests.Company.Product.Server.Data.WhenGettingAllEntities.RetrievedEntitiesShouldNotBeTheSameAsPersistedEntities
[Company.Product.Tests.dll] Tests.Company.Product.Server.Data.WhenGettingAllEntities.RetrievedEntityNamesShouldEqualPersistedEntityNames
[Company.Product.Tests.dll] Tests.Company.Product.Server.Data.WhenGettingEntityById.RetrievedEntityNameShouldEqualPersistedEntityName
[Company.Product.Tests.dll] Tests.Company.Product.Server.Data.WhenGettingEntityById.RetrievedEntityShouldNotBeTheSameAsPersistedEntity



 


In order to run the tests the only line I have in my build file is the following:

<Exec Command="$(teamcity_dotnet_nunitlauncher) v2.0 x86 NUnit-2.5.0 @(TestAssemblies)" />

where

@(TestAssemblies) = .....Company.Product.Tests.dll

Have you got any thoughts on what the issue could be?

Cheers,
Martin



Attachment(s):
TeamCity build file - duplicate tests.txt
0
Comment actions Permalink

How much assemblies with tests do you run?

Please attach declarations of that double reported tests, classes, setups and tear downls of the class.

Do you use package setup/teardown feature of NUnit 2.5?

Do you use RowTests or something but SetUp, TearDown, Test, TestFixture?

Thanks!

0

Please sign in to leave a comment.