def dtr_target_lookup_insert_fun(TOTAL_INFO):
connect_db()
+ # Insert values
query = "INSERT INTO dtr_target_lookup (test_info, tizen_version, tizen_environ, tizen_target, test_date, tizen_release_version) \
VALUES(%s, %s, %s, %s, %s, %s)"
do_many_query(query, query_var_list)
pprint.pprint(do_many_query)
- disconnect_db()
+ total_results = {}
+ total_results[arg_name] = []
+
+ # Load latest value
+ query = "SELECT id, test_info FROM dtr_target_lookup ORDER BY id DESC LIMIT %s"
+ query_data = (len(TOTAL_INFO['smoke_menu_data']['var_list']), )
+
+
+ rows = get_multi_values_from_query_data(query, query_data)
+ for value in rows:
+ total_results[arg_name].append(list(value))
+
+ total_results[arg_name].reverse()
+ disconnect_db()
def dtr_test_comment_insert_fun(TOTAL_INFO):
connect_db()
+ # Insert values
query = "INSERT INTO dtr_smoke_comment_result (test_case, comments) VALUES(%s, %s)"
query_var_list = []
do_many_query(query, query_var_list)
pprint.pprint(do_many_query)
+ # Load values
+ total_results = {}
+ total_results[arg_name] = []
+
+ query = "SELECT id, test_case FROM dtr_smoke_comment_result ORDER BY id DESC LIMIT %s"
+ query_data = (len(TOTAL_INFO['smoke_value_data']['test_case']), )
+
+ rows = get_multi_values_from_query_data(query, query_data)
+ for value in rows:
+ total_results[arg_name].append(list(value))
+
+ total_results[arg_name].reverse()
+
disconnect_db()
-def dtr_smoke_result_insert_fun(TOTAL_INFO):
+def dtr_smoke_result_insert_fun(TOTAL_INFO, LOOKUP_INFO, SMOKE_CASE_INFO, arg_name):
connect_db()
+ total_results = {}
+ total_results['var_list'] = []
+ total_results['test_case'] = []
+ total_results['smoke_result_list'] = []
+ total_results[arg_name] = []
+
+ for menus in TOTAL_INFO['smoke_menu_data']['var_list']:
+ total_results['var_list'].append(menus)
+
+
+ for test_case in TOTAL_INFO['smoke_result_data']['test_cases']:
+ total_results['test_case'].append(test_case)
+
+ case_list = []
+ for test_case in TOTAL_INFO['smoke_result_data']['test_cases']:
+ case_list.append(test_case)
+
+ result_list = []
+ for case in case_list:
+ total_results['smoke_result_list'].append(TOTAL_INFO['smoke_result_data'][case])
+
+ for case_idx, test_case_value in enumerate(total_results['test_case']): #22
+ tmp_value = total_results['smoke_result_list'][case_idx]
+ for value_idx, result_value in enumerate(tmp_value): #15
+ total_results[arg_name].append((result_value, test_case_value, \
+ int(SMOKE_CASE_INFO['DB_smoke_comment_table'][case_idx][0]), \
+ int(LOOKUP_INFO['DB_lookup_table'][value_idx][0])))
+
query = "INSERT INTO dtr_smoke_envorin_result (result, test_case, smoke_comment_id , target_lookup_id) VALUES(%s, %s, %s, %s)"
query_var_list = []
- for sample_DB_values in TOTAL_INFO['smoke_value_data']['smoke_value_DB_values']:
- query_var_list.append( sample_DB_values )
+ for smoke_DB_values in total_results[arg_name]:
+ query_var_list.append( smoke_DB_values )
pprint.pprint(query_var_list)
do_many_query(query, query_var_list)
def main(TOTAL_INFO):
+ target_lookup_dict = {}
+ smoke_comment_dict = {}
+
## 1. Lookup table data
- dtr_target_lookup_insert_fun(TOTAL_INFO)
+ target_lookup_dict = dtr_target_lookup_insert_fun(TOTAL_INFO, "DB_lookup_table")
## 2. Smoke test suite & comment data
- dtr_test_comment_insert_fun(TOTAL_INFO)
- dtr_smoke_result_insert_fun(TOTAL_INFO)
+ smoke_comment_dict = dtr_smoke_comment_insert_fun(TOTAL_INFO, "DB_smoke_comment_table")
+ dtr_smoke_result_insert_fun(TOTAL_INFO, target_lookup_dict, smoke_comment_dict, "DB_smoke_result")
## 3. TBT table
dtr_tbt_insert_fun(TOTAL_INFO)