Monkey Test = = = How to get activity for Android app

Source: Internet
Author: User

This article transferred from: http://www.cnblogs.com/nbkhic/p/3806951.html

Sometimes in Appium desired capabilities you need to specify the appactivity of the app under test, the following method may help you.

Method One

If you have to test the project source code, then directly view the source code is good. If not, then please contact the source of the students, this is the recommended method.

Method Two

If you don't have the code, you can decompile the app.

There will be 2 tools, Dex2jar and Jd-gui, respectively. Here you can download the latest version as well as the sample apk.

We take the contactmanager.apk in the toolkit as an example and briefly describe the process of anti-compilation.

    • 1, rename contactmanager.apk to Contactmanager.zip and unzip to get file Classes.dex;
    • 2, unzip the Dex2jar-0.0.9.15.zip and enter the folder from the command line;
    • 3, Run command

Get Classes-dex2jar.jar under the current folder;

    • 4, decompression jd-gui-0.3.6.windows.zip get file Jd-gui.exe;
    • 5, open Classes-dex2jar.jar with Jd-gui.exe;

Well, well, you can enjoy it.

The contactmanager shown here is the main activity of the app under test.

Method Three

Refer to this post in Testerhome

Use log to view Dafa (well, no grep on Windows is not happy, fortunately there are PowerShell select-string, can be used to force a use), directly to move bricks.

A. Launch the apk you want to test
b, turn on the log output: adb logcat>d:/log.txt
C, turn off the log output: Ctrl + C
D. View Logs
Find:

Displayed Com.mm.android.hsy/.ui. Loginactivity: +3s859msapppackage = com.mm.android.hsyappActivity =. UI. Loginactivity 

Well, the preparation activity is almost done. The next section of ethanol takes you on a journey of control positioning.

The copyright of this article is owned by ethanol, welcome reprint, but please specify the author and source, strictly prohibited for any commercial use

Monkey Test = = = How to get activity for Android app

Related Article

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.