maven 编译执行测试用例,maven-surefire-plugin失效
maven-surefire-plugin失败
问题
[ERROR] There are test failures.
Please refer to /jenkins/workspace/da_allure/DaQsAITest/target/surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was /bin/sh -c cd /jenkins/workspace/da_allure/DaQsAITest && /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/java -javaagent:/root/.m2/repository/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar -jar /jenkins/workspace/da_allure/DaQsAITest/target/surefire/surefirebooter5479186166840390552.jar /jenkins/workspace/da_allure/DaQsAITest/target/surefire 2021-03-09T23-52-08_553-jvmRun1 surefire3606636428335013990tmp surefire_06822399092109765018tmp
Error occurred in starting fork, check output in log
Process Exit Code: 1
org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was /bin/sh -c cd /jenkins/workspace/da_allure/DaQsAITest && /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/java -javaagent:/root/.m2/repository/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar -jar /jenkins/workspace/da_allure/DaQsAITest/target/surefire/surefirebooter5479186166840390552.jar /jenkins/workspace/da_allure/DaQsAITest/target/surefire 2021-03-09T23-52-08_553-jvmRun1 surefire3606636428335013990tmp surefire_06822399092109765018tmp
Error occurred in starting fork, check output in log
在网上搜了好多相关资料,都说让关闭编译时测试遇到问题,继续编译
我想,也都是开发吧,根本就是跳过问题,没有正式问题呀。而我作为一名测试,必须要改掉这个问题啊。
网上是这个解决的,找了好多
pom.xml的 maven-surefire-plugin中增加,但是没有解决我的问题
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<configuration>
我的解决 :增加
<argLine>
-Xmx1024m -XX:MaxPermSize=256m
</argLine>
pom.xml中,整体展示如下
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<argLine>
-Xmx1024m -XX:MaxPermSize=256m
</argLine>
<systemProperties>
<property>
<name>junit.jupiter.extensions.autodetection.enabled</name>
<value>true</value>
</property>
<!--设置生成allure报告到存放路径下 ,target/allure-results -->
<property>
<name>allure.results.directory</name>
<value>${project.build.directory}/allure-results</value>
</property>
</systemProperties>
</configuration>
</plugin>
##分析:
-Xmx1024m:-Xmx 是最大堆的大小 1024m
XX:MaxPermSize=256m :设置持久代大小为256m
由于我的jenkins搭建在服务器,是虚拟机,内存2G,硬盘50G
可能是运行java时,占用的堆内存不够用,或者说无法达到标配?
所以运行命令中,增加以上参数,可能会硬性分配,这样就可以通过了