def runproduct(): ''' 按产品执行所有用例 {"idlist":"1,2"} ''' dictdata = request.get_json() idlist = dictdata["idlist"] sql = "SELECT\ t_testcass.id\ FROM\ t_product\ LEFT JOIN t_project ON t_product.id = t_project.productid\ LEFT JOIN t_modules ON t_project.id = t_modules.projectid\ LEFT JOIN t_testcass ON t_modules.id = t_testcass.moduleid\ WHERE t_product.id in (%s);" % idlist res = dbfucs.query(sql) jsoncasss = [] for test in res: jsoncasss.append(test) # print(jsoncasss) for i in collect.collect_db_cass(jsoncasss): Logger.info("*" * 90) Logger.info("共计[%d]条测试用例执行完成!" % len(jsoncasss)) Logger.info("*" * 90) response = {} response["code"] = 200 response["msg"] = "成功!!!" return jsonify(response)
def runmodule(): ''' 按模块执行所有用例 {"idlist":"1,2"} ''' dictdata = request.get_json() idlist = dictdata["idlist"] ids = '' for i in idlist: ids += str(i) + "," sql = "SELECT * FROM t_testcass WHERE moduleid in (%s)" % ids[:-1] res = dbfucs.query(sql) if len(res) == 0: response = {} response["code"] = 200 response["msg"] = "没有可用用例执行" return jsonify(response) jsoncasss = [] for test in res: jsoncasss.append(test) # print(jsoncasss) for i in collect.collect_db_cass(jsoncasss): Logger.info("*" * 90) Logger.info("共计[%d]条测试用例执行完成!" % len(jsoncasss)) Logger.info("*" * 90) response = {} response["code"] = 200 response["msg"] = "成功!!!" return jsonify(response)
def runproduct(): ''' 按产品执行所有用例 {"idlist":"1,2"} ''' dictdata = request.get_json() idlist = dictdata["idlist"] ids = '' for i in idlist: ids += str(i) + "," sql = "SELECT\ t_testcass.id\ FROM\ t_product\ LEFT JOIN t_project ON t_product.id = t_project.productid\ LEFT JOIN t_modules ON t_project.id = t_modules.projectid\ LEFT JOIN t_testcass ON t_modules.id = t_testcass.moduleid\ WHERE t_product.id in (%s);" % ids[:-1] # print(sql) res = dbfucs.query(sql) # print(res) if len(res) == 0: response = {} response["code"] = 200 response["msg"] = "没有可用用例执行" return jsonify(response) idlist = [] for i in res: idlist.append(i['id']) ids = '' for i in idlist: ids += str(i) + "," sql = "select id,testname,testtype,request,validate,extract from t_testcass where id in(%s);" % ids[: -1] res = dbfucs.query(sql) jsoncasss = [] for test in res: jsoncasss.append(test) # print(jsoncasss) for i in collect.collect_db_cass(jsoncasss): Logger.info("*" * 90) Logger.info("共计[%d]条测试用例执行完成!" % len(jsoncasss)) Logger.info("*" * 90) response = {} response["code"] = 200 response["msg"] = "共计[%d]条测试用例执行完成!" % len(jsoncasss) return jsonify(response)
def runtests(): '''{"idlist":"1,2"}''' dictdata = request.get_json() idlist = dictdata["idlist"] sql = "select id,testname,testtype,request,validate,extract from t_testcass where id in(%s);" % idlist res = dbfucs.query(sql) jsoncasss = [] for test in res: jsoncasss.append(test) for i in collect.collect_db_cass(jsoncasss): Logger.info("*" * 90) Logger.info("共计[%d]条测试用例执行完成!" % len(jsoncasss)) Logger.info("*" * 90) response = {} response["code"] = 200 response["msg"] = "用例执行完成!" return jsonify(response)