当前位置: 首页 > news >正文

东莞莞城网站建设公司wordpress数据库路径

东莞莞城网站建设公司,wordpress数据库路径,郑州高端建站,网站快照时间目录#xff1a; allure2报告中添加附件-图片 Allure2报告中添加附件Allure2报告中添加附件#xff08;图片#xff09;应用场景Allure2报告中添加附件#xff08;图片#xff09;-Python代码示例#xff1a;allure2报告中添加附件-日志 Allure2报告中添加附件#xff…目录 allure2报告中添加附件-图片 Allure2报告中添加附件Allure2报告中添加附件图片应用场景Allure2报告中添加附件图片-Python代码示例allure2报告中添加附件-日志 Allure2报告中添加附件日志应用场景代码示例allure2报告中添加附件-html Allure2报告中添加附件html应用场景语法代码示例allure2报告中添加附件-视频 Allure2报告中添加附件视频应用场景语法代码示例终端运行 1.allure2报告中添加附件-图片 Allure2 报告中添加附件 TEXT (text/plain, txt) CSV (text/csv, csv) TSV (text/tab-separated-values, tsv) URI_LIST (text/uri-list, uri)HTML (text/html, html) XML (application/xml, xml) JSON (application/json, json) YAML (application/yaml, yaml) PCAP (application/vnd.tcpdump.pcap, pcap)PNG (image/png, png) JPG (image/jpg, jpg) SVG (image/svg-xml, svg) GIF (image/gif, gif) BMP (image/bmp, bmp) TIFF (image/tiff, tiff)MP4 (video/mp4, mp4) OGG (video/ogg, ogg) WEBM (video/webm, webm)PDF (application/pdf, pdf) Allure2 报告中添加附件图片应用场景 应用场景在做 UI 自动化测试时可以将页面截图或者出错的页面进行截图将截图添加到测试报告中展示辅助定位问题。解决方案 Python使用 allure.attach 或者 allure.attach.file() 添加图片。Java直接通过注解或调用方法添加。 Allure2 报告中添加附件图片- Python 语法allure.attach.file(source, name, attachment_type, extension)参数解释 source文件路径相当于传一个文件。name附件名字。attachment_type附件类型是 allure.attachment_type 其中的一种(支持 PNG、JPG、BMP、GIF 等)。extension附件的扩展名。   代码示例 test_order.py import allureclass TestWithAttach:def test_pic(self):allure.attach.file(./img/111.jpg,name这是一个图片,attachment_typeallure.attachment_type.JPG,extensionjpg) 终端运行 语法allure.attach(body, nameNone, attachment_typeNone, extensionNone):参数解释 body要写入附件的内容name附件名字。attachment_type附件类型是 allure.attachment_type 其中的一种(支持 PNG、JPG、BMP、GIF 等)。extension附件的扩展名。   import allureclass TestWithAttach:def test_pic2(self):with open(./img/111.jpg, moderb) as f:file f.read()allure.attach(file, 页面截图, attachment_typeallure.attachment_type.JPG) 终端运行 2.allure2报告中添加附件-日志 Allure2 报告中添加附件日志应用场景 应用场景报告中添加详细的日志信息有助于分析定位问题。解决方案 Python使用 python 自带的 logging 模块生成日志日志会自动添加到测试报告中。Java直接通过注解或调用方法添加。日志配置在测试报告中使用 logger 对象生成对应级别的日志。  代码示例 log_util.py import logging import osfrom logging.handlers import RotatingFileHandler# 绑定绑定句柄到logger对象 logger logging.getLogger(__name__) # 获取当前工具文件所在的路径 root_path os.path.dirname(os.path.abspath(__file__)) # 拼接当前要输出日志的路径 log_dir_path os.sep.join([root_path, f/logs]) if not os.path.isdir(log_dir_path):os.mkdir(log_dir_path) # 创建日志记录器指明日志保存路径,每个日志的大小保存日志的上限 file_log_handler RotatingFileHandler(os.sep.join([log_dir_path, log.log]), maxBytes1024 * 1024, backupCount10 , encodingutf-8) # 设置日志的格式 date_string %Y-%m-%d %H:%M:%S formatter logging.Formatter([%(asctime)s] [%(levelname)s] [%(filename)s]/[line: %(lineno)d]/[%(funcName)s] %(message)s , date_string) # 日志输出到控制台的句柄 stream_handler logging.StreamHandler() # 将日志记录器指定日志的格式 file_log_handler.setFormatter(formatter) stream_handler.setFormatter(formatter) # 为全局的日志工具对象添加日志记录器 # 绑定绑定句柄到logger对象 logger.addHandler(stream_handler) logger.addHandler(file_log_handler) # 设置日志输出级别 logger.setLevel(levellogging.INFO) test_order.py  import allure from utils.log_util import loggerallure.epic(需求1) allure.feature(功能模块1) class TestEpic:allure.story(子功能1)allure.title(用例1)def test_case1(self):logger.info(这是TestEpic 第一条用例)print(用例1)allure.story(子功能2)allure.title(用例2)def test_case2(self):logger.debug(这是TestEpic 第二条用例)print(用例2)allure.story(子功能2)allure.title(用例3)def test_case3(self):logger.warning(这是TestEpic 第三条用例)print(用例3)allure.story(子功能1)allure.title(用例4)def test_case4(self):logger.error(这是TestEpic 第四条用例)print(用例4) 终端运行 日志展示在 Test body 标签下标签下可展示多个子标签代表不同的日志输出渠道 log 子标签展示日志信息。stdout 子标签展示 print 信息。stderr 子标签展示终端输出的信息。 禁用日志可以使用命令行参数控制 --allure-no-capture pytest --alluredir ./results --clean-alluredir --allure-no-capture 3.allure2报告中添加附件-html Allure2 报告中添加附件html应用场景 应用场景可以定制测试报告页面效果可以将 HTML 类型的附件显示在报告页面上。解决方案 Python使用 allure.attach() 添加 html 代码。Java直接通过注解或调用方法添加。 语法 allure.attach(body, name, attachment_type, extension)参数解释 body要写入附件的内容(HTML 代码块)。name附件名字。attachment_type附件类型是 allure.attachment_type 其中的一种。extension附件的扩展名。 代码示例 import allureclass TestWithAttach:def test_html(self):allure.attach(head/headbody a page /body,附件是HTML类型,allure.attachment_type.HTML)def test_html_part(self):allure.attach(html代码块,附件是HTML类型,allure.attachment_type.HTML) 终端运行 4.allure2报告中添加附件-视频 Allure2 报告中添加附件视频应用场景 应用场景在做 UI 自动化测试时可以将页面截图或者出错的页面进行截图将截图添加到测试报告中展示辅助定位问题。解决方案 Python使用 allure.attach.file() 添加视频。Java直接通过注解或调用方法添加。 语法 allure.attach.file(source, name, attachment_type, extension)参数解释 source文件路径相当于传一个文件。name附件名字。attachment_type附件类型是 allure.attachment_type 其中的一种。extension附件的扩展名。 代码示例 import allureclass TestWithAttach:def test_video(self):allure.attach.file(./mp4/111.mp4,name视频,attachment_typeallure.attachment_type.MP4,extensionmp4) 终端运行
http://www.pierceye.com/news/938210/

