Does anyone have a solution to include Chutzpah code coverage in TFS build summary? The unit tests runs fine, but i dont get any code coverage. Our project has a DOD with an code coverage of 85%, so it would be great to automate this in the build process.
2016-01-12T07:58:08.5718428Z Executing the powershell script: D:\TFSAgent\tasks\VSTest\1.0.22\VSTest.ps1
2016-01-12T07:58:08.7749779Z ##[debug]Calling Invoke-VSTest for all test assemblies
2016-01-12T07:58:08.7905962Z Working folder: D:\TFSAgent\_work\6
2016-01-12T07:58:08.7905962Z Executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "D:\TFSAgent\_work\6\s\src\FSP.Tests\sampletests.js" /Settings:"D:\TFSAgent\_work\6\s\buildtools\common.runsettings" /EnableCodeCoverage /logger:trx /TestAdapterPath:"D:\TFSAgent\_work\6\s\src\packages\Chutzpah.4.1.0\tools"
2016-01-12T07:58:08.9780981Z Microsoft (R) Test Execution Command Line Tool Version 14.0.23107.0
2016-01-12T07:58:08.9780981Z Copyright (c) Microsoft Corporation. All rights reserved.
2016-01-12T07:58:09.2437191Z Starting test execution, please wait...
2016-01-12T07:58:09.3062199Z Warning: Using Isolation mode to run the tests as diagnostic data adapters were enabled in the runsettings. Use the /inIsolation parameter to suppress this warning.
2016-01-12T07:58:14.2165110Z Information: Log Message: waiting for blanket... from D:\TFSAgent\_work\6\s\src\FSP.Tests\sampletests.js
2016-01-12T07:58:20.7009092Z Passed SamleTest has a test
2016-01-12T07:58:20.7009092Z Passed app testController has a controller defined
2016-01-12T07:58:20.7009092Z Passed app testController echo returns same string
2016-01-12T07:58:20.7477777Z Results File: D:\TFSAgent\_work\6\TestResults\G04SEASLOID2$_G04SEASLOID2 2016-01-12 08_58_20.trx
2016-01-12T07:58:20.7477777Z Attachments:
2016-01-12T07:58:20.7477777Z D:\TFSAgent\_work\6\TestResults\5f30d7de-bf10-44c2-b9f3-0640da2b8183\G04SEASLOID2$_G04SEASLOID2 2016-01-12 08_58_11.coverage
2016-01-12T07:58:20.7477777Z Total tests: 3. Passed: 3. Failed: 0. Skipped: 0.
2016-01-12T07:58:20.7477777Z Test Run Successful.
2016-01-12T07:58:20.7633997Z Test execution time: 8,2573 Seconds
2016-01-12T07:58:20.8883985Z Publishing Test Results...
2016-01-12T07:58:21.5290256Z Test results remaining: 3
2016-01-12T07:58:21.8415328Z Published Test Run : http://g04seasloid2:8181/tfs/DefaultCollection/FS%20Portal%20Project/_TestManagement/Runs#runId=272&_a=runCharts
The common.runsettings file looks like this
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<ResultsDirectory>..\..\TestResults</ResultsDirectory>
<TargetPlatform>x86</TargetPlatform>
<TargetFrameworkVersion>Framework45</TargetFrameworkVersion>
</RunConfiguration>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>
<ModulePaths>
<Include>
</Include>
<Exclude>
<ModulePath>.*\.tests\..*</ModulePath>
<ModulePath>.*TestAdapter.*</ModulePath>
<ModulePath>.*packages.*</ModulePath>
</Exclude>
</ModulePaths>
<Functions>
<Exclude>
<Function>^Fabrikam\.UnitTest\..*</Function>
<Function>^std::.*</Function>
<Function>^ATL::.*</Function>
<Function>.*::__GetTestMethodInfo.*</Function>
<Function>^Microsoft::VisualStudio::CppCodeCoverageFramework::.*</Function>
<Function>^Microsoft::VisualStudio::CppUnitTestFramework::.*</Function>
</Exclude>
</Functions>
<Attributes>
<Exclude>
<Attribute>^System.Diagnostics.DebuggerHiddenAttribute$</Attribute>
<Attribute>^System.Diagnostics.DebuggerNonUserCodeAttribute$</Attribute>
<Attribute>^System.Runtime.CompilerServices.CompilerGeneratedAttribute$</Attribute>
<Attribute>^System.CodeDom.Compiler.GeneratedCodeAttribute$</Attribute>
<Attribute>^System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute$</Attribute>
<Attribute>^NUnit.Framework.TestFixtureAttribute$</Attribute>
<Attribute>^Xunit.FactAttribute$</Attribute>
<Attribute>^Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute$</Attribute>
</Exclude>
</Attributes>
<Sources>
<Exclude>
<Source>.*\\atlmfc\\.*</Source>
<Source>.*\\vctools\\.*</Source>
<Source>.*\\public\\sdk\\.*</Source>
<Source>.*\\microsoft sdks\\.*</Source>
<Source>.*\\vc\\include\\.*</Source>
</Exclude>
</Sources>
<CompanyNames>
<Exclude>
<CompanyName>.*microsoft.*</CompanyName>
</Exclude>
</CompanyNames>
<PublicKeyTokens>
<Exclude>
<PublicKeyToken>^B77A5C561934E089$</PublicKeyToken>
<PublicKeyToken>^B03F5F7F11D50A3A$</PublicKeyToken>
<PublicKeyToken>^31BF3856AD364E35$</PublicKeyToken>
<PublicKeyToken>^89845DCD8080CC91$</PublicKeyToken>
<PublicKeyToken>^71E9BCE111E9429C$</PublicKeyToken>
<PublicKeyToken>^8F50407C4E9E73B6$</PublicKeyToken>
<PublicKeyToken>^E361AF139669C375$</PublicKeyToken>
</Exclude>
</PublicKeyTokens>
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
<CollectFromChildProcesses>True</CollectFromChildProcesses>
<CollectAspDotNet>False</CollectAspDotNet>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
<MSTest>
<MapInconclusiveToFailed>True</MapInconclusiveToFailed>
<CaptureTraceOutput>false</CaptureTraceOutput>
<DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
<DeploymentEnabled>False</DeploymentEnabled>
</MSTest>
<ChutzpahAdapterSettings>
<TestingMode>All</TestingMode>
</ChutzpahAdapterSettings>
</RunSettings>
There is a built-in code coverage function in VS. No matter you are using XAML build or vNext build, you just need to enable the related settings in build definition.
For XAML build
Here is a blog introducing Continuous Integration with JavaScript, NUnit on TFSBuild, for your reference.