d10xa / gradle-allure-plugin

Gradle plugin generating Allure report from test results
Apache License 2.0
23 stars 2 forks source link

Gradle Allure Plugin

Download Build Status jitpack

Gradle Allure Plugin allows you to integrate Allure into spock, testng and junit tests.

Examples

Basic usage

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "ru.d10xa:gradle-allure-plugin:0.5.5"
    }
}

apply plugin: 'ru.d10xa.allure'

allure {
    aspectjweaver = true

    // Choose your test framework. 
    junit = true
    testNG = false
    spock = false

    // Choose if you're using Geb for web tests
    geb = true
}

Full configuration

allure {
    aspectjweaver = true

    junit = true
    testNG = false
    spock = false

    geb = false

    allureResultsDir = "$buildDir/allure-results"
    allureReportDir = "$buildDir/allure-report"

    allureVersion = "1.4.24.RC3"
    aspectjVersion = "1.8.9"
    allureSpockGebExtensionVersion = "0.2.1"
    allureJunitAspectjAdaptorVersion = "0.1.1"

    clean = true
}

Configuration

Tasks

allureReport

Creates html report for tests.

Add following snippet to build script if you want to create allure report after every test execution

tasks.withType(Test)*.finalizedBy allureReport

If you don't need this task(for example in child modules) - just delete it

tasks.remove allureReport

Customize task's parameters

allureReport {
    from(
            "${project(':moduleA').buildDir}/allure-results",
            "${project(':moduleB').buildDir}/my-allure-results",
    )
    to '$buildDir/nice-report'
}

Or create your own task

task customAllureReport(type: ru.d10xa.allure.AllureReportTask){
}

cleanAllureReport

Deletes directory declared in allureReportDir parameter

cleanTest or cleanYourOwnTest

Deletes the test results and allure results created by test or yourOwnTest task

License

This plugin is available under the Apache License, Version 2.0.