code-coverage - PIT 测试 - 需要从报告中排除某些包

标签 code-coverage mutation pitest

我正在尝试生成 PIT 测试覆盖率报告,我需要排除某个包。
这些是使用的配置:

<plugin>
                        <groupId>org.pitest</groupId>
                        <artifactId>pitest-maven</artifactId>
                        <version>1.3.0</version>
                        <configuration>
                            <targetClasses>
                                <param>test.presentation.*</param>
                                <param>test.service.impl.*</param>
                            </targetClasses>
                            <targetTests>
                                <param>test.App.ServletInitializerTest</param>
                                <param>test.presentation.AuthenticationControllerTest</param>
                                <param>test.service.impl.AuthenticationServiceImplTest</param>
                            </targetTests>
                            <excludedClasses>
                                <param>test.security.AuthenticationSecurityServiceImpl</param>
                                <param>test.security.TokenAuthenticationFilter</param>
                                <param>test.security.TokenInfo</param>
                                <param>test.security.TokenManagerImpl</param>
                            </excludedClasses>
                            <excludedTestClasses>
                                <param>test.security.AuthenticationSecurityServiceImplTest</param>
                            </excludedTestClasses>
                            <excludedMethods>
                            <param>test.service.impl.AuthenticationServiceImpl.userAuthentication</param>
                            </excludedMethods>
                            <avoidCallsTo>
                            <avoidCallsTo>test.service.impl.AuthenticationServiceImpl</avoidCallsTo>
                            <avoidCallsTo>test.security.*</avoidCallsTo>
                            </avoidCallsTo>
                        </configuration>
                    </plugin>

但是我的报告仍然显示了 test.security.* 包和 test.service.impl.AuthenticationServiceImpl.userAuthentication 方法的覆盖率。

如何在覆盖率报告中跳过此包和方法?

最佳答案

您应该能够从变异中排除 test.security.*

<excludedClasses>
 <param>test.security.*</param>
</excludedClasses>

您在 avoidCallsTo 中的条目将防止对调用 test.security.* 中的方法的其他包中的代码行进行更改

关于code-coverage - PIT 测试 - 需要从报告中排除某些包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49876797/

相关文章:

java - 当前项目和插件组中的 Maven PITest 错误 "No plugin found for for prefix ' org.pitest'

javascript - 从 contenteditable div 中获取已删除的节点(Froala Editor)

couchbase - 使用 mutate_in 将子文档更新为列表

testing - 突变测试中的耦合效应是什么?

python - sphinx、buildbot(和代码覆盖率)。他们如何整合?

python - 如何改变/修改实例属性?

python - 如何知道 django 应用程序的覆盖率?

java - lambda 函数的代码覆盖率

node.js - 如何在不修改源代码的情况下获得 Mocha 测试的代码覆盖率?