demo 5 # Databaselibrary 安装:pip install robotframework-databaselibrary -i https://pypi.tuna.tsinghua.edu.cn/simple # Databaselibrary 在线文档:http://franz-see.github.io/Robotframework-Database-Library/ # MySQL 驱动:pip install PyMySQL
# 连接数据库 # Connect To Database Using Custom Params | [ dbapiModuleName=dbapiModuleName | db_connect_string=db_connect_string ] Connect To Database Using Custom Params PyMySQL database='db_customer', user='username', password='password', host='192.168.5.10', port=8101 # 执行sql语句 # Execute Sql String | query ${var1} Execute Sql String select * from customer order by ctime limit 10; log ${var1} # 执行sql文件 ${CURDIR}为当前目录 # Execute Sql Script | ${CURDIR}\test_scriptsqlfile.sql # 断开数据库连接 Disconnect From Database
# 可以根据自己需求重写或新增 DatabaseLibrary/query.py 关键字