def updateResultByCaseId(self, response, is_pass, msg, case_id): """ 根据测试用例id,更新响应内容和测试内容 :param response: :param is_pass: :param msg: :param case_id: :return: """ print("updateResultByCaseId") my_db = MysqlDb() current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print(current_time) if is_pass: sql = "update `case` set response='{0}', pass='******', msg='{2}', update_time='{3}' where id={4}".format("", is_pass, msg, current_time, case_id) else: sql = "update `case` set response=\"{0}\", pass='******', msg='{2}', update_time='{3}' where id={4}".format( str(response), is_pass, msg, current_time, case_id) print(sql) rows = my_db.execute(sql) return rows
def findCaseById(self, case_id): """ 根据id找测试用例 :param case_id: :return: """ print("findCaseById") my_db = MysqlDb() sql = "select * from `case` where id='{0}'".format(case_id) results = my_db.query(sql, state="one") return results
def loadAllCaseByApp(self, app): """ 根据app加载全部测试用例 :param app: :return: """ print("loadAllCaseByApp") my_db = MysqlDb() sql = "select * from `case` where app='{0}'".format(app) results = my_db.query(sql) return results
def loadConfigByAppAndKey(self, app, key): """ 根据app和key加载配置 :param app: :param key: :return: """ print("loadConfigByAppAndKey") my_db = MysqlDb() sql = "select * from `config` where app='{0}' and dict_key='{1}'".format(app, key) results = my_db.query(sql, state="one") return results
def loadConfigByAppAndKey(self, app, key): my_db = MysqlDb() sql = "select * from `config` where app='{0}' and dict_key='{1}'".format( app, key) results = my_db.query(sql, state="one") return results
def findCaseById(self, case_id): my_db = MysqlDb() sql = "select * from `case` where id='{0}'".format(case_id) results = my_db.query(sql, state="one") return results
def loadAllCaseByApp(self, app): my_db = MysqlDb() sql = "select * from `case` where app='{0}'".format(app) results = my_db.query(sql) return results