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<span class="token operator">:</span> <span class="token number">0.2</span>
phases<span class="token operator">:</span>
  build<span class="token operator">:</span>
    commands<span class="token operator">:</span>
      - bash ./gradlew test
reports<span class="token operator">:</span> #New
  TestReports<span class="token operator">:</span> # CodeBuild will create a report group called <span class="token string">"TestReports"</span>.
    files<span class="token operator">:</span> #Store all of the files
      - '**/*'
    base-directory<span class="token operator">:</span> 'build/test-results' # Location of the reports
cache<span class="token operator">:</span>
  paths<span class="token operator">:</span>
    - '/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.

Related Blog Posts
Natively Compiled Java on Google App Engine
Google App Engine is a platform-as-a-service product that is marketed as a way to get your applications into the cloud without necessarily knowing all of the infrastructure bits and pieces to do so. Google App […]
Building Better Data Visualization Experiences: Part 2 of 2
If you don't have a Ph.D. in data science, the raw data might be difficult to comprehend. This is where data visualization comes in.
Unleashing Feature Flags onto Kafka Consumers
Feature flags are a tool to strategically enable or disable functionality at runtime. They are often used to drive different user experiences but can also be useful in real-time data systems. In this post, we’ll […]
A security model for developers
Software security is more important than ever, but developing secure applications is more confusing than ever. TLS, mTLS, RBAC, SAML, OAUTH, OWASP, GDPR, SASL, RSA, JWT, cookie, attack vector, DDoS, firewall, VPN, security groups, exploit, […]