From a965d2e1aff9409b7e08adf1280788192461686a Mon Sep 17 00:00:00 2001 From: Heidi von Markham Date: Wed, 3 Aug 2016 16:29:27 -0700 Subject: Docs: Adding AfW Test Harness page + nav Adding comments from CL and doc Changing platform variable to linux-86 Changing linux-86 to linux-x86 Adding editorial comments Adding new content for b/25790522 Adding new comments Bug: 30389619, 25790522 Change-Id: Ia48c25728af390957631cff2d096d776e5038c4f --- src/devices/devices_toc.cs | 3 +- src/devices/tech/admin/provision.jd | 31 +-- src/devices/tech/admin/testing-provision.jd | 323 ++++++++++++++++++++++++++++ src/devices/tech/admin/testing-setup.jd | 8 +- 4 files changed, 351 insertions(+), 14 deletions(-) create mode 100644 src/devices/tech/admin/testing-provision.jd diff --git a/src/devices/devices_toc.cs b/src/devices/devices_toc.cs index 9674d2ba..eb007585 100644 --- a/src/devices/devices_toc.cs +++ b/src/devices/devices_toc.cs @@ -383,7 +383,8 @@
  • Provisioning
  • Multiuser Apps
  • Enterprise Telephony
  • -
  • Testing Setup
  • +
  • Testing Device Provisioning
  • +
  • Testing Device Administration
  • diff --git a/src/devices/tech/admin/provision.jd b/src/devices/tech/admin/provision.jd index abd3e01c..b69e3cf0 100644 --- a/src/devices/tech/admin/provision.jd +++ b/src/devices/tech/admin/provision.jd @@ -97,17 +97,20 @@ and sets the DeviceAdminSample as the profile owner:

    adb shell am start -a android.app.action.PROVISION_MANAGED_PROFILE \
               -c android.intent.category.DEFAULT \
    -	      -e wifiSsid $(printf '%q' \"GoogleGuest\") \
    +	      -e wifiSsid $(printf '%q' \"WifiSSID\") \
               -e deviceAdminPackage "com.google.android.deviceadminsample" \
     	      -e android.app.extra.deviceAdminPackageName $(printf '%q'
                             .DeviceAdminSample\$DeviceAdminSampleReceiver) \
     	      -e android.app.extra.DEFAULT_MANAGED_PROFILE_NAME "My Organisation"
     
    -

    Device owner provisioning via NFC

    +

    Device owner provisioning

    +

    Use one of the following methods to set up device owner (DO) +provisioning.

    -

    Device owner provisioning via NFC is similar to the profile owner method but -requires more bootstrapping. To use this method, +

    Provisioning via NFC

    +

    DO provisioning via NFC is similar to the profile owner method but requires +more bootstrapping. To use this method, NFC bump the device during the initial setup step (i.e., first page of the setup wizard). This low-touch flow configures Wi-Fi, installs the DPC, and sets the @@ -132,14 +135,12 @@ mimetype from the setup experience:

    <item>application/com.android.managedprovisioning</item> -

    Device owner provisioning -with activation code

    - -

    Select Add Work Account from the setup/out-of-box experience (this -triggers a lookup of the EMM from Android servers). The device installs the EMM -app and starts provisioning flow. As an extra option, Android device -administration supports the option of using email address with a six-digit -activation code to bootstrap the process as part of setup.

    +

    Provisioning via Cloud Services

    +

    Device owner provisioning via cloud services includes the ability to +provision a device in device owner mode during out-of-the-box setup. The device +can collect credentials (or tokens) and use them to perform a lookup to a cloud +service, which can then be used to initiate the device owner provisioning +process.

    EMM benefits

    @@ -175,3 +176,9 @@ the end goal of making corporate data accessible to apps in the managed profile. For testing guidance, see Setting up Device Testing.

    + +

    Automated provisioning testing

    +

    To automate the testing of enterprise provisioning processes, use +the Android for Work (AfW) Test Harness. For details, see +Testing Device +Provisioning.

    diff --git a/src/devices/tech/admin/testing-provision.jd b/src/devices/tech/admin/testing-provision.jd new file mode 100644 index 00000000..dd66a3b9 --- /dev/null +++ b/src/devices/tech/admin/testing-provision.jd @@ -0,0 +1,323 @@ +page.title=Testing Device Provisioning +@jd:body + + +
    +
    +

    In this document

    +
      +
    +
    +
    + +

    The Android for Work (AfW) Test Harness is a test suite for validating the +AfW compatibility of Android devices. It includes support apps, test cases, +configuration files, and a test runner (afw-test-tradefed) built on +cts-tradefed. You should setup and run the AfW Test Harness after +completing Provisioning +for Device Administration.

    + +

    Note: Building and running the AfW Test Harness +is similar to building and running the Android +Compatibility +Test Suite (CTS).

    + +

    Setting up a development environment

    +

    The development environment for the AfW Test Harness is similar to Android +OS. Follow the steps in +Requirements to set up a +development machine.

    + +

    Downloading source code

    +

    Download the AfW Test Harness source code using the steps in +Downloading the Source. The AfW +Test Harness source code is in the ./test/AfwTestHarness project. +The branch name determines the version of AfW Test Harness to download (each +Android platform has a separate version of AfW Test Harness). For Android 6.0, +the branch name is afw-test-harness-marshmallow-dev. To initialize +the repo and download source code for this branch, use:

    + +
    +$ mkdir WORKING_DIRECTORY
    +$ cd WORKING_DIRECTORY
    +$ git config --global user.name "Your Name"
    +$ git config --global user.email "you@example.com"
    +$ repo init -u https://android.googlesource.com/platform/manifest -b afw-test-harness-marshmallow-dev
    +$ repo sync -j24
    +
    + +

    To check out the source code for a different version, specify the branch with +the corresponding tag. Available branches include:

    + + + + + + + + + + + + +
    Branch Name +Supported Android Platform +
    afw-test-harness-marshmallow-devAndroid 6.0
    afw-test-harness-1.5Android 6.0
    + +

    Other dependency projects required to build the harness are also downloaded +with the source code.

    + +

    Viewing in Android Studio

    +

    To view and edit AfW source code in Android Studio:

    +
      +
    1. Run the following commands +
      +$ make idegen
      +$ development/tools/idegen/idegen.sh
      +
      +
    2. +
    3. In Android Studio, open android.ipr.
    4. +
    + +

    The AfW Test Harness source code is in test/AfwTestHarness.

    + +

    Configuring the AfW Test Harness

    +

    You can customize the harness by configuring +test/AfwTestHarness/afw-test.props. To run the harness +successfully, complete the following steps:

    +
      +
    1. Configure the Wi-Fi network in afw-test.props with the +following properties: +
      wifi_ssid
      +wifi_password (optional)
      +wifi_security_type (optional, available options are: NONE, WEP or WPA)
      +
      +
    2. +
    3. Obtain at least one account from a domain that is bound to Test DPC as +its device policy controller. Specify the details in afw-test.props +with the following properties: +
      +work_account_username
      +work_account_password
      +
      +

      The AfW Test Harness uses Test DPC to test provisioning flows, so accounts +must bind to Test DPC to run the test harness.

      +
    4. +
    + +

    Building the AfW Test Harness

    +

    Initialize the build configuration using:

    +
    +$ source build/envsetup.sh
    +$ lunch
    +
    + +

    Select a device type and press Enter.

    + +

    Build the harness using:

    +
    $ make afw-test-harness -j32
    +

    This creates a directory (out/host/linux-x86/afw-th/android-cts) +with all necessary binaries, configuration files, and tools to run the test +harness. This directory is also zipped into a file +(out/host/linux-x86/afw-th/android-afw-test-harness.zip) +for distribution.

    + +

    Running the AfW Test Harness

    +

    Use the following steps to run the AfW Test Harness:

    +
      +
    1. In your build environment, launch the test runner using: +
      $ afw-test-tradefed
      +This starts the cts-tf console, loads test plans, test cases, +and afw-test.props from +out/host/linux-x86/afw-th/android-cts.
    2. +
    3. From the unzipped folder of android-afw-test-harness.zip, +launch the test runner using: +
      $ cts-tf > ./android‐cts/tools/afw-test‐tradefed
      +This loads test plans, test cases, and afw-test.props from +android-cts directory. Ensure +./android‐cts/repository/testcases/afw-test.props has the work +account and Wi-Fi configuration.
    4. + +
    5. Run a test plan. Each test plan is an XML file that contains a set of test +packages from the AfwTestHarness/tests test package directory. +Common plans include: + +
        +
      • afw-userdebug-build. Contains all test +packages that require a userdebug build.
      • +
      • afw-user-build. Runs on a user build but +requires the test device to be set up properly, including completing the initial +setup and enabling USB debugging.
      • +
      + +
      To run the test plan afw-userdebug-build, use: +
      $ cts-tf > run cts --plan afw-userdebug-build
      +To see all test plans, use the command list plans. To view plan +definitions, refer to +out/host/linux-x86/afw-th/android-cts/repository/plans. +
      +
    6. +
    7. Run a test package. To run a single test package, use +
      $ cts-tf > run cts --package com.android.afwtest.NfcProvisioning
      +
      +To view all packages, use the command list packages. For more +options, use the command run cts --help.
    8. +
    + +

    Debugging the AfW Test Harness

    +

    Run all commands in the afw-test-tradefed console (cts-tf), +which you can launch by running afw-test-tradefed.

    + + + + +

    FAQ

    +

    For help with questions not answered below, contact +afw-testharness-support@google.com. +

    + +

    Can I run test plan afw-userdebug-build on a device +flashed with user build?

    +

    No. Test packages in the afw-userdebug-build plan factory +reset the testing device before running the actual test flow and require +adb debugging to be auto-enabled. With a user build, +adb debugging can be enabled only by manually changing the +setting in Developer options.

    + +

    Can I run test plan afw-user-build on a device flashed +with userdebug build?

    +

    Yes, but we recommend that you run this test plan on a user build.

    + +

    Sometimes my test fails because UI loading takes too much time. How +can I fix this?

    Configure the timeout_size setting +in ./android-cts/repository/testcases/afw-test.props. Valid +settings are: S, M, L, XL, XXL.

    + +

    The test package +com.android.afwtest.NfcProvisioning (or +SuwDoProvisioning) fails on my device because the installed initial +setup (i.e. Setup Wizard) shows customized UI (such as Term & Conditions) +after provisioning is complete. How can I skip this customized UI?

    +

    There should be minimal UI after the provisioning process. The test +harness will automatically skip such UI if the UI has a button that has +meaningful text or content description that contains any of the following words: +Skip, Finish, Done, Accept, Agree, Next, Continue, or Proceed. Alternatively, +you can define a button in afw-test.props to configure the test +harness to skip your UI. Example:

    +
    +oem_widgets=your_btn
    +your_btn.text=your_customized_text
    +your_btn.package=your_package
    +your_btn.action=click
    +
    +

    To define multiple widgets, separate using commas.

    + +

    The test package +com.android.afwtest.NfcProvisioning (or +SuwDoProvisioning) failed and the last UI screen is "Verify your +account." Why does this happen and how can I recover the testing device? +

    +

    This failure occurs because the previous test package failed to clear +Factory Reset Protection at the end of the test. You must manually enter the +account to unlock the device.

    + +

    My device needs more time to factory reset. Can I extend the factory +reset timeout?

    +

    Yes. Configure the factory_reset_timeout_min setting in +afw-test.props. Valid settings are in minutes; you can set to any +number of minutes that works with your device.

    diff --git a/src/devices/tech/admin/testing-setup.jd b/src/devices/tech/admin/testing-setup.jd index 129fa8e0..ea7a015a 100644 --- a/src/devices/tech/admin/testing-setup.jd +++ b/src/devices/tech/admin/testing-setup.jd @@ -1,4 +1,4 @@ -page.title=Setting up Device Testing +page.title=Testing Device Administration @jd:body