Uiautomator Introduction and its environment construction, test execution

Source: Internet
Author: User

Uiautomator Framework Usage Guide

Uiautomator is a Google-developed automated testing tool that creates automated test code through the UI to test the effective functionality of the interface (UI) and can be run on one or more devices for the application. We do not know the internal structure of the program, but simply through the interface to click, Return, exit, etc. to test the program. Equivalent to a black box test. It has several advantages:

1. Clear API, provide flexible and precise control;

2. No source code required;

3. Can be dispatched between different apps;

4. The scripting language supported by Uiautomator is Java, and Java is an object-oriented, widespread language;

Uiautomator perform the functional test test process:

First of all, it must be environmental construction:

1. Install the following tools

During the installation of the tool, you can refer to the following blog: http://blog.csdn.net/g19920917/article/details/16131565

1>JDK, after installation, be sure to add the environment variable by java_home, that is, java_home variable is established, then add%java_home%\bin in Path;
2>SDK (API above 15), be sure to first establish android_home, and then add%android_home%\tools to path;
3>eclipse (Install ADT plugin)
4>ant (for compiling the build jar), it is also important to establish the%ant_home% variable first, and then add the%ant_home%\bin in path;

2. Open Eclipse,import source code,1, 2, 3, as shown.

Figure 1 Import Source Code-1

Figure 2 Import Source Code-2

Figure 3 Import Source Code-3

3, basic engineering structure of the description, 4.

Figure 4 Description of the engineering structure

4, just import the project will have an exclamation mark, need to re-import jar package, 5, 6, 7, the jar package is added, the project will not have an exclamation mark exists.

Figure 5 Re-importing the jar package-1

Figure 6 Re-importing the jar package-2

Figure 7 Re-importing the jar package-3

5. In Build.xml, ensure that project name is the same as the project name, and default defaults are shown in build,8.

Figure 8 Build.xml

6, in the Project.Properties file to note that the value of target to the current API version of the same, 9 is shown.

Figure 9 Project.Properties

7, the value of the SDK in the Local.properties file is the path of the SDK you installed, for example, My Computer SDK path is C:\\JAVA\\ANDROID_SDK_X86_64\\SDK, note that the path is a double slash, 10 is shown.

Figure Ten Local.properties

8. Build the jar package through the ant build compilation, as shown in 11.

Figure One ant Build

9. Push the generated jar package to the phone by executing the Execute.bat file, then execute the command adb shell uiautomator runtest at_boot.jar-c Com.boot.test.BootTest Run case , please read the Execute.bat file carefully for the specific execution of the command.

Uiautomator Introduction and its environment construction, test execution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.