Jul 15, 2020

AWS CodeBuild Test Reports for Gradle builds

Although AWS documentation has instructions for adding Test Reports for a maven build they currently lack instructions for a gradle build.

You can find the maven instructions here: https://aws.amazon.com/blogs/devops/test-reports-with-aws-codebuild/

Assuming you have your gradle wrapper in your code commit repository, you just need to update two sections in your buildspec.yml

First, update your buildspec.yml to call the gradlew test by changing the “phases -> builds -> commands” to “bash ./gradlew test”.

Second, update the buildspec.yml to where gradle stores the test reports by changing “reports -> ReportGroupName -> base-directory” to “build/test-results”.

Here is an example of a buildspec.yml with the updates.

version: 0.2
phases:
  build:
    commands:
      - bash ./gradlew test
reports: #New
  TestReports: # CodeBuild will create a report group called "TestReports".
    files: #Store all of the files
      - '**/*'
    base-directory: 'build/test-results' # Location of the reports
cache:
  paths:
    - '/root/.gradle/**/*'

About the Author

Scott Bock profile.

Scott Bock

Principal Technologist

Scott is a Senior Software Engineer with over 12 years of experience using Java, and 5 years experience in technical leadership positions. His strengths include troubleshooting and problem solving abilities, excellent repertoire with customers and management, and verbal and written communication. He develops code across the entire technology stack including database, application, and user interface.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Blog Posts
Planning an Apache Airflow Deployment
This is part one of a five-part series addressing Airflow at an enterprise scale. I will update these with links as they are published. Airflow: Planning a Deployment Apache Airflow is a platform for authoring, […]
Rockstar Development
This originally appeared on Marty Henderson’s personal blog Or, how to use Gitpod and GitLab so that no one else has to care about your questionable coding language choices. A true rockstar has a good […]
Testing a Quarkus Kafka Application
Quarkus, a “Kubernetes Native Java stack,” enables lighter Java applications with faster startup times. In a recent post, I talked about scaling Kafka consumers in Kubernetes. Quarkus applications fit right into this picture because they […]
Gitpod and Hringvegurinn
Iceland Ever seen an advertisement for visiting Iceland? Have you noticed that they all mention Hringvegurinn or the Ring Road, as a good tour? (If you haven’t seen a tour ad for Iceland, Steindi Jr […]