Appcrawler Application Summary

Source: Internet
Author: User
Tags appium

I. Environment

    • Environment Preparation: Install Android SDK + Real machine + Appcrawler-2.1.3.jar
    • Generate Demo:java-jar Appcrawler-2.1.3.jar–demo for YML
    • Change and run the yml configuration file: Java-jar appcrawler-2.1.3.jar-c example. Yml

Two. Parameter description

1, Java-jar appcrawler-2.1.0.jar–capability apppackage=xxxxxx,appactivity=xxxxxx
2. Named Start appium:appium–session-override

3, configuration file use: True and false is the meaning of opening and closing
LogLevel: Log Level
Savescreen: whether
Reporttitle: report Name
Screenshottimeout: Screen timeout time
Currentdriver: Current device (Android/ios)
Resultdir: Result folder name, given, will not be named dynamically
Taglimitmax:ios element Tag Control
Taglimit: Give tag
MaxTime: Maximum run time
Showcancel: should be control whether to show comments
Capability: for configuring Appium
Androidcapability:android exclusive configuration, and will eventually merge with capability
Ioscapability:ios Exclusive Configuration
Urlwhitelist/blacklist: White List/blacklist
Xpathattributes: Used to set which types of controls can be used to locate the control
Defineurl: The element used to determine the URL location XPath his text will be taken out as a URL factor (not understood)
BASEURL: Sets a starting URL and maxdepth to specify the initial state and traversal depth during traversal
MaxDepth: Default maximum depth of 10, combined with BaseURL, allows for very good control over the traversing range
Appwhitelist:app Whitelist, if you jump to another app, you need to set the rules, whether to allow to stay in the sub-app
Headfirst: Whether forward traversal or back traversal
Enterwebview: Whether to traverse the WebView control
Urlblacklist:url blacklist. To exclude certain pages
Urlwhitelist:url White list, the first time to enter the scope of the white list, is always in the whitelist. Otherwise, you'll have to go through the white list if you don't.
The upper level is a whitelist and is not currently whitelisted to return
Defaultbackaction: Default return action (no example, seemingly unspecified, is click)
Backbutton: Gives some return controls for returning actions using
Firstlist: Prioritize traversal of elements
Selectedlist: The default traversal list, if it is not the specified type, but the control is determined, the control is clicked separately
Lastlist: The last element to traverse
Blacklist: Excluding certain controls
Triggeractions: Making rules (action, XPath, Times)
Autocrawl: Auto Crawl, see source specified true after running crawl (conf.maxdepth) command
(crawl--emptying stack begins to count) should be the primary method of Appcrawler
Asserts: Assertion, the judgment used for failure
TestCase: Test cases, look at the Appcrawler log, each time you run the use case first to go down
Beforeelementaction: No one seems to use it, literally, before the element moves.
Afterelementaction: The same treatment as Beforeelementaction
Afterurlfinished: It's also a very unpopular treatment.
Monkeyevents:monkey Number of Hits
Monkeyruntimeseconds:monkey Run time
Given is the condition or input when the trigger condition and action then is asserted
4, one time CTRL + C generation report, two times CTRL + C is forced to quit
5, the terminal input Scala into the Scala interpreter, enter: Q or: Quit the Interpreter
6, the depth of the traversal should be how to set, always jump to other pages, will not return to the current page continue to traverse, see the document through the black and white list
7. Set a starting URL and maxdepth to specify the initial state and traversal depth during traversal

  • Webdriver
    1. Positioning based on ID class XPath
  • Appcrawler
    1. First getpagesoruce get all the elements list
    2. Select elements directly based on XPath
    3. When adding a highlight to the selection control
    4. Automated mechanisms for easing strategies

  • Page Source Interpretation
    Android
    1. Tag class
    2. Resource-id
    3. Content-desc
    4. Text
    Ios
    1. Tag
    2. Name
    3. Label
    4. Value

  • Positioning of XPath
    Absolute positioning/xxx/ddd/dddd
    Relative positioning//android.widget.button
    Find
    1.//*
    2.//*[contains (@resource-id, ' login ')]
    3.//*[@text = ' login ')
    4.//*[contains (@resource-id, ' login ') and contains (@text, ' login ')]
    5.//[contains (@text, ' spectacle ')]/ancestor:://*[contains (Name (), ' EditText ')]
    6.//*[@clickable = "true"]//android.widget.textview[string-length (@text) >0 and String-length (@text) <20]

  • Multiple ways to match
    Xpath
    1.//*[@resource-id= ' xxxx ']
    2.//*[contains (@text, ' password ')]
    Regular
    1. ^ OK ¥
    2.^. Entering a password
    Contains
    1. Password
    2. Enter
    3. Please

