0

I have a project containing azure function implementations. My project .csproj file looks like below. enter image description here

I haved added a test project for the same and implemented unit tests using Xunit. My test project .csproj looks like below.

enter image description here

I have added a Visual Studio Test task in my build definition with below configurations.

enter image description here

How can I include only project and test project for calculating code coverage?

DevMJ
  • 331
  • 1
  • 5
  • 17
  • What's the mean for "`include only project and test project for calculating code coverage`"? Generally it can only filter the test assemblies, that means only the test project... – Andy Li-MSFT Oct 09 '18 at 09:20
  • I meant to calculate code coverage only for the project under test and the test project and I want to exclude all other DLLs from code coverage – DevMJ Oct 09 '18 at 09:25

1 Answers1

1

You can use Run settings file which is the configuration file used by unit testing tools. Advanced code coverage settings are specified in a .runsettings file.

You can exclude specified assemblies from code coverage analysis. For example:

<ModulePaths>
  <Exclude>
   <ModulePath>Fabrikam.Math.UnitTest.dll</ModulePath>
   <!-- Add more ModulePath nodes here. -->
  </Exclude>
</ModulePaths>

Then add the .runsettings file in source control, specify the file under Setting file area in Visual Studio Test task

Please see Customize code coverage analysis for details.

Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55