better-android-junit-report-aggregator elegantly consolidates JUnit XML test results across multi-module, multi-project Gradle architectures in Android projects. It solves the challenge of collecting and accessing distributed test reports in complex build systems without modifying your existing test infrastructure.
- Seamless Multi-Module Collection: Automatically discovers and aggregates test results from all modules
- Centralized Access: Creates a single consolidated location for all test results
- CI/CD Integration: Simplifies test outcomes for popular CI systems (GitHub Actions, CircleCI, Jenkins)
Add to your root build.gradle:
plugins {
id("io.github.bhargavms.junit.better-aggregator") version "1.0.0"
}
Or using the legacy syntax:
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath "io.github.bhargavms.junit.better-aggregator:io.github.bhargavms.junit.better-aggregator.gradle.plugin:1.0.0"
}
}
apply plugin: "io.github.bhargavms.junit.better-aggregator"
After applying the plugin, run your tests as normal:
./gradlew test
Then, run the aggregation task:
./gradlew aggregateJUnitReports
This will collect all JUnit XML reports into the outputDir
directory that you configured.
Configure the plugin in your root build.gradle:
betterAggregator {
// Output directory (relative to root project)
outputDir.set("${project.getLayout().buildDirectory.dir("aggregated-reports").get().asFile.absolutePath}")
}
For GitHub Actions:
- name: Run tests
run: ./gradlew test
- name: Aggregate test reports
run: ./gradlew aggregateJUnitReports
- name: Upload test reports
uses: actions/upload-artifact@v2
with:
name: test-reports
# If using the outputDir configuration as defined in this README
path: build/reports/aggregated-junit-reports
Create a task that depends on test execution and report aggregation:
tasks.register("testAndAggregate") {
dependsOn("test", "aggregateJUnitReports")
group = "Verification"
description = "Runs tests and aggregates all reports"
}
- Gradle: 7.0+
- Kotlin: 1.5.0+
- Android Gradle Plugin: 4.1.0+
- Java: 8+
The plugin:
- Scans your project structure to identify modules
- Searches for JUnit XML reports in configured directories
- Copies and organizes reports in the output directory
- Generates a consolidated overview of test results
- Run the aggregation task after all tests complete
- Include the task in your CI pipeline
- Consider adding the output directory to your .gitignore file
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Ensure you follow conventional commits
Commit your changes (
git commit -m 'feat: Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the Apache 2.0 - see the LICENSE file for details.
Developed by Bhargav Mogra.