[Android] Robotium Mobile phone Automation test (APK installation package only)-environment set "Turn"

Source: Internet
Author: User

Many of Robotium's mobile automation tests use the ID definitions in the app's source code to develop automated scripts. And when I started writing automated test scripts for the apps in the project, the development environment was unstable, the app was still in development, and there were many development issues that took a lot of time to solve when I needed to build the entire Android development environment. Therefore, I think, in this case, if your own Automation scripting environment can and development completely independent, then, should be able to better expand the development of automation scripts. So, after exploring the Internet, I chose the only way to install the APK package.

Of course, this will also encounter problems, for example, before the development has not yet completely finished, the function of the app will change at any time, and on the original basis of the development of good automation scripts will require a lot of rework. However, I hope that, before the function of the app is not fully stable, can be based on the existing app, the entire automated development framework, and then, on the basis of this framework, it is easy to change some of the minor functional changes of the automation script.

So, from the point of view of testing, only the way to install the APK package, the main advantages are as follows:

1. Testers do not need to build a complex Android development environment in Eclipse (basic Android SDK and Java environment are required.) )

2. In the event that the app is not fully developed, testers can build an automated development framework based on general app functionality to facilitate later development of automated scripts for specific functions.

3. In automated testing, even without continuous integration, it is easier to test app--in an iteration by installing the latest app on a test device (simulator or mobile).

Here's how to prepare for the Robotium Mobile Automation development environment, which requires only the APK installation package version.

1. Get source code from source control tools such as APK install package/or Git from developer

In my project, the source code that is developed is to use MVN as the project management tool, so just open a command prompt (cmd), then go to the app source, enter the MVN install, get the APK file

For example:

1) CD .../testapp

2) mvn install

3) After build success, locate the target directory under the TestApp directory, and in the target directory, you can find the latest generated apk file.

2. Android APK is released and needs to be signed. For specific information, see: http://developer.android.com/tools/publishing/app-signing.html

In order to install the APK on the test device successfully, we need to re-sign the apk we got (re-sign).

Re-signing tools, many online, I use Re-sign.jar.

In the user directory, there will be a. Android directory, put Re-sign.jar in the directory.

The re-sign steps are as follows:

1) Open command prompt: cmd

2) CD .../.android

3) Run Java-jar Re-sign.jar, open the Resign tool

4) Drag and drop the latest APK file into the open resign tool and, when finished, will generate a re-signed APK file.

After the ps:resign, you will get a package name and main activity name, we need to write down these two names, in the 4th step will be used.

  

3. Install the re-signed APK file in the simulator in the following steps: (similar to the simulator installed in the real machine, specific operation, Google or Baidu can be)

1) Open the Android SDK installation directory

2) Locate the Platform-tools directory under the SDK

3) put the re-signed APK file in this directory

4) Open command prompt: cmd

5) CD .../sdk/platform-tools

6) Open the simulator to install APK

7) Run command: adb install testedapp.apk. See success, the APK has been installed successfully.

Ps: Before installing the APK, make sure the old version of the app has been uninstalled in the simulator. Otherwise, executing the command will prompt that the installation failed.

4. In eclipse, create a new Android test Project and configure it to associate the automation script with the APK to be tested.

1) Modify the Androidmainfest.xml file under Android Test project so that the package name marked in bold is consistent with the name generated by resign <instrumentation Android:nam E ="Android.test.InstrumentationTestRunner"Android:targetpackage ="Com.example.mobile.testedapp"/> 2) in the Automation script test class, declare the initial class, as well as the resign generated main activity class name consistent    private static Final StringLauncher_activity_full_classname="com.example.mobile.testedapp.MainActivity"; 5.  This allows you to develop automated scripts in the Eclipse Android Test project, and run them on the installed APK base! "Reprint Address" http://www.cnblogs.com/enjoytesting/p/3622657.html

[Android] Robotium Mobile phone Automation test (APK installation package only)-environment set "Turn"

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.