Download Ui Automator Viewer

  1. Download Ui Automator Viewer Windows 10
  2. Download Ui Automator Viewer For Mac
  3. Download Ui Automator Viewer Windows 7

In this document

If nothing happens, download the GitHub extension for Visual Studio and try again. 13 commits Files Permalink. Download 07: Podcast Actions v1.0. These Automator actions can be used to help create podcasts: Export Garageband Project - This action will export the current GarageBand project to iTunes. The result will be a reference to the new iTunes track. This action requires UI Scripting support be active.

  1. Testing Support Library Features

See also

The Android Testing Support Library provides an extensive framework for testing Android apps. This library provides a set of APIs that allow you to quickly build and run test code for your apps, including JUnit 4 and functional user interface (UI) tests. You can run tests created using these APIs from the Android Studio IDE or from the command line.

  1. If that doesn't suit you, our users have ranked more than 50 alternatives to Automator and many of them are available for Windows so hopefully you can find a suitable replacement. Other interesting Windows alternatives to Automator are AutoIt (Free), UI.Vision RPA (Freemium, Open Source), Sikuli (Free, Open Source) and FastKeys (Paid).
  2. Used to enumerate a container's user interface (UI) elements for the purpose of counting, or targeting a sub elements by a child's text or description. Com.android.uiautomator.core.UiDevice: Provides access to state information about the device.

The Android Testing Support library is available through the Android SDK Manager. For more information, see Testing Support Library Setup

This page provides information about what tools are provided in the Android Testing Support Library, how to use them in your testing environment, and information about library releases.

Testing Support Library Features

The Android Testing Support Library includes the following test automation tools:

Automator
  • AndroidJUnitRunner: JUnit 4-compatible test runner for Android
  • Espresso: UI testing framework; suitable for functional UI testing within an app
  • UI Automator: UI testing framework; suitable for cross-app functional UI testing across system and installed apps

AndroidJUnitRunner

The AndroidJUnitRunner class is a JUnit test runner that lets you run JUnit 3 or JUnit 4-style test classes on Android devices, including those using the Espresso and UI Automator testing frameworks. The test runner handles loading your test package and the app under test to a device, running your tests, and reporting test results. This class replaces the InstrumentationTestRunner class, which only supports JUnit 3 tests.

The key features of this test runner include:

Requires Android 2.2 (API level 8) or higher.

JUnit support

The test runner is compatible with your JUnit 3 and JUnit 4 (up to JUnit 4.10) tests. However, you should avoid mixing JUnit 3 and and JUnit 4 test code in the same package, as this might cause unexpected results. If you are creating an instrumented JUnit 4 test class to run on a device or emulator, your test class must be prefixed with the @RunWith(AndroidJUnit4.class) annotation.

Automator

The following code snippet shows how you might write an instrumented JUnit 4 test to validate that the add operation in the CalculatorActivity class works correctly.

Access to instrumentation information

You can use the InstrumentationRegistry class to access information related to your test run. This class includes the Instrumentation object, target app Context object, test app Context object, and the command line arguments passed into your test. This data is useful when you are writing tests using the UI Automator framework or when writing tests that have dependencies on the Instrumentation or Context objects.

Test filtering

In your JUnit 4.x tests, you can use annotations to configure the test run. This feature minimizes the need to add boilerplate and conditional code in your tests. In addition to the standard annotations supported by JUnit 4, the test runner also supports Android-specific annotations, including:

  • @RequiresDevice: Specifies that the test should run only on physical devices, not on emulators.
  • @SdkSupress: Suppresses the test from running on a lower Android API level than the given level. For example, to suppress tests on all API levels lower than 18 from running, use the annotation @SDKSupress(minSdkVersion=18).
  • @SmallTest, @MediumTest, and @LargeTest: Classify how long a test should take to run, and consequently, how frequently you can run the test.

Test sharding

The test runner supports splitting a single test suite into multiple shards, so you can easily run tests belonging to the same shard together as a group, under the same Instrumentation instance. Each shard is identified by an index number. When running tests, use the -e numShards option to specify the number of separate shards to create and the -e shardIndex option to specify which shard to run.

For example, to split the test suite into 10 shards and run only the tests grouped in the second shard, use the following command:

To learn more about using this test runner, see the API reference.

Espresso

The Espresso testing framework provides a set of APIs to build UI tests to test user flows within an app. These APIs let you write automated UI tests that are concise and that run reliably. Espresso is well-suited for writing white box-style automated tests, where the test code utilizes implementation code details from the app under test.

