Allure framework can help with generating HTML reports for your Selenium WebDriver projects.
The reporting framework is very flexible and it works with many programming languages and unit testing frameworks.
You can read everything about it at http://allure.qatools.ru/.
JUNIT does not provide any HTML reports by default
If you use JUNIT for running your test automation scripts,everything that you get is a visual report of the test results.
This visual report is GREEN if all the test scripts pass and RED if at least one test script fails.
For each test script, the execution status (pass/fail) is displayed, together with the execution time and details of the error.
The problems with this visual report are that
- it cannot be saved
- the amount of information that it includes is very limited
- it is not possible to see over time how the test scripts run
The Allure framework has solutions for all these problems
– detailed report for a test suite
– graphical reports
See more report templates on this link:
http://ci.qatools.ru/job/allure-core_master-deploy/lastSuccessfulBuild/Allure_report/
How can you get these great reports for your WebDriver test scripts?
It is quite easy to add the Allure framework to your WebDriver project.
1. Create a Maven project in Eclipse
After creating the Maven project, the project structure will be as follows:
2. Add the class files to the proper folders
The page object classes should be in the Src/Main/Java folder.
The test script classes should go to the Test/Java folder.
3. Configure the POM xml file
The POM file is very straightforward:
<project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”>
<modelVersion>4.0.0</modelVersion>
<groupId>com.siminiuc</groupId>
<artifactId>MavenProject</artifactId>
<version>0.0.1</version>
<name>Maven Project</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.47.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<fork>true</fork>
<source>1.7</source>
<target>1.7</target>
<executable>C:\JDK\bin\javac.exe</executable>
</configuration>
</plugin>
</plugins>
</build>
</project>
It includes dependencies for JUNIT and Selenium Firefox driver and a plugin for the maven compiler.
4. Run the test scripts
Run the test scripts using maven test:
The execution results are displayed in the console tab:
5. Add Allure framework details to the POM file
The POM file changes a bit after adding the Allure details.
I have highlighted with italic all changes:
<project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”>
<modelVersion>4.0.0</modelVersion>
<groupId>com.siminiuc</groupId>
<artifactId>MavenProject</artifactId>
<version>0.0.1</version>
<name>Maven Project</name>
<url>http://maven.apache.org</url>
<properties>
<aspectj.version>1.8.5</aspectj.version>
<allure.version>1.4.11</allure.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.47.1</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-junit-adaptor</artifactId>
<version>${allure.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<fork>true</fork>
<source>1.7</source>
<target>1.7</target>
<executable>C:\JDK\bin\javac.exe</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
– javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argLine>
<properties>
<property>
<name>listener</name>
<value>
ru.yandex.qatools.allure.junit.AllureRunListener
</value>
</property>
</properties>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.10.v20150310</version>
<configuration>
<webAppSourceDirectory>
${project.build.directory}/site/allure-maven-plugin
</webAppSourceDirectory>
<stopKey>stop</stopKey>
<stopPort>1234</stopPort>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</reporting>
</project>
6. Run the test scripts in Command Prompt
7. Generate the report by running mvn site in the Command Prompt
The Allure report can be found on the following location:
C:\Users\home\workspace\AllureProject\target\site\allure-maven-plugin
The report can be displayed in the browser by double-clicking the index.html file:
You must be logged in to post a comment.