Member-only story

Android test reporting with Github Actions

Andres Sandoval
3 min readMar 31, 2020

--

The tutorial shows how to retrieve Android Lint and Unit Tests output files results from GitHub actions. When we run Gradle tasks locally the results files reports get store locally in our machine, and when we run Gradle tasks on GitHub Actions (they run on remote machines). To retrieve the test results reports we need to add the Action Upload-artifact. With this action we upload the output build files to GitHub Artifacts.

Example android.yml file:

jobs:
test:
name: Run Unit Tests
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Unit tests
run: bash ./gradlew test --stacktrace
- name: Unit tests results
uses: actions/upload-artifact@v1
with:
name: unit-tests-results
path: app/build/reports/tests/testDebugUnitTest/index.html


lint:
name: Lint Check
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Lint debug flavor
run: bash ./gradlew lintDebug --stacktrace
- name: Lint results
uses: actions/upload-artifact@v1
with:
name: app
path: app/build/reports/lint-results-debug.html

Here is the main logic:

- name: Unit tests results (name)
uses: actions/upload-artifact@v1…

--

--

Andres Sandoval
Andres Sandoval

Written by Andres Sandoval

I'm a passionate Android Software Engineer with over 11 years of experience. andresand.github.io/andres-about-me/ buymeacoffee.com/andresand

No responses yet