Screenshot principle (ii)--ANDROID Automated test learning process

Source: Internet
Author: User

Pick up an article (principle)

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

Four, non-apk operation, through the PC side to achieve screenshots operation, and the principle

By means of ADB bridging, the idevice and Androiddebugbridge classes in Ddmlib.jar are called to the devices connected via ADB, which are then saved on the PC side to intercept multiple graphs in a short period of time.

Five, ADB bridging mode to achieve the code analysis of screenshots

Importjava.awt.*;Importjava.awt.event.*;ImportJava.io.File;ImportCom.android.ddmlib.AndroidDebugBridge; Public classPerformanalysisextendsFrameImplementsActionListener {PrivateString title = "Performance Test Tool"; PrivateButton takepicture; PrivateButton Getcpumem; PrivateLabel tip; Private StaticTextField Picturenum;  Publicperformanalysis () {settitle (title); Takepicture=NewButton ("Get Screen"); Takepicture.setsize (150, 100); Getcpumem=NewButton ("Get Memory and CPU"); Getcpumem.setsize (350, 300); Picturenum=NewTextField ("1"); Picturenum.setsize (100, 20); Tip=NewLabel ("Number of inputs, truncated one second"); FlowLayout FlowLayout=NewFlowLayout (flowlayout.left,50,60);          SetLayout (FlowLayout);          Add (takepicture);        Add (GETCPUMEM);        Add (TIP);                Add (Picturenum); Takepicture.addactionlistener ( This); Addwindowlistener (NewWindowadapter () { Public voidwindowclosing (WindowEvent We) {System.exit (0);                }        }); File File=NewFile ("D://lixia//getpicture");if(!file.isdirectory ()) {//The multilevel directory here is the same as in Python, it must be mkdirs, or it will not be built successfully .file.mkdirs ();} androiddebugbridge.init (false); SetBounds (50, 350, 350, 350); SetVisible (true); } @Override Public voidactionperformed (ActionEvent e) {//TODO auto-generated Method Stub        if(E.getsource () = =takepicture) {screenshot screenshot=Newscreenshot ();        Screenshot.main (); }    }         Public voidSetnumber () {Picturenum.settext ("123"); }         Public StaticString GetNumber () {returnPicturenum.gettext (). toString (); }         Public Static voidMain (string[] args) {performanalysis P=Newperformanalysis (); }    }

Golden Sun Test

Sina Weibo: Golden Sun Woody

Website address

1, Baidu Search: Golden Sunshine test

2. Official website: www.goldensunshine.cc

Public number

Principle (ii)--ANDROID Automated test learning process

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.