Page 32 - MSDN Magazine, December 15, 2017
P. 32
appcenter test run espresso --app "mattgibbs/Hello-App-Center" --devices "mattgibbs/latest-android" --app-path app\\build\\outputs\\apk\\debug\\app- debug.apk --test-series "main-activity" --locale "en_US" --build-dir app\\ build\\outputs\\apk\\androidTest\\debug
The CLI performs the upload, then lists the devices to be used for the test run. As the tests are deployed to devices, it polls the API for the test run to show progress.
The SDK provides a method for simulating a crash, making it easy to test the integration and see how the crash reporting works.
Distribute
App Center helps you distribute your app to testers and beta users before submitting it to an app store for public release. To install on iOS devices, you must first register the device with your Apple developer account and add it to a provisioning profile. When the app is signed based on that provisioning profile, it can be installed on those devices. Attempting to install it on another device will fail. App Center streamlines the process of gathering the neces- sary device identifiers from testers, performing the registration and signing. Android apps do not require the extra device regis- tration step prior to signing.
Apps are shared with a distribution group. A Collaborators dis- tribution group is automatically populated with all the users that have been added to the app as a Manager, Developer or Viewer. Distribution groups can also include
Crash Reporting
You can enable your app to send crash errors to App Center. The crashes are processed to identify groups of the same type of crash. The stacktrace helps you identify where in the source code the crash is occurring. The App Center SDK is modular, so that you can avoid adding overhead to your app for SDK functionality you aren’t using. The SDKs have been open sourced on github.com in the Microsoft organization. To integrate App Center into your app, update the dependencies section of the build.gradle file for your app to include the following:
def appCenterSdkVersion = '1.0.0'
compile "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
Update the onCreate method of your MainActivity to call the start method of AppCenter. One of the arguments is the application key provided by App Center. You can see it in the Settings page for the app. Additionally, you pass references to the modules you want to use. In this example, I’m enabling Crash reporting and App Center Analytics:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanseState);
AppCenter.start(getApplication(), appSecret:”your-app-key”, Analytics. class, Crash.class);
}
Crashes aren’t sent immediately when the crash happens. The data is collected and sent when the user next launches the app. This allows you to customize the SDK behavior if you want to present the user with more information about crash reporting and get user consent to send additional data. You don’t need to build special code to crash your app deliberately. The SDK provides a method for simulating a crash, making it easy to test the integration and see how the crash reporting works.
Crashes.generateTestCrash();
testers invited by e-mail address. When you add a new tester, they’re sent an e-mail inviting them to test the app. Figure 3 shows the invitation that testers receive. By default, distribu- tion groups require testers to log in to the App Center install site to view the list of apps that have been shared with them and see the download links. When you create a distribution group, you can choose to allow public access; the testers will not be required to log in.
Signed builds produced by App Center can be distributed directly to a distribution group. Select the build and click Distribute. You can select an existing distribution group. The release notes are pre-populated with thecommittextfromthebuild.Youcan update the release notes using mark- down. Members of the distribution group are sent an e-mail announcing the release. The install site displays the release notes.
Figure 3 Tester Invitation
28 msdn magazine
App Center