zoukankan      html  css  js  c++  java
  • HttpRunnerManager学习(二)hrun平台使用

    hrun平台是基于hrun框架,在web平台上维护和运行自动化用例。特点:Web页面写用例,可视化页面管理,团队协作,不懂代码的人也可使用。

    hrun平台登录

     新建项目 

    以项目为单位-项目下关联多个模块

    新建模块

    项目下创建多模块

    添加测试环境

    添加配置

    (全局变量)

     编写用例

     

     4种请求方式3种请求参数类型

     

    关联token

     

     正则提取

     前置操作(案例)

    注册前置操作,删除数据库注册数据,已达到注册用例可频繁运行。

    debugtalk.py 编写操作数据库函数

    # debugtalk.py
    import pymysql
    
    dbinfo = {
        "host":"******",
        "user":"root",
        "password":"123456",
        "port":******
    }
    class DbConnect():
    
        def __init__(self,db_conf,database=""):
            self.db_conf = db_conf
            #打开数据库
            self.db = pymysql.connect(database = database,
                                      cursorclass = pymysql.cursors.DictCursor,
                                      **db_conf)
            #使用cursor()方式获取操作游标
            self.cursor = self.db.cursor()
    
        def select(self,sql):
            #sql查询
            self.cursor.execute(sql)#执行sql
            results = self.cursor.fetchall()
            return results
    
        def execute(self,sql):
            #sql 删除 添加 修改
            try:
                self.cursor.execute(sql)#执行sql
                self.db.commit()#提交修改
            except:
                #发生错误时回滚
                self.db.rollback()
    
        def close(self):
            self.db.close()#关闭连接
    
    def select_sql(select_sql):
        '''查询数据库'''
        try:
            db = DbConnect(dbinfo,database='apps')
            result = db.select(select_sql)
            db.close()
        except Exception as msg:
            print("数据库查询出现异常:%s"%str(msg))
        return result
    
    def execute_sql(sql):
        '''执行SQL'''
        try:
            db = DbConnect(dbinfo,database='apps')
            db.execute(sql)
            db.close()
        except Exception as msg:
            print("数据库执行sql出现异常:%s" % str(msg))
    debugtalk.py

     

     测试报告

  • 相关阅读:
    Ethical Hacking
    Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    食物链 POJ
    Wireless Network POJ
    Candies POJ
    畅通工程再续 HDU
    Jungle Roads HDU
  • 原文地址:https://www.cnblogs.com/MrqiuS/p/12945124.html
Copyright © 2011-2022 走看看