开发者

Send test reports to different directory using maven-surefire-plugin

I want to generate my reports so I used maven-surefire-plugin.

This is my pom.xml:

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<executions> 
<execution> 
 <id>test-reports</id> 
    <phase>install</phase> 
    <configuration> 
      <tasks> 
<junitreport todir="./reports">
<fileset dir="./reports">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="./report/html"/>
</junitreport>
</tasks> 
    </configuration> 
    <goals> 
      <goal>test </goal> 
    </goals> 
  </execution> 
</executions> 
</plugin>

But I'm getting this error when I run maven test:

 Tests run: 6, Failures: 2, Errors: 2, Skipped: 0
 [INFO] --------------------------------------------------------------------
 [INFO] BUILD FAILURE
 [INFO] --------------------------------------------------------------------
 [INFO] Total time: 10.403s
 [INFO] Finished at: Wed Oct 12 08:35:10 CEST 2011
 [INFO] Final Memory: 17M/126M
 [INFO] --------------------------------------------------------------------
 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-      plugin:2.10:test (default-test) on project jebouquine: There are test failures.
 [ERROR] 
 [ERROR] Please refer to C:\Users\Amira\workspace1\jebouquine\target\surefire-reports for the individual test results.
 [ERROR] -> [Help 1]
 [ERROR] 
 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
 [ERROR] 
 [ERROR] For more information about the errors and possible solutions, please read the following articles:
 [ERROR] [Help 1]       http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

When I open C:\Users\Amira\workspace1\jebouquine\target\surefire-reports I find repotrts but I want them under ./reports.

Any idea how to do it? Or is there any a开发者_高级运维lternative to generate my tests reports?


Look, here's the bottom line: you need to read more about Maven because what you have written does not make sense. You have tried to stuff ant configuration elements into the surefire plugin config, which is not right at all. And you have tried to bind it to the install phase, but then you are running mvn test.

Finally, it might help if you explained why you want them in a different directory in the first place ... there might be a better way to achieve your real goals.

However, this will fix your problem for the next 5 seconds or so:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.10</version>
  <configuration>
    <reportsDirectory>${project.build.directory}/reports</reportsDirectory>
  </configuration> 
</plugin>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