Preliminary study on Robotium Principle--android automatic Test course

Source: Internet
Author: User

Chapter: Basic Principles of--robotium Automation (fourth Lecture)

Main content and notes:

First, control-based

1. spinner--drop-down menu

2, tabhost--slide Selection menu, similar to phone book

3. gallery--Graphics

4. progressbar--progress bar

5. datepicker--date and time selection control

6, checkbox--single box; radiobutton--Mutual exclusion single box; button--General button

7. togglebutton--Two-state button controls: Select and not select both states, and display different text for different states
8. edittext--edit Box

Second, the principle of robotium

1. What is Robotium?

Robotium is a foreign Android Automation testing framework, mainly provides the function of black box test, can manipulate the control (compared with monkey and Monkeyrunner), provides the API to simulate user operation, find, assert. In addition, the Robotium 4.0 version provides support for WebView. Robitum provides support for activity, Dialog, Toast, menu. January 2014, the eclipse-based recorder has been developed

2, Rotium Development documents:

Directly Search Robotium official website, download its Javadoc documents, extracted is such a directory:

Open the index.html and you'll see an introduction to the solo class under Class.

The most important class is the solo class, which contains the following methods:

You can see from the above that the classes provided include:

1), Assertcurrentactivity method, to determine whether the activity that matches the specific name is the current active, there are multiple overloaded classes, the specific invocation according to the actual situation to implement

2), Clickinlist method: Click List, get results; Clicklonginlist: Long press list to get results

3) 、... There are a variety of other, long press on the screen, long press to meet the specific needs of the text of the view, click button, etc., a variety of easily from the name can understand the function of the method

3. Code Analysis (emphasis)

1), Clicker class

Take the Clickonscreen (float x, float y) function as an example, call the Android apk method: Motionevent.obtain () method, parameters include press time, event event, and event type, x and y coordinates, etc.

2), Solo class (for Core search control: Robotium is not related to monkey principle, Robotium is to call instrumentation Framework lookup control, run with Injectevent event-driven control)

The Assertcurrentactivity method in this class calls the Searchfor method: Gets the view of all the activity, and then calls the corresponding method according to the content to be obtained, so that it can get to meet the requirements of what I am looking for

3), search class:

The processing logic for this class?

Getview--> get all the activity inside the view--> thrown into the ArrayList, each taken out to determine what type of comparison

4), WebView, Robotiumwebview and Webchromeclient

JS Script Injection

Third, Robotiumrecord recorder

I'm going to try this on my own, and there's nothing more to say.

NetEase Cloud Classroom:

http://study.163.com/course/courseLearn.htm?courseId=712011#/learn/video?lessonId=876095&courseId=712011

Golden Sun Test

Sina Weibo: Golden Sun Woody

Website address

1, Baidu Search: Golden Sunshine test

2. Official website: www.goldensunshine.cc

Public number

Preliminary study on Robotium Principle--android automatic Test course

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.