dimanche 1 juillet 2018

Change the maven surefire reportsDirectory using command line

I'm looking to save generated reports into a custom location for each of my test suites(for example, ../target/api/surefire-reports, ../target/ui/surefire-reports)

I can do this by adding the below line in the pom.xml

<configuration>
  <reportsDirectory>${project.build.directory}/api/surefire-reports</reportsDirectory>

   <suiteXmlFiles>
     <suiteXmlFile>src/test/resources/api_testng.xml</suiteXmlFile>                        
   </suiteXmlFiles>
</configuration>

However, I want to use command line, and was trying this:

mvn clean test -Dsurefire.suiteXmlFiles=src\\test\\resources\\api_testng.xml -DreportsDirectory=${project.build.directory}\\apitests\\surefire-reports

but, it doesn't work and saves the reports in the usual ../target/surefire-reports folder, and doesn't throw any errors as well.

This is quite possible in maven surefire report plugin, like this

mvn surefire-report:report -DoutputDirectory=newpath

Does anyone know or have used the command line option to do this in surefire?

Aucun commentaire:

Enregistrer un commentaire