The key features of the Espresso testing framework include:

  • Flexible APIs for view and adapter matching in target apps. For more information, see View matching.
  • An extensive set of action APIs to automate UI interactions. For more information, see Action APIs.
  • UI thread synchronization to improve test reliability. For more information, see UI thread synchronization.
Download ui automator viewer mac

Requires Android 2.2 (API level 8) or higher.

View matching

The )'>Espresso.onView() method lets you access a UI component in the target app and interact with it. The method accepts a Matcher argument and searches the view hierarchy to locate a corresponding View instance that meets some given criteria. You can refine searches by specifying such criteria as:

  • The class name of the view
  • The content description of the view
  • The R.id of the view
  • Text displayed in the view

For example, to target a button that has the ID value of my_button, you can specify a matcher like this:

If the search is successful, the )'>onView() method returns a reference which lets you perform user actions and test assertions against the target view.

Adapter matching

In an AdapterView layout, the layout is dynamically populated with children views at runtime. If the target view is inside a layout subclassed from AdapterView (such as a ListView or GridView), the )'>onView() method might not work because only a subset of the layout’s views may be loaded in the current view hierarchy.

Instead, use the )'>Espresso.onData() method to access a target view element. The )'>Espresso.onData() method returns a reference which lets you perform user actions and test assertions against the elements in an AdapterView.

Action APIs

Typically, you test an app by performing some user interactions against the app’s user interface. You can easily automate these actions in your test by using the ViewActions API. You can perform such UI interactions as:

  • View clicks
  • Swipes
  • Key and button presses
  • Typing text
  • Opening a link

For example, to simulate entering a string value and pressing a button to submit the value, you can write an automated test script like this. The ViewInteraction.perform() and DataInteraction.perform() methods take one or more ViewAction arguments and run the actions in the order provided.

UI thread synchronization

Tests on Android devices can fail randomly because of timing issues. This testing issue is referred to as test flakiness. Prior to Espresso, the workaround was to insert a sufficiently long sleep or timeout period into a test or to add code to keep retrying the failing operation. The Espresso testing framework handles synchronization between the Instrumentation and the UI thread; this removes the need for the previous timing workarounds and ensures that your test actions and assertions run more reliably.

To learn more about using Espresso, see the API reference and Testing UI for a Single App training.

UI Automator

Download Ui Automator Viewer Windows 10

Download Ui Automator Viewer

The UI Automator testing framework provides a set of APIs to build UI tests that perform interactions on user apps and system apps. The UI Automator APIs allows you to perform operations such as opening the Settings menu or the app launcher in a test device. The UI Automator testing framework is well-suited for writing black box-style automated tests, where the test code does not rely on internal implementation details of the target app.

The key features of the UI Automator testing framework include:

  • A viewer to inspect layout hierarchy. For more information, see UI Automator Viewer.
  • An API to retrieve state information and perform operations on the target device. For more information, see Access to device state.
  • APIs that support cross-app UI testing. For more information, see UI Automator APIs .

Requires Android 4.3 (API level 18) or higher.

UI Automator Viewer

The uiautomatorviewer tool provides a convenient GUI to scan and analyze the UI components currently displayed on an Android device. You can use this tool to inspect the layout hierarchy and view the properties of UI components that are visible on the foreground of the device. This information lets you create more fine-grained tests using UI Automator, for example by creating a UI selector that matches a specific visible property.

The uiautomatorviewer tool is located in the <android-sdk>/tools/ directory.

Access to device state

The UI Automator testing framework provides a UiDevice class to access and perform operations on the device on which the target app is running. You can call its methods to access device properties such as current orientation or display size. The UiDevice class also let you perform actions such as:

  • Change the device rotation
  • Press a D-pad button
  • Press the Back, Home, or Menu buttons
  • Open the notification shade
  • Take a screenshot of the current window

For example, to simulate a Home button press, call the UiDevice.pressHome() method.

UI Automator APIs

The UI Automator APIs allow you to write robust tests without needing to know about the implementation details of the app that you are targeting. You can use these APIs to capture and manipulate UI components across multiple apps:

  • UiCollection: Enumerates a container's UI elements for the purpose of counting, or targeting sub-elements by their visible text or content-description property.
  • UiObject: Represents a UI element that is visible on the device.
  • UiScrollable: Provides support for searching for items in a scrollable UI container.
  • UiSelector: Represents a query for one or more target UI elements on a device.
  • Configurator: Allows you to set key parameters for running UI Automator tests.

For example, the following code shows how you can write a test script that brings up the default app launcher in the device:

