conf_path= Project_path.conf_path url=Conf(conf_path+"/ws.ini").get_value("WS","url") audio_path=Conf(conf_path+"/ws.ini").get_value("WS","audio_path") test_data_path= Project_path.TestData_path + "/case.xlsx" r=Read_xls(test_data_path) w=r.copy_book() # redis_conn= redis.Redis(host='111.231.233.115', port=6379, password="******", db=redis_case) now = time.strftime('%Y-%m-%d-%H-%M-%S') result_path = Project_path.TestResult_path + now +__name__ + ".xls" testdatas=[] sheet_names=r.get_sheet_names() for sheetname in sheet_names: sheet_data=r.read_data(sheetname,start_line=3) for each in sheet_data: each.append(sheetname) testdatas+=sheet_data # writedata = WriteExcel() # testdatas = r.read_data("002M30_36", start_line=3) pass_num=0 faile_num=0 pass_rate=0 pass_rate_formula="=COUNTIF(E:E,\"=Pass\")/(COUNTIF(E:E,\"=Pass\")+COUNTIF(E:E,\"=Fail\"))" # lock = Lock() @allure.feature("测试全部语料") class TestALLWebsocket1: @classmethod def setup_class(cls):
"slotMiss": "false", "suite": "fridge520", "deviceId": "9493427850897384", "userGroup": "meiju", "userGroupCredential": "b82063f4-d39b-4940-91c3-5b67d741b4d3" } yuliao1 = '{}放在哪个位置' yuliao2 = '{}放在冰箱哪个位置' data1 = data data2 = data foodname_data_path = "E:\AITEST\demo\demo_data\冰箱食材清单.xlsx" result_path = "E:\AITEST\demo\demo_data\冰箱食材清单测试结果.xlsx" r = Read_xls(foodname_data_path) foodname_data = r.read_data(start_line=2) # print(foodname_data) new_book = r.copy_book() # foodname=foodname_data[0][redis_case] # yuliao1=yuliao1%foodname # # yuliao2 = yuliao2 % foodname # data1["currentUtterance"]=yuliao1 # result1=Request().requests(url,data1,'POST') # print(result1) # if result1["intent"]["intentType"]=="questionWhichRoomStore": # print("pass") for i in range(len(foodname_data)): foodname = foodname_data[i][1] yuliao1 = yuliao1.format(foodname)
from common.read_xls_news import Read_xls from common.http_request_new import Request from common.conf import Conf from collections import Counter import json, Project_path http_conf_path = Project_path.conf_path + "http.ini" host = Conf(http_conf_path).get_value("HTTP", "sit") path = "E:\AITEST\\testdata\yb101远程控制-自动化案例_new3.xls" conf_path = "E:\AITEST\conf\defaultQueryReply.ini" r = Read_xls(path) w = r.copy_book() url = "%s/v1/auto_test/control/virtual" % host result_path = "E:\AITEST\\testdata\yb101远程控制-自动化案例_new4.xls" data_yb101_0 = json.loads(Conf(conf_path).get_value("AC", "yb101")) data_ac = r.read_data('yb101', start_line=2) for i in range(0, len(data_ac)): text = data_ac[i][4] if "空调" not in text: text = "空调" + text r.write_onlydata(w, i + 1, 4, text, sheetname='yb101') r.save_write(w, result_path)
def get_expectData(product_model, path, result_path, run_num=None): if run_num == None: run_num = 1 host = Conf(http_conf_path).get_value("HTTP", "sit") url = "%s/v1/auto_test/control/virtual" % host data = Default_data(product_model) queryinfo = data['query_reply'] r = Read_xls(path) data_list = r.read_data(product_model, start_line=2) w = r.copy_book() for i in range(len(data_list)): testid = data_list[i][0] tdata = data_list[i][3] try: tts_list = eval(data_list[i][7]) except: tts_list = [] try: testdata = json.loads(tdata) except: testdata = '{' + tdata.replace('&', ',') + '}' try: testdata = json.loads(testdata) except Exception as e: print(e) else: testdata = dict(queryinfo, **testdata) finally: print(testid) data['text'] = data_list[i][4] data["query_reply"] = testdata n = run_num while n > 0: Response = Request().requests(url, data, "POST").json() tts = str(Response['data']['tts']['data'][0]['text']) print(tts) tts_list.append(tts) nlu = Response['data']['nlu'] try: lua = jsonpath.jsonpath(Response, "$..luaData")[0] except Exception as e: lua = '' print(lua) if n == 1: tts_list.append(tts) tts_lists = list(set(tts_list)) print(tts_lists) r.write_onlydata(w, i + 1, 5, str(nlu), sheetname=product_model) r.write_onlydata(w, i + 1, 6, str(lua), sheetname=product_model) r.write_onlydata(w, i + 1, 7, str(tts_lists), sheetname=product_model) else: tts_list.append(tts) n -= 1 i += 1 r.save_write(w, result_path)
from common.T_websocket import WsSingle from common.conf import Conf from common.log import Logger import Project_path import time, pytest, allure conf_path = Project_path.conf_path url = Conf(conf_path + "/ws.ini").get_value("WS", "url") audio_path = Conf(conf_path + "/ws.ini").get_value("WS", "audio_path") test_data_path = Project_path.TestData_path + "/case.xlsx" r = Read_xls(test_data_path) w = r.copy_book() sheet_names = r.get_sheet_names() sheet_name = "002M30_36" testdatas = r.read_data(bookname=sheet_name, start_line=3) # now = time.strftime('%Y-%m-%d-%H-%M-%S') result_path = Project_path.TestResult_path + now + sheet_name + ".xls" pass_num = 0 faile_num = 0 pass_rate = 0 pass_rate_formula = "=COUNTIF(E:E,\"=Pass\")/(COUNTIF(E:E,\"=Pass\")+COUNTIF(E:E,\"=Fail\"))" @allure.feature(sheet_name) class TestWebsocket2: @classmethod def setup_class(cls):