2.1 KiB
title, description, keywords, author, ms.author, ms.topic, ms.service, ms.date, ms.assetid
| title | description | keywords | author | ms.author | ms.topic | ms.service | ms.date | ms.assetid |
|---|---|---|---|---|---|---|---|---|
| Run Included Tests with App Center | Tutorial to run a test using Android sample app with App Center. | app center | lucen-ms | lucen | article | vs-appcenter | 07/26/2017 | 7d2aa750-c7d0-47cb-acc8-97892bc78cf2 |
Run Included Tests with App Center
[!INCLUDE Retirement announcement for App Center]
Prerequisite
- Follow the getting started tutorial to set up the sample app.
Install App Center Command Line Interface
-
Install Node.js version 6.3 or later.
-
Open the terminal and run the command below to install the App Center CLI:
npm install -g appcenter-cli -
Run the command below and follow the directions to log in to App Center:
appcenter login
Build the project and test APK files
-
Open terminal and go to the project directory.
-
Run each of the following commands:
./gradlew assembleDebug ./gradlew assembleDebugAndroidTest
Prepare to run tests in App Center
-
Go to the Test service in App Center.
-
Click on Start testing your app.
-
Select the first device, the Google Pixel XL, and press Select one device at the bottom.
-
Choose Espresso as the Test framework.
-
Click Next.
Run the tests
-
In the Submit step, copy the custom command under Running tests.
-
Paste it into terminal while in the project directory.
Note
--app-pathshould point to a mobile app apk and--build-dirshould point to where the test apk is located at.
-
Navigate into sampleapp-android/app/build/outputs/apk.
-
Copy the pathname and replace the placeholder text
pathToEspressoBuildFolderin the custom command with the pathname text. -
Copy the pathname to app-debug-androidTest.apk and replace the placeholder text
pathToFile.apkin the custom command with the pathname text. -
Run the command. You'll see the tests begin to run.
-
In App Center, click Done to close the panel.