Android Allure Plugin¶
This library comes with an Allure plugin that can be used to generate test reports based on the metadata collected through each test execution.
Setup¶
Add the plugin to your project:
Generating reports¶
A test report is automatically generated when connectedDebugAndroidTest
is executed if you're
using InstrumentedReportRule
from here
After each test execution, the plugin will generate the allure results at:
Then just run allure serve
or allure generate
to generate the reports and you should see something like this:
The following attachments are included out of the box for every failure:
- Screen recording
- Screenshot immediately after failure
- View hierarchy dump
- Logcat during test execution
Configuration options¶
To customize the plugin use the following:
allureReport {
/**
* By default, logcat files are not included if the test passes
*/
attachLogcatOnSuccess = false
/**
* The report output path.
* Can be used to merge reports of multiple modules by using the same directory
* Null means `built/outputs/allure-results` is used
*/
outputDir = null
}
Multi-module results¶
You can aggregate all test reports by defining the outputDir
option for the plugin.
Place this in your root project build.gradle
file:
subprojects {
/**
* Move all allure-results to the same directory,
* so that all tests from the project are seen in a single report
*/
plugins.withId("com.rubensousa.carioca.report.allure") {
extensions.getByType(AllureReportExtension::class).apply {
outputDir = rootProject.file("build/outputs/allure-results")
}
}
}
This will move all test reports of all modules with the plugin to the same build/outputs/allure-results
in your root
project
Sample¶
The sample project in the official repository contains a few examples for some reports