import os
class TestRecord():
def test_image(self):
pic = []
# 设置路径
path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'TestReport', "Screen")
# 获取指定路径下的文件
dirs = os.listdir(path)
# 循环读取路径下的文件并筛选出.png图片
for i in dirs:
if os.path.splitext(i)[-1] == ".png":
pic.append(i)
return pic
def test_log(self):
log = []
# 设置路径
path = os.path.dirname(__file__)
# 获取指定路径下的文件
dirs = os.listdir(path)
# 循环读取路径下的文件并筛选出.log文件
for i in dirs:
if os.path.splitext(i)[-1] == ".log":
log.append(i)
return log
def test_html(self):
html = []
# 设置路径
path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'TestReport')
# 获取指定路径下Test_Report
dirs = os.listdir(path)
# 循环读取路径下的文件并筛选出 .html文件
for i in dirs:
if os.path.splitext(i)[-1] == ".html":
html.append(i)
return html