robot framework 数据库增删改查

使用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}

 

 

二、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

 

 

三、使用

 

posted @ 2020-01-26 16:28  菜小鱼~  阅读(505)  评论(0编辑  收藏  举报