Front-End Web & Mobile

AWS CodePipeline adds support for AWS Device Farm as a test provider

AWS CodePipeline now supports AWS Device Farm as a test provider to deliver truly automated testing in your continuous integration and continuous delivery (CI/CD) pipeline.

In a previous blog post “Build a CI/CD Pipeline for Your Android App with AWS Services,” Vinay Selvaraj walked you through building a complete CI/CD pipeline using AWS CodeCommit, AWS CodeBuild, AWS Lambda, AWS Device Farm, and Amazon S3 (all triggered by a single code repository push).

In that solution, two Lambda functions were deployed-one to provision a Device Farm test project, and the other to kick off a Device Farm test on real devices. Now that Device Farm is fully integrated as a test provider for AWS CodePipeline, we can greatly improve on that solution.

In this article, we first walk you through adding Device Farm as a test provider directly into your build, test, and deployment pipeline using the CodePipeline console. We then run through building an entire CI/CD pipeline solution by using a single CloudFormation template. The template automates resource provisioning with Device Farm as a native test provider in the test stage of a CodePipeline pipeline.

Let’s go over the new addition to CodePipeline.

Add Device Farm as a test provider using the AWS CodePipeline console

Start by signing into the CodePipeline console.

If you don’t already have an existing CodePipeline pipeline created, follow these instructions to create one. Then follow the steps below to add Device Farm as a test provider.

1.     Select an existing pipeline from the CodePipeline Console.

2.     Choose Edit at the top of your existing pipeline

3.     Add a new stage in your pipeline and name your stage

4.     Choose Action. This opens a new window on the right half of the console.

5.     In the new action window, for Action Category, choose Test.

6.     Enter an Action name: (for example, TestOnRealDevices).

7.     For Test Provider, choose AWS Device Farm.

8.     For Project name, choose if you want to use an existing Device Farm test project or create a new one

Existing Device Farm test project

If you have an existing Device Farm test project, choose the project name from the dropdown and skip to step 10.

New Device Farm test project

You can create a new Device Farm project by choosing Create a new project. This directs you to the Device Farm console to provision a new project. After you create a new project via the Device Farm console, return here, hit the refresh button (located to the right of the Project name field), and then choose the newly created project name from the dropdown.

9.     Configure the remaining required and optional properties.

10.  Choose Add action to save this test stage.

Congratulations! You’ve successfully added Device Farm as a test provider to your CodePipeline stage using the console. You can now trigger the pipeline with a code push, and CodePipeline will integrate directly with Device Farm to test the complied app on real devices.

Resources

AWS Device Farm Developer Guide

AWS CodePipeline User Guide