我试图在light4j的主版本(https://github.com/networknt/light-4j)上运行PITest,该项目是我随机选择或多或少地尝试在真实世界代码上试用PITest的项目。

除light4j的“古代”模块外,该测试在大多数模块上均能顺利完成。跑步时

mvn -X test org.pitest:pitest-maven:mutationCoverage


在light-4j / client文件夹中,正常的单元测试运行完成(所有测试都可以,已跳过3个测试),但是PITest似乎没有生成并执行突变。最后的消息是

[INFO] Adding org.pitest:pitest to SUT classpath
[INFO] Mutating from /Users/jan/dev/inno/light-4j/client/target/classes
[INFO] Defaulting target classes to match packages in build directory
/-\|/-\|/-\|/-\|/-stderr  : WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.xnio.nio.NioXnio$2 (file:/Users/jan/.m2/repository/org/jboss/xnio/xnio-nio/3.3.8.Final/xnio-nio-3.3.8.Final.jar) to constructor sun.nio.ch.KQueueSelectorstderr  : Provider()
WARNING: Please consider reporting this to the maintainers of org.xnio.nio.NioXnio$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in astderr  :  future release


在那之后什么也没有发生。

light4j的正常构建成功完成。

可能是什么问题呢?

[编辑于2020年2月5日:
我已经分叉了light4j存储库:https://github.com/jvermeir/light-4j
然后,我执行了常规构建mvn clean install,因此所有工件都在本地maven存储库中。
接下来,我在light4j项目的根级别更改pom.xml,添加

<plugin>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>1.4.10</version>
    <dependencies>
<!--                    <dependency>-->
<!--                        <groupId>org.pitest</groupId>-->
<!--                        <artifactId>pitest-junit5-plugin</artifactId>-->
<!--                        <version>0.10</version>-->
<!--                    </dependency>-->
    </dependencies>
</plugin>


在构建部分
最后,我从客户端文件夹mvn -X test org.pitest:pitest-maven:mutationCoverage > ../buildlog.txt启用了PiTest来执行测试。
这将生成一个build.txt文件,但还会在终端中显示几行:

17:10:30 PIT >> INFO : Verbose logging is disabled. If you encounter a problem, please enable it before reporting an issue.
17:10:30 PIT >> INFO : Sending 147 test classes to minion
17:10:30 PIT >> INFO : Sent tests to minion
17:10:30 PIT >> INFO : MINION : 17:10:30 PIT >> INFO : Checking environment

17:10:32 PIT >> INFO : MINION : 17:10:32 PIT >> INFO : Found  18 tests

17:10:32 PIT >> INFO : MINION : 17:10:32 PIT >> INFO : Dependency analysis reduced number of potential tests by 0

17:10:32 PIT >> INFO : MINION : 17:10:32 PIT >> INFO : 18 tests received

17:10:33 PIT >> INFO : MINION : WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.powermock.reflect.internal.WhiteboxImpl (file:/Users/jan/.m2/repository/org/powermock/powermock-reflect/2.0.2/powermock-reflect-2.0.2.jar) to method java
17:10:33 PIT >> INFO : MINION : .lang.Object.clone()
WARNING: Please consider reporting this to the maintainers of org.powermock.reflect.internal.WhiteboxImpl
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access
17:10:33 PIT >> INFO : MINION :  operations will be denied in a future release

17:11:24 PIT >> INFO : MINION : 17:11:24 PIT >> WARNING : More threads at end of test (46) com.networknt.client.Http2ClientTest than start. (5)

17:11:24 PIT >> INFO : Calculated coverage in 54 seconds.
17:11:25 PIT >> INFO : Created  92 mutation test units


build.txt的结尾看起来像这样:

[INFO] Adding org.pitest:pitest to SUT classpath
[INFO] Mutating from /Users/jan/dev/inno/light4jfork/light-4j/client/target/classes
[INFO] Defaulting target classes to match packages in build directory
-stderr  : WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.xnio.nio.NioXnio$2 (file:/Users/jan/.m2/repository/org/jboss/xnio/xnio-nio/3.3.8.Final/xnio-nio-3.3.8.Final.jar) to constructor sun.nio.ch.KQueueSelectorstderr  : Provider()
WARNING: Please consider reporting this to the maintainers of org.xnio.nio.NioXnio$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in astderr  :  future release

最佳答案

我尝试过同样的方法,它在客户端模块处停止。我只是想知道我们是否应该将pitest-maven插件添加到pom.xml中

[INFO] Mutating from /home/steve/networknt/light-4j/client/target/classes
[INFO] Defaulting target classes to match packages in build directory
7:35:54 p.m. PIT >> INFO : Verbose logging is disabled. If you encounter a problem, please enable it before reporting an issue.
7:35:54 p.m. PIT >> INFO : Sending 147 test classes to minion
7:35:54 p.m. PIT >> INFO : Sent tests to minion
7:35:54 p.m. PIT >> INFO : MINION : 7:35:54 p.m. PIT >> INFO : Checking environment

7:35:55 p.m. PIT >> INFO : MINION : 7:35:55 p.m. PIT >> INFO : Found  18 tests

7:35:55 p.m. PIT >> INFO : MINION : 7:35:55 p.m. PIT >> INFO : Dependency analysis reduced number of potential tests by 0

7:35:55 p.m. PIT >> INFO : MINION : 7:35:55 p.m. PIT >> INFO : 18 tests received

7:35:56 p.m. PIT >> INFO : MINION : WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.powermock.reflect.internal.WhiteboxImpl (file:/home/steve/.m2/repository/org/powermock/powermock-reflect/2.0.2/powermock-reflect-2.0.2.jar) to method jav
7:35:56 p.m. PIT >> INFO : MINION : a.lang.Object.clone()
WARNING: Please consider reporting this to the maintainers of org.powermock.reflect.internal.WhiteboxImpl
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal acces
7:35:56 p.m. PIT >> INFO : MINION : s operations will be denied in a future release

10-05 22:10