zoukankan      html  css  js  c++  java
  • 多测师讲解自动化测试 _RF数据库操作(上)_高级讲师肖sir

    一、安装库

    1、查看数据库是否按安装

    1.1 DatabaseLibrary

    pip3 install mysqlclient-2.0.1-cp37-cp37m-win_amd64.whl

    dos  下安装

     

     

    导入DatabaseLibrary库

     

    创建库,

     

    关键字:

    1、connect to database  #连接数据库的配置信息

    connect to database pymysql dcs root 123456 192.168.153.131 3306

     2、table must exist

    table must exist test # 判断表存在 #有则ok没有则NO

    2。1不存在的表,报错

     2.2存在的表,运行成功

    3、Check If Exists In Database

    3.1判断数据库中已经存在的数据

     

     3.2 判断数据库中不存存在的数据

    4、check if not exists in database

    4.1

     4.2

    5 Delete All Rows From Table 删除表中所有数据

     Delete All Rows From Table sc #删除表中所有数据 Disconnect From Database

     6Execute Sql Script D:sql.txt #执行脚本

     

     

    6、Execute Sql String #执行sql语句

    Execute Sql String insert  into test values (12,23); #执行sql语句

     

    7、Query

    ${vael} Query select * from test
    log ${vael} #查询当前表中所有的数据

    8、ROW COUNT

    ${count} ROW COUNT select * from test
    log ${count} #统计当前数据库中的行数

     9. ROW COUNT IS 0   #判断当前数据库中没有的数据

    ROW COUNT IS 0
    select * from s ; #判断当前数据库中没有的数据

    10、ROW COUNT IS equal to x  #行数等于 多少行

     10.1

    ROW COUNT IS equal to x select *  from test 13 #行数等于10

     10.2

    ROW COUNT IS equal to x select *  from test 10 #行数等于10

     11. Row Count Is Greater Than X  #行数大于多少行

     Row Count Is Greater Than X select *  from test 11 #行数大于11 `

    10.2

    11.Row Count Is Less Than X  # #行数小于

    Row Count Is Less Than X

    select * from test; 20 #行数小于20

    Row Count Is Less Than X
    select * from test; 9 #行数小于20

    11、 Disconnect From Database #断开数据库连接 #断开数据库连接

     Disconnect From Database #断开数据库连接 #断开数据库连接

  • 相关阅读:
    linux开机启动服务的修改与查看
    我从百度来30万IP的经验
    JavaScript静态页面值传递之Cookie篇
    采用HttpModules来重写URLs(实践篇)
    JavaScript,5种调用函数的方法
    [JS]详尽解析window.event对象
    mysql锁定单个表的方法
    mysql常见错误提示及解决方法
    浏览器Chrome 3.0.195.21 Final
    svn windows和linux安装笔记
  • 原文地址:https://www.cnblogs.com/xiaolehua/p/13783464.html
Copyright © 2011-2022 走看看