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