What is Allure Report?

HOME

Allure Framework is a flexible lightweight multi-language test report tool that not only shows a very concise representation of what have been tested in a neat web report form, but allows everyone participating in the development process to extract maximum of useful information from everyday execution of tests.

How Allure Report is generated?

Allure is based on standard xUnit results output but adds some supplementary data. Any report is generated in two steps. During test execution (first step), a small library called adapter attached to the testing framework saves information about executed tests to XML files. We already provide adapters for popular Java, PHP, Ruby, Python, Scala and C# test frameworks. During report generation (second step), the XML files are transformed to a HTML report. This can be done with a command line tool, a plugin for CI or a build too.

Similarly, when we run our tests, every popular test framework generates junit-style xml report or testng style which will be used by Allure to generate HTML report.

In the below example, we use maven surefire plugin which automatically generates xml test reports and stored in target/surefire-reports. And these XML files are transformed to an HTML report by Allure.

Allure reports has provided adapters for Java, PHP, Ruby, Python, Scala and C# test frameworks.

Allure report has below mention annotation.

@Epic
@Features
@Stories/@Story

We can add Epic, Feature and Stories annotations to the test to describe the behaviour of the test.

@Severity(SeverityLevel.BLOCKER)@Severity annotation is used in order to prioritize test methods by severity.

@Description(“Regression Testing”) – We can add detailed description for each test method. To add such description use @Description annotation.

@Step – In order to define steps in Java code, you need to annotate the respective methods with @Step annotation. When not specified, the step name is equal to the annotated method name.

@Attachment – An attachment in Java code is simply a method annotated with @Attachment that returns either a String or byte[], which should be added to the report.

@Link – We can link the tests to Defect Tracker or JIRA Ticket.

Below is an example which shows how to use various Allure Annotations in the Test.

@Epic("Web Application Regression Testing")
@Feature("Login Page Tests")
@Listeners(TestExecutionListener.class)
public class LoginTests extends BaseTest {

	LoginPage objLogin;
	DashboardPage objDashboardPage;

	@Severity(SeverityLevel.NORMAL)
	@Test(priority = 0, description = "Verify Login Page")
	@Description("Test Description : Verify the title of Login Page")
	@Story("Title of Login Page")
	public void verifyLoginPage() {

		// Create Login Page object
		objLogin = new LoginPage(driver);

		// Verify login page text
		objLogin.verifyPageTitle();
	}
}

Install Allure

For Windows, Allure is available from the Scoop commandline-installer.

Set-ExecutionPolicy RemoteSigned -scope CurrentUser

Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')

To install Allure, download and install Scoop and then execute in the Powershell:

scoop install allure

I have allure installed, so I’m getting a message – ‘allure’ (2.14.0) is already installed.

To check if you have Allure installed or not, please use the below command in command line or Powershell.

allure --version

Sample Allure Report

You can find more information on Allure documentation.

Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!! 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s