Simple Allure 2 configuration for Gradle

Aliaksandr Rasolka
2 min readMay 11, 2018


From many time past it’s easy to configure allure with Gradle

“Green plants covering the walls of a multi-story building” by 贝莉儿 NG on Unsplash

For first you need to apply allure gradle plugin. I’m using latest gradle version so let’s use new plugin applying mechanism.

plugins {
id 'io.qameta.allure' version '2.8.1'

Next step will be about configuration. In my test I’m using Junit5 and I want to use latest allure version so I’ll manually pass latest version in config and also I have to use custom download link format to get a latest version of allure commandline.

allure {
version = '2.14.0'

Last but not least — tools integration. There are many of integration, I’m showing my set:

  1. Junit5
  2. Selenide
  3. Retforit/Okhttp

I’m going to apply this integration as dependencies.

Retforit/Okhttp. I’m using implementation scope because it’s required some code changes to work property:

dependencies {

Code changes — it’s just additional Okhttp client interceptor:

final AllureOkHttp3 allureOkHttp3 = new AllureOkHttp3();final OkHttpClient okHttpClient = new OkHttpClient.Builder()

Junit5 integration isn’t required any code changes, just place it in right scope, use testRuntimeOnly scope for that:

dependencies {

That’s all.

Selenide integration also required some code changes, but lets apply testImplementation scope because it’s required only SelenideLogger listener registration that can be done before tests:

dependencies {

Code changes — add listener on BeforeAll step:

public void setUp() {
SelenideLogger.addListener("allure", new AllureSelenide());

And don’t forget to remove listener after tests. Let’s do it on AfterAll step:

public void tearDown() {

I’m also advise to create allure property file and point results directory to avoid miss target results creation. I’m place it inside src/test/resources folder and call it and add content:

Great! Now you’re all done.

From now you just need to execute your test and after tests run gradle task allureReport that creates Allure report or allureServethat creates Allure report and opens it in the default browser.

Happy testing! D_D

You can find complete project on GitHub.



Aliaksandr Rasolka

Backend Developer | Automation QA from Belarus