gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 13:21:12 24 4
gpt4 key购买 nike

我正在尝试生成 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com