Android mobile end automated testing

Foreword

Recently, the project at hand completed the basic development, optimization can also do about it, is supposed to ease ready on the line. However, the boss has to reflect that testers found App will always be some inexplicable bug.

bug came, it would solve the chant. But this thief bug and fans, occasionally out a take liberties with what you, ask you Fubu Fu. To make the App bug in reducing as much as possible, only temporarily hard to force the switch test. These days spent a lot of time and effort to carefully study the automated testing under the Android platform, in this summary.

I. Overview


Android platform automated testing can start from two directions

  • Android end test automation framework

  • Major cloud test platform

    • Tencent gifted test cloud test platform
    • Huawei Developer Connection
    • Guanzhong cloud test
    • The test 云 测

Content of the test include:

  • Compatibility test: installation, startup, uninstall
  • Functional Test: gestures, functional verification
  • Stability Test: app if prone to flash back phenomenon
  • Scenario testing: simulate real network scenarios, 2G, 3G, 4G, wifi network switch

The above describes the specific content of Android test automation and test in both directions, the difference between them and the advantages and disadvantages at the next talk.

  • Android test automation framework
    with automated testing framework Android side, the appropriate test cases can be completed through the code, try to cover all usage scenarios, so that repetitive manual operations, to automate the conversion, the liberation of script ape valuable right (ah, also It may be left-handed). emmmm, the above advantages are not looking good. Do not worry, do not say shortcomings, the disadvantage is the higher of testers write the code proficiency requirements, but also due to cover the most usage scenarios, so it is the test of testers to understand and grasp the overall App, and more generally for UI testing, compatibility testing can not be performed, after all, limited cell phone.

  • The major cloud platform test
    the benefits of using the cloud test platform is still a lot of people, after all, is a professional engaged in this, so you do not take into account many things, others have been integrated into the platform for you inside. And with respect to the Android automated testing framework, the major cloud test platform also provides you with a wide variety of models, such as Huawei Developer Connection provides most of Huawei's glory and series of mobile phones, mobile phone version from 4.4 to 7.0 are there, looking at these advantages are not that pleasant. Shortcoming Well, in fact, not much, just a "fee." This of course can understand, after all, people also have to eat, if you are free to use, and that people should not live.

Second, the automated testing framework


2.1 Espresso

Espresso is a Google Android automated testing framework for open source Android platform, mainly for Android App UI test automation.

Here simply under the UI Automation Testing: App we, as users, to make our test machine simulation process, then we need those interfaces for our naked eyes, those buttons, which is UI components and the appropriate action to the results verify the correctness.

For example, as a user, we do not care whether a network request specific data return value is correct, we are concerned to see the results we want to see on the screen. Therefore, do UI test automation when a general idea is this: find an element, do something, test results, as the users themselves, focus only on what I can see.

Espresso is Google, after all, out of their own, or a lot of advantages

  • Use Java to write code for Android developers are very friendly
  • API is quite small, of course, also open for expansion
  • Espresso test that was run up quite fast (no wait, sleep)
  • Android Studio and Gradle support

More examples of Espresso please poke: https://github.com/vgrec/EspressoExamples

2.2 UI Automator

JUnit test case UI Automator is running with special privileges, which means that test cases across different processes, it offers five different classes to developers:

com.android.uiautomator.core.UiCollection;
com.android.uiautomator.core.UiDevice;
com.android.uiautomator.core.UiObject;
com.android.uiautomator.core.UiScrollable;
com.android.uiautomator.core.UiSelector

However, more unfortunately, UI Automator can only work on the API 16 or higher-level Android device, and there's no way to directly access Android objects.

2.3  epochs

Appium is an automated testing framework "movement", the place is fast hardware support for iOS and Android mobile Web applications and native mixed students. It is used internally JSONWireProtocol, to interact with iOS and Android apps via Selenium is WebDriver. By UI Automator and Seledroid support Android, iOS support through UI Automation. These words look like, anyway, I do not understand.

 

Appium biggest advantage is that you can use almost any programming language (eg, Java, Objective-C, JavaScript, PHP, Ruby) to write the script without Appium selection tool, compatible with the most important pigtail (Android and iOS) without installation and configuration of equipment to adapt to the test, and so on.

Third, the cloud test platform


3.1  Tencent gifted test cloud test platform

Android mobile end automated test Android mobile end automated test Android mobile end automated test Android mobile end automated test Android mobile terminal automatic test

 

Guess you like

Origin www.cnblogs.com/cs1188/p/11514258.html