robot framework 数据库增删改查

时间:2021-08-02 02:28:08

使用rf做数据库的增删改查操作可以定义关键字,方便后续使用

 

关键字如下:

一、sql_查

1     [Arguments]    ${host}    ${port}    ${user}    ${passwd}    ${db}    ${sql}
2     Connect To Database Using Custom Params    pymysql    host=${host}, port=${port}, user=${user}, passwd=${passwd}, db=${db},charset=utf8
3     ${return}    Query    ${sql}
4     Disconnect From Database
5     [Return]    ${return}

robot framework 数据库增删改查

 

 

二、sql_增删改查

 

    [Arguments]    ${host}    ${port}    ${user}    ${passwd}    ${db}    ${sql}
    Connect To Database Using Custom Params    pymysql    host=${host}, port=${port}, user=${user}, passwd=${passwd}, db=${db},charset=utf8    #host=‘${host}‘, port=${port}, user=‘${user}‘, passwd=‘${passwd}‘, db=‘${db}‘,charset=‘utf8‘
    ${return}    Execute Sql String    ${sql}
    Disconnect From Database

robot framework 数据库增删改查

 

 

三、使用

robot framework 数据库增删改查