使用RF框架做mysql数据库的测试,首先要安装下面两个库:
1.pip install robotframework-databaselibrary
2.pip install PyMySQL
然后开始编写case脚本
*** Settings ***
Library DatabaseLibrary
*** Test Cases ***
mysql
Connect To Database Using Custom Params pymysql database='jmeter', user='root', password='123456', host='127.0.0.1', port=3306,charset='utf8'
${b} Query select tps from jmeter01 where time<218
${c} Row Count select tps from jmeter01 where time<218
${d} Evaluate random.randint(0, ${c}-1) random
log ${b[${d}][0]}
运行下,看结果: