天蓝色管道的 Maven 故障安全给出错误

maven failsafe with azure pipeline gives error

我已经使用 Cucumber 创建了一个 api 测试项目。当我 运行 使用带有命令 mvn clean verify -P acceptanceTests 的 Intellij 项目时,它 运行 没问题。但是当我 运行 在 Azure 管道中使用它时,我收到了这个错误

Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:3.0.0-M5:verify (verify) on project com.test: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/vsts/work/1/s/target/failsafe-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/vsts/work/1/s && /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64/bin/java -javaagent:/home/vsts/.m2/repository/org/aspectj/aspectjweaver/1.9.1/aspectjweaver-1.9.1.jar @/home/vsts/work/1/s/target/surefire/surefireargs12930524259006620681 /home/vsts/work/1/s/target/surefire 2021-03-24T20-45-21_548-jvmRun1 surefire2852794554623212644tmp surefire_01307379121946876339tmp
[ERROR] Error occurred in starting fork, check output in log

这里是管道yml

trigger:
- master

pool:
  vmImage: ubuntu-latest

steps:
  
- task: JavaToolInstaller@0
  inputs:
      versionSpec: '11'
      jdkArchitectureOption: 'x64'
      jdkSourceOption: 'PreInstalled'

- task: Maven@3
  inputs:
    mavenPomFile: 'pom.xml'
    mavenOptions: '-Xmx3072m'
    #javaHomeOption: 'JDKVersion'
    #jdkVersionOption: '1.11'
    jdkArchitectureOption: 'x64'
    publishJUnitResults: true
    testResultsFiles: '**/failsafe-reports/*.dump'
    goals: 'clean verify -P acceptanceTests -e '

我试图搜索但找不到任何指示。我该如何调试呢?我试图通过上面的 '**/failsafe-reports/*.dump' 查看 .dump 文件,但我不确定如何或是否正确

经过一些故障排除后发现从 pom.xml 中删除 unwanted/unused 片段有助于解决上述错误。未使用的片段在本地没有引起任何问题,但在 azure.Also 中引起了上述错误,似乎错误不是因为实际测试中的问题。这是导致错误的片段

<properties>
 <property>
 <name>listener</name>
 <value>io.qameta.allure.junit5.AllureJunit5</value>
 </property>
 </properties>
 <argLine>
 -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
 </argLine>
 <systemProperties>
 <property>
 <name>allure.results.directory</name>
 <value>${project.basedir}/allure-results</value>
 </property>
 <property>
 <name>junit.jupiter.extensions.autodetection.enabled</name>
 <value>true</value>
 </property>
 </systemProperties>
 <reportFormat>plain</reportFormat> 

我认为您触及了我们目前正在修复的问题 bug,这是 Jira 问题的一部分 SUREFIRE-1881