相关文章:

  • 免费建建网站域名没过期 网站打不开怎么办
  • 单页企业网站模板WordPress社团展示
  • 网站建设需要具备什么条件网站首页新世纪建设集团有限公司
  • 网站怎样做超链接si设计公司
  • 婚恋网站排名前三wordpress首页设置成文章还是页面
  • 制作网站 优帮云一键提交各大收录
  • 网站要怎么做才专业2022电商平台用户排行榜
  • 男男做暧网站免费网站建设期末论文
  • 电子政务门户网站建设wordpress 导入
  • 江苏建设监理协会网站网站建设siteserver
  • 家庭做网站做网站服务器可以挂到外地么
  • 做相册的网站 网易wordpress云服务器
  • 国内网站没备案自己做外贸购物网站
  • 国外h5网站模板下载长沙快速建站模板
  • 湛江网站建设方案找工程项目
  • 孝感住房和城乡建设部网站深圳市做网站公司
  • 网站开发环境配置做一个信息网站多少钱
  • 小企业网站建设的小知识wordpress显示关闭评论框
  • vue.js 可以做网站吗注册一个公司一年费用
  • 软件开发网站策划方案百度网站怎么用
  • 网站分页符素材wordpress自定义密码
  • 建设银行公积金预约网站首页大宗商品交易平台政策
  • 口碑好的秦皇岛网站建设哪里有沙漠网站建设
  • 推荐外贸网站建设的公司聊城做网站费用价格
  • 在线设计的网站android 网站开发
  • 河北省建设厅网站官网织梦手机网站制作
  • 网站建设管理物联网的发展前景
  • 广州网站建设外贸做vip视频网站赚钱吗
  • 模板网建站山西 网站制作
  • 网站建设捌金手指花总二七网页制作与设计的内容