To learn more about using UI Automator, see the API reference and Testing UI for Multiple Apps training.

Testing Support Library Setup

The Android Testing Support Library package is included with the latest version of the Android Support Repository, which you can obtain as a supplemental download through the Android SDK Manager.

To download the Android Support Repository through the SDK Manager:

  1. Start the Android SDK Manager.
  2. In the SDK Manager window, scroll to the end of the Packages list, find the Extras folder and, if necessary, expand to show its contents.
  3. Select the Android Support Repository item.
  4. Click the Install packages... button.

After downloading, the tool installs the Support Repository files to your existing Android SDK directory. The library files are located in the following subdirectory of your SDK: <sdk>/extras/android/m2repository directory.

The Android Testing Support Library classes are located under the android.support.test package.

To use the Android Testing Support Library in your Gradle project, add these dependencies in your build.gradle file:

To setAndroidJUnitRunner as the default test instrumentation runner in your Gradle project, specify this dependency in your build.gradle file:

It is strongly recommended that you use the Android Testing Support Library together with the Android Studio IDE. Android Studio offers capabilities that support test development, such as:

  • Flexible Gradle-based build system that supports dependency management for your test code
  • Single project structure to contain your unit and instrumented test code together with your app source code
  • Support for deploying and running tests on virtual or physical devices, from a command line or graphical user interface

For more information about Android Studio and to download it, see Download Android Studio and SDK Tools.

In this document

  • uiautomator API

The uiautomator testing framework lets you test your user interface (UI) efficiently by creating automated functional UI testcases that can be run against your app on one or more devices.

For more information on testing with the uiautomator framework, see UI Testing.

Syntax

To run your testcases on the target device, you can use the adb shell command to invoke the uiautomator tool. The syntax is:

Here’s an example:

Download Ui Automator Viewer For Mac

Command-line Options

The following table describes the subcommands and options for uiautomator.

Table 1. Command-line options for uiautomator

SubcommandOptionDescription
runtest<jar>Required. The <jar> argument is the name of one or more JAR files that you deployed to the target device which contain your uiautomator testcases. You can list more than one JAR file by using a space as a separator.
-c <test_class_or_method> Required. The <test_class_or_method> argument is a list of one or more specific test classes or test methods from the JARs that you want uiautomator to run.

Each class or method must be fully qualified with the package name, in one of these formats:

  • package_name.class_name
  • package_name.class_name#method_name
You can list multiple classes or methods by using a space as a separator.
--nohupRuns the test to completion on the device even if its parent process is terminated (for example, if the device is disconnected).
-e <NAME> <VALUE>

Specify other name-value pairs to be passed to test classes. May be repeated.

Note: The -e options cannot be combined; you must prefix each option with a separate -e flag.

-e debug [true|false]Wait for debugger to connect before starting.
dump[file]Generate an XML file with a dump of the current UI hierarchy. If a filepath is not specified, by default, the generated dump file is stored on the device in this location /storage/sdcard0/window_dump.xml.
eventsPrints out accessibility events to the console until the connection to the device is terminated

uiautomator API

The uiautomator API is bundled in the uiautomator.jar file under the <android-sdk>/platforms/ directory. The API includes these key classes, interfaces, and exceptions that allow you to capture and manipulate UI components on the target app:

Classes

ClassDescription
com.android.uiautomator.core.UiCollectionUsed to enumerate a container's user interface (UI) elements for the purpose of counting, or targeting a sub elements by a child's text or description.
com.android.uiautomator.core.UiDeviceProvides access to state information about the device. You can also use this class to simulate user actions on the device, such as pressing the d-pad hardware button or pressing the Home and Menu buttons.
com.android.uiautomator.core.UiObjectRepresents a user interface (UI) element.
com.android.uiautomator.core.UiScrollableProvides support for searching for items in a scrollable UI container.
com.android.uiautomator.core.UiSelectorRepresents a query for one or more target UI elements on a device screen.

Interfaces

InterfaceDescription
com.android.uiautomator.core.UiWatcherRepresents a conditional watcher on the target device.
com.android.uiautomator.testrunner.IAutomationSupportProvides auxiliary support for running test cases.
com.android.uiautomator.testrunner.UiAutomatorTestCaseDefines an environment for running multiple tests. All uiautomator test cases should extend this class.

Download Ui Automator Viewer Windows 7

Exceptions

ExceptionDescription
com.android.uiautomator.core.UiObjectNotFoundExceptionIndicates when a a UiSelector could not be matched to any UI element displayed.