Comments (1)
通过在日志中打印截图路径,获取截图转base64,添加到报告中
if getattr(test, 'images', []):
tmp = ""
hidde_status = ''
for i, img in enumerate(test.images):
if i == 0:
tmp += """<img src="data:image/jpg;base64,{}" style="display: block;" class="img"/>\n""".format(img)
else:
tmp += """<img src="data:image/jpg;base64,{}" style="display: none;" class="img"/>\n""".format(img)
screenshots_html = CustomTemplate.IMG_TMPL.format(images=tmp)
else:
screenshots_html = """"""
unum = str(uo).rfind('screenshot_path:')
if (uo or ue) and unum != -1:
hidde_status = ''
left_key = str(uo).rfind('screenshot_path:')
right_key = str(uo).rfind('png')
image_path = str(uo)[left_key+16:right_key + 3].replace(' ', '')
# 打开并读取图片文件
with open(image_path, 'rb') as img_file:
img_data = img_file.read()
# 使用base64库将图片数据编码
encoded_img = base64.b64encode(img_data).decode('utf-8')
tmp += """<img src="data:image/jpg;base64,{}" class="img"/>\n""".format(encoded_img)
screenshots_html = CustomTemplate.IMG_TMPL.format(images=tmp)
from xtestrunner.
Related Issues (20)
- 想求支持一波pytest HOT 1
- 测试报告数据量较大时,网页直接卡死 HOT 1
- 期望可以增加获取概览信息的api, 信息可以包括:执行日期,执行时长,执行总数,执行成功条数,失败条数,成功率,失败率,请求的耗时分布 HOT 2
- 用“seldom -h2c“生成的测试用例,执行XTestRunner报错,count没统计到。如图 HOT 3
- unittest中的subTest()方法导致失败的case未被捕捉到 HOT 3
- some blanks in report detail
- 【功能】用例运行支持多线程
- xml 格式的报告记录 注释 HOT 2
- 跳过用例时,报告中无法隐藏用例 HOT 1
- 期望在邮件的报告中增加一个字段:用例总数
- 【bug】 seldom 使用参数化,其中某一条用例错误,被统计到了失败中
- 【需求】 xml 报告支持用例重试 HOT 1
- 【需求】 支持 SMTP_SSL 和 SMTP 两种方式
- 近期的修改报 No module named 'XTestRunner' HOT 6
- 【bug】 出现删除日志 hander_id 错误 HOT 1
- 输出的测试报告统计结果错误 HOT 2
- 求助:发送邮件功能报错提示“smtplib.SMTPResponseException: (454, b'Command not permitted when TLS active')” HOT 2
- 在linux容器中运行脚本时,没有执行到用例 HOT 2
- 【需求】 弹窗截图,鼠标点击空白区域 & ESC键 ,关闭弹窗
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xtestrunner.