Automatic traversal process
Access to Information
Dump the current app's interface into an XML structure
Get the element to traverse
Traversing range Selectedlist
Filter blacklist small control invisible controls blacklist
Re-control Smooth firstlist lastlist
Skip clicked + Skip Limit Click Controls Taglimit
Follow up on matching rules execute action
Cycle the above steps

Issue record

    1. Set login ID, password
triggeractions:-Action:"Click" XPath:"//*[@resource-id= ' Com.xxx.myfinance:id/login_tv '] "times: 1-action:  "153xxxxxxxx" XPath:  "//*[ @resource-id= ' Com.xxx.myfinance:id/phone_edit '] "times: 1-action:  "123456" XPath:  "//*[ @resource-id= ' Com.xxx.myfinance:id/pwd_edit ']" times: 1-action: " click "XPath: "//*[ @resource-id= ' Com.xxx.myfinance:id/btn_submit ']" times: 1         
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
 2.  编辑EditText
    • 1
    • 2

Way One:

 triggerActions:  "10000"  xpath: "//*[@class=‘android.widget.EditText‘]"  times: 1 
    • 1
    • 2
    • 3
    • 4

Note: Times can only write 1, otherwise the EditText control is always there to copy the cut
Not applicable for edittext that require multiple inputs

Way two:

testcase:  "sui guan jia"  steps:    - when:       xpath: //*[@resource-id=‘com.feidee.myfinance:id/cash_amount‘] action: ${random.int[100,1000]} times: 0 then: []
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

Note: clickable EditText cannot get

Clickedindex=-1 Action=ready xpath=//*[@resource-id=\ "com.feidee.myfinance:id/action_bar_root< Span class= "Hljs-command" >\ "and @index =\" 0\ "]/*[@resource-id=\" Android:id/content\ "and @index =\" 0\ " ]/*[@index =\ "0\" ]/*[@resource-id= \ "Com.feidee.myfinance:id/common_toolbar\" and @index =< Span class= "Hljs-command" >\ "0\" ]!!! CANCELED!!!                
    • 1
    • 2
    • 3

3 Appcrawler Often there are some errors:
2018-05-12 10:53:27 ERROR [crawler.crawl.203] Crawl not finish, return with exception
2018-05-12 10:53:27 ERROR [crawler.crawl.204] Unable to launch the app:Error:Trying-start logcat capture but it ' s ALR Eady started! (warning:the server did not provide any stacktrace information)
Command duration or timeout:0 milliseconds
Not very clear, why the error ... The general feeling is that Getpagesoruce has not been to the element
So I changed it.

Selectedlist:#android非空标签-//*[@clickable =' True ']#-//*[@clickable = ' true ']//*[contains (name (), ' Text ') and String-length (@text) >0 and String-length (@text) <10]#通用的button和image-//*[@clickable =' True ']//*[contains (name (),  ' button ')-/ /*[ @clickable = ' true ']//*[contains (name (),  ' Image ')-//*[ @clickable = ' true ']////*[ @class =  ' Android.widget.EditText ']          
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

4 TestCase and Triggeractions
Try it yourself, found that the first to find TestCase, and then find Triggeractions
But it still feels like the logic is a bit confusing, or there's no way to support complex logical relationships and make your case more logical.

Comprehensive consideration: 2 and 4 tangled for a long time, tried again, may be appcrawler own defects, so gave up the tool.

And I saw a new tool, aimonkey:https://testerhome.com/topics/11719.
Back for the study under

Appcrawler Application Summary

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.