[英]Code Coverage with Visual Studio Test task
I have a project containing azure function implementations. 我有一个包含azure函数实现的项目。 My project .csproj file looks like below.
我的项目.csproj文件如下所示。
I haved added a test project for the same and implemented unit tests using Xunit. 我已经为Xunit添加了相同的测试项目,并使用Xunit实现了单元测试。 My test project .csproj looks like below.
我的测试项目.csproj如下所示。
I have added a Visual Studio Test task in my build definition with below configurations. 我在构建定义中使用以下配置添加了Visual Studio Test任务。
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. 高级代码覆盖率设置在
.runsettings
文件中指定。
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 然后在源代码管理中添加
.runsettings
文件,在Visual Studio Test任务的“ Setting file
区域下指定文件
Please see Customize code coverage analysis for details. 有关详细信息,请参见自定义代码覆盖率分析 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.