美文网首页
robotframework appiumlibrary

robotframework appiumlibrary

作者: 冲锋丘丘人 | 来源:发表于2021-07-28 10:40 被阅读0次

    进度记录

    • 0809-----

    启动app

    获取包名和launcherActivity
    打开cmd,输入指令aapt dump badging D:\test\xxx.apk(APK的全名,如手机淘宝.apk)

    image.png
    image.png

    内置关键字

    ${TRUE} #TRUE
    ${EMPTY} #处理空值,比如传参时传空
    ${CURDIR} #获取当前文件所处目录

    语法

    ... 换行

    基础

    *** Settings ***
    Documentation  变量练习
    Library  BuiltIn
    Library  ../../lib/demo.py              #py文件的函数和方法
    Variables  ../../lib/demo.py            #py文件的变量
    Resource  ../../resources/my_var/my_var.robot     #自定义的var值
    Resource  ../../resources/douban_resources.robot     #自定义关键字keyword
    
    
    
    *** Keywords ***
    Get random number
        ${my_list}  create list  1,2,3
        ${num}   random_choice   ${my_list}
        [return]  ${num}
    My Keyword
        [Arguments]    ${path}
        Directory should Exist    ${path}     #名为path的参数,调用时可以直接传value值或者path=value值
    
    *** Test Cases ***
    
    Study
        log to console  ${MESSAGE}
        log to console   nihao    #定义常量
        log to console   开始睡眠
        sleep  1
        log to console  ${age}
        log to console   ${database}
        log to console   ${user_info}
        ${rand}  my_random     #函数方法,看是否有返回值
        log to console    ${rand}
    
        ${rsp_one}  Get random number   #关键字返回参数
        log to console  ${rsp_one}
    
    My Test
        [Documentation]    Example test.
        log    ${MESSAGE}
        My Keyword    path=${CURDIR}      #关键字参数入参
    
    *** Settings ***
    Documentation     Example using the space separated format.  #settings内不用[]
    Library           OperatingSystem
    
    *** Test Cases ***
    Test With Settings
        [Documentation]    Another dummy test    #测试用例documentation需要[]
        [Tags]    dummy    owner-johndoe
        Log    Hello, world!
    
    Example 1A
        Connect    example.com    80       # Connect gets two strings as arguments
    Example 1B
        Connect    example.com    ${80}    # Connect gets a string and an integer
    Boolean
        Set Status    ${true}               # Set Status gets Boolean true as an argument
        Create Y    something   ${false}    # Create Y gets a string and Boolean false
    None
        Do XYZ    ${None}                   # Do XYZ gets Python None as an argument
    One space
        Should Be Equal    ${SPACE}          \ \
    Empty
        Should Be Equal    ${EMPTY}          \
    

    for循环

    Putong xunhuan
        FOR    ${var}    IN    cat    dog     #普通基础循环
            Log to console   ${var}
        END
    
    Only upper limit
        [Documentation]    Loops over values from 0 to 9
        FOR    ${index}    IN RANGE    ${30}        #注意IN RANGE  之间空格(ASCII空格)
            Run Keyword if   ${index} == 10   Exit For Loop     #等于10时退出for循环
            Log to console    ${index}
        END
    

    相关文章

      网友评论

          本文标题:robotframework appiumlibrary

          本文链接:https://www.haomeiwen.com/subject/plnmcktx.html