Page 29 - MSDN Magazine, December 15, 2017
P. 29
You’ll be prompted to authorize access for App Center. The per- missions allow App Center to clone repos and configure webhooks for triggering builds automatically. Select the app repository.
Instead of maintaining your own lab infrastructure, connect App Center to your source code repository and have it do builds for you.
Configure the build. App Center displays the branches of the repo. Select a branch to configure. App Center inspects the build files to determine what modules and build variants are available. Figure 1 shows the build configuration options. By default, a build is triggered whenever code is pushed to the branch.
You can trigger a build when saving the configuration to validate that things are set up correctly. The builds for a branch are listed, showing when the build was triggered, the commit messages, a build number and the build status. The status is first set to queued until assigned to a host, when it changes to building. The build will complete with a status of canceled, failed or succeeded.
While the build is running, you can monitor the build output in real time. After the build completes, you have the option to down- load the logs or the build application package. App Center builds can run unit tests and static code analysis (lint). The build will fail if the unit tests fail or linting reports errors.
Sign the build. Before a build can be installed and run on a device, it must be signed. You can have the keystore in the repo with passwords checked in to gradle files. I don’t like or recom- mend putting credentials in sources, so I uploaded the keystore and credentials separately.
Launch test. App Center build provides the option to test on a real device. This can be enabled without providing your own signing details. The test cloud infrastructure requires that the application have Internet permissions. If you haven’t already declared the per-
mission, add the following line to your AndroidManifest.xml:
<uses-permission android:name= "android.permission.INTERNET" />
App Center will sign and deploy the app to a real device and per- form a basic launch test to ensure that the application package can be installed and run.
Test
Test in the cloud, on real devices. Testing your app locally on an emu- lator is different than running it on a real device. App Center can deploy your tests, along with your application, to real devices. It cap- tures screenshots at the test steps you define, and provides complete logs of the test run. This gives you access to thousands of device con- figurations (a specific device model with a specific version of the OS).
Define device sets. Devices in App Center are classified into three tiers according to their popularity. App Center maintains more of the tier 1 devices. Devices are moved from tier 1 to tier 2, and eventually to tier 3. When tests execute, wait times for lower-tier devices may be longer than wait times for tier 1.
Test runs are executed against a collection of devices. In the Test area, click on Device Sets to manage
Dec. 15, 2017 / Connect(); Special Issue 25
Figure 1 Build Configuration msdnmagazine.com