I have a project containing azure function implementations. My project .csproj file looks like below.
I haved added a test project for the same and implemented unit tests using Xunit. My test project .csproj looks like below.
I have added a Visual Studio Test task in my build definition with below configurations.
How can I include only project and test project for calculating code coverage?
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.