def get_cases_number_list(self): mysql = MysqlBase() sql_result = mysql.get_mysql_execute_result( "SELECT case_number FROM %s WHERE CASE_ID != '' OR CASE_ID != NULL;" % self.case_info_table_name) cases_number = DataTransformation.get_tuple_value(sql_result) return cases_number
def get_all_case_number(): sql = "SELECT CASE_NUMBER FROM %s;" % CaseModel.DEFAULT_CASE_TABLE_NAME mysql_db = MysqlBase() search_result = mysql_db.get_mysql_execute_result(sql) if search_result: case_number_list = DataTransformation.get_tuple_value( search_result) return case_number_list else: return []
def get_case_content_by_case_number(self, case_number): mysql = MysqlBase() sql_result = mysql.get_mysql_execute_result( "SELECT * FROM %s WHERE case_number = '%s';" % (self.case_info_table_name, case_number)) case_headers = self.header_list case_headers.insert(0, "CASE_ID") case_content = dict( zip(case_headers, DataTransformation.get_tuple_value(sql_result))) print(case_content) return case_content
def get_case_content_from_case_info(self): mysql = MysqlBase() case_info_header = self.get_case_info_table_headers() case_info_header.insert(0, "CASE_ID") all_content = mysql.get_mysql_execute_result( "SELECT * FROM %s WHERE CASE_ID != '' OR CASE_ID != NULL" % self.case_info_table_name) case_content = [] for content in all_content: case_content.append(dict(zip(case_info_header, content))) return case_content
def get_case_content(case_number): case_db = MysqlBase() case_content = {} dict1 = {} sql = "SELECT %s FROM %s WHERE CASE_NUMBER = '%s';" % ( '*', CaseModel.DEFAULT_CASE_TABLE_NAME, case_number) result = case_db.get_mysql_execute_result(sql) if len(result) != 1: raise Exception("根据用例编号【%s】查询出来的用例数据为空或不唯一:'{}'".format(result)) else: case_result = result[0] for i, y in zip( case_result, CaseModel.DEFAULT_CASE_TABLE_COL_HEAD_DISPLAY_NAME): dict1[y] = i case_content.update(dict1) case_db.close_mysql_db(case_db) return case_content
def get_application_case(application_name): mysql_db = MysqlBase() sql = "SELECT case_number FROM %s WHERE APPLICATION_TYPE = '%s'" % ( CaseModel.DEFAULT_CASE_TABLE_NAME, application_name) return DataTransformation.get_tuple_value( mysql_db.get_mysql_execute_result(sql))