azuremavenazure-devopsmaven-failsafe-plugin

maven failsafe with azure pipeline gives error


I have created an api test project using cucumber. When I run project using Intellij with command mvn clean verify -P acceptanceTests it runs fine. But when I am running it in azure pipeline I am receiving this error

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

Here is pipeline 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 '

I tried to search but couldnt find any pointers. How can I debug this? I was trying to see the .dump file through '**/failsafe-reports/*.dump' above but I am not sure how to or if it is the right way


Solution

  • After some troubleshooting found that removing unwanted/unused snippet from pom.xml helped resolve above error. The unused snippet was not causing any issue in local but was causing the above error in azure.Also , it seems that error was not because of issue in actual tests. This was the snippet causing the error

    <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>