jmeter生成报告结果
由于jmeter生成报告的方式是内部引用变量,无法从某个节点取到对应数值,只能通过读取报告数值,然后取出来作为python请求接口的变量参数使用。
查看报告样式
python读取报告指定内容方法
import urllib
import http.cookiejar
from urllib import request
from bs4 import BeautifulSoup
# 读取本地报告html文件
path = 'D:\\ant\\ResultReport\\html\\接口测试报告201902260414.html'
with open(path, 'r',encoding='utf-8') as f:
Soup = BeautifulSoup(f.read(), 'lxml')
titles = Soup.select('html > body > table > .Failure > td')
lists = []
for title in titles:
lists.append(title.text)
print(lists)
执行脚本,查看返回结果
根据python数组,打印对应需要的返回值即可