Popular Posts

Saturday, November 28, 2009

Selenium test reporting with maven surefire report plugin

If you are familiar with Junit, you may have already known the maven surefire plugin which enables running unit test inside maven build cycles. Normally, surefire plugin generates the XML test reports at /target/surefire-reports directory. If you use selenium RC integrated with your build system or as a separate test framework, you may use maven-selenium-plugin coupled with the surefire plugin to launch your tests.
As far as I know, there are two ways to generate test reports when selenium is coupled with maven.

1. Use LoggingSelenium java library to generate HTML test reports with screenshots

2. Use maven-surefire-report plugin

This post is about the latter one, maven-surefire-report plugin.

The default configuration of surefire-report-plugin is trivial. You just need to add a <reporting> element to projects' pom.xml as follows.

<reporting>
<plugins>
<plugin>

<groupId>org.apache.maven.plugins</groupId> <
<configuration>

<outputDirectory>${basedir}/target/wso2qa</outputDirectory>

</configuration>

</plugin>
</plugins>

</reporting>


When you run mvn surefire-report:report goal after running the tests, HTML based descriptive report will be created at the specified output directory. In this mechanism, you do not use anything specific to selenium,but get the advantage of surefire report plugin in test reporting.

No comments: