Code Coverage with Visual Studio Test task

670 Views Asked by At

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?

1

There are 1 best solutions below

0
On BEST ANSWER

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.