Configure Microsoft Visual Studio Team Services to build and run unit tests against the Android application

Reading This Manual

Copying all content from this file and pasting it at https://jbt.github.io/markdown-editor/ will not display images and gif animations since they are stored locally within the repository. It is strongly recommended to read this document inside Atom text editor using Ctrl + Shift + M to display the rendered preview.

Introduction

Configure Microsoft Visual Studio Team Services to build and run unit tests against the Android application.

1. Setting up your workspace

Make sure to read working-with-VSTS-personal-branches manual first to configure your personal VSTS.

2. Configuring Unit Tests

Go to the Build and Release -> Build -> All Definitions -> Gated Build -> Edit.

We’ll need to tell VSTS how to run unit tests. Click on Add Task and search for Gradle and click Add.

Select the newly added task and look for the Tasks text field. In the field, replace build with a test.

VSTS can now run the .\gradlew test command which will run the tests added in task #331.

Click Save & queue -> Save.

3. Queue a build

Go to the Build and Release -> Build -> All Definitions -> Gated Build. Click Queue new build. Choose your branch from the Branch drop-down. Click Queue.

4. After the build is done,

You should see a build status and logs of the tests it ran.

If the test was successful, you will need to go to ./app/build/reports/tests/testDebugUnitTest/index.html to see the result.

Author: Nahom Abi

Leave a Comment