from openpyxl import load_workbook,Workbook
class DoExcel:
def __int__(self,filepath):
self.wb = load_workbook(filepath)
self.sh=self.wb.active
def read_excel(self):
all_casedatas=[]
for row in range(2,self.sh.max_row+1):
case_data={}
case_data[self.sh.cell(row=row,column=1).value]=self.sh.cell(row=row,column=5).value
all_casedatas.append(case_data)
return all_casedatas
single = DoExcel(r"文件路径名").read_excel()
twenty = DoExcel(r"文件路径名").read_excel()
fifty = DoExcel(r"文件路径名").read_excel()
wb = Workbook()
#单线程
for x in range(0,len(single)):
for SingleKey,Singlevalue in single[x].items():
print(x,SingleKey,Singlevalue)
#20线程
for i in range(0,len(twenty)):
for TwentyKey, Twentyvalue in twenty[i].items():
print(i, TwentyKey, Twentyvalue)
if SingleKey.find(TwentyKey)!=-1:
for y in range(0,len(fifty)):
for fiftyKey,fiftyValue in fifty[y].items():
if SingleKey.find(TwentyKey) !=-1 and SingleKey.find(fiftyKey) != -1:
AttenuationValue1 = (Twentyvalue-Singlevalue)/Singlevalue
AttenuationValue2 = (fiftyValue-Singlevalue)/Singlevalue
ws=wb.active
# 接口名称
ws.cell(row=x+2,column=1,value=SingleKey)
#单线程90%line
ws.cell(row=x+2,column=2,value=Singlevalue)
# 多线程90line
ws.cell(row=x+2,column=3,value=Twentyvalue)
# 性能衰减
ws.cell(row=x+2,column=4,value=attenuationValue1)
ws.cell( row=x+2, column=5, value= fiftyValue)
ws.cell( row= x+2, column=6, value= Attenuation Value2)
wb.save(r"D\性能衰减表单.xlsx")
jmeter多并发对比单并发性能衰减
最新推荐文章于 2023-07-19 20:14:47 发布