标签:... turn 分享 set ip) creat 数据库连接 字段 一个
1. 从数据库查询结果:
数据库连接:Connect To Database Using Custom Params 用法:Connect To Database Using Custom Params pymysql host=‘${base_ip}‘,user=‘root‘,passwd=‘aaaa‘,db=‘aaaa‘,port=3306,charset=‘utf8‘
数据库查询:query 用法:@{db} query ${sql}
退出数据库:Disconnect From Database
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2. 自定义定义数据库查询结果(自定义IP):
数据库连接:Connect To Database Using Custom Params 用法:Connect To Database Using Custom Params pymysql host=‘${ip}‘,user=‘${username}‘,passwd=‘${password}‘,db=‘${db_name}‘,port=3306,charset=‘utf8‘
数据库查询:query 用法:${db} query select 字段 from 表 where 条件
退出数据库:Disconnect From Database
例子:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3.获得长度为N的相同值的列表
[Arguments] ${num_list} ${list_value} ${mode}=1
[Documentation] 例如:N为3,list_value为None,mode为1则生成一个列表为[‘None‘,‘None‘,‘None‘],如果mode为2则生成[None,None,None]
${list} Create list
${num_list} evaluate range(0,${num_list})
: FOR ${i} IN @{num_list}
\ ${list2} run keyword if ${list_value}==‘‘ evaluate ${list_value}.decode(‘utf-8‘)
\ ... ELSE set variable ${list_value}
\ ${string} run keyword if ${mode}==1 evaluate str(${list2})
\ ... ELSE set variable ${list2}
\ append to list ${list} ${string}
[Return] ${list}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4.
标签:... turn 分享 set ip) creat 数据库连接 字段 一个
原文地址:https://www.cnblogs.com/chushujin/p/9324329.html