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

网站分为哪几个部分深圳网络络推广培训

网站分为哪几个部分,深圳网络络推广培训,淘客网站 源码,莆田外贸网站建设目录 1. 搭建allure环境 2. 生成报告 3. logo定制 4. 企业级报告内容或层级定制 5. allure局域网查看 1. 搭建allure环境 1.1 JDK,使用PyCharm 找到pycharm安装目录找到java.exe记下jbr目录的完整路径,eg: C:\Program Files\JetBrains\PyCharm Com…

目录

1. 搭建allure环境

2. 生成报告

3. logo定制

4. 企业级报告内容或层级定制

5. allure局域网查看


1. 搭建allure环境

1.1 JDK,使用PyCharm

  1. 找到pycharm安装目录
  2. 找到java.exe
  3. 记下jbr目录的完整路径,eg: C:\Program Files\JetBrains\PyCharm Community Edition 2022.3\jbr\bin
  4. 将地址添加进入环境变量
  5. 重启

1.2 allure程序

  1. 下载地址:https://github.com/allure-framework/allure2/releases
  2. 解压到指定路径。eg: D:\study\allure-2.25.0\allure-2.25.0\bin
  3. 执行allure
  4. Path 追加allure安装路径
  5. 验证是否安装成功:在dos窗口和Pycharm(需要重启加载环境变量)中都需要验证:allure --version

2. 生成报告

2.1 生成临时的json格式的报告

addopts = -vs --alluredir=./temps --clean-alluredir
; --clean-alluredir生成临时报告并清除

2.2 生成HTML的allure报告

if __name__ == "__main__":pytest.main(['./test_study/test_fixture.py'])os.system("allure generate ./temps -o ./reports --clean") # -o 指定输出测试报告路径# --clean 清空历史数据# ./temps 表示用来生成html的JSON临时文件目录# ./reports 表示html文件生成目录

3. logo定制

3.1 在D:\study\allure-2.25.0\allure-2.25.0\config目录下的allure.yml中配置自定义的logo插件【- custom-logo-plugin】

3.2 重新运行并生成allue报告

3.3 增加一个自己的logo文件并修改D:\study\allure-2.25.0\allure-2.25.0\plugins\custom-logo-plugin\static路径下的styles.css文件里面的样式(最好将需要修改的logo也放在custom-logo-plugin目录下)

.side-nav__brand {background: url('1.png') no-repeat left center !important; //将你需要的logo图片地址放在这里margin-left: 22px; //调整方位height: 90px; //调整大小background-size: contain !important;
}
//去掉图片后边 allure 文本
.side-nav__brand-text{display: none; 
}
//配置logo 后面的字体样式与字体大小
.side-nav__brand:after {content: "测试测试";margin-left: 18px;height: 20px;font-family: Arial;font-size: 13px;
}

 注:logo图片和文字可以同时存在,也可以只要一个

4. 企业级报告内容或层级定制

左边:

1. 项目名称(史诗):@allure.epic("测试报告")

2. 模块名称(特性):@allure.feature("测试模块")

3. 接口名称(分组):@allure.story("测试接口")

@allure.epic('测试报告')
@allure.feature('测试模块')
class TestA:@allure.story('测试1')def test_1(self):print('11111')@allure.story('测试2')def test_2(slef):print('22222')

 将多个用例写到一个组:

@allure.story('测试1')
@allure.title('用例1')
def test_1(self):print('11111')@allure.story('测试1')
def test_2(slef):allure.dynamic.title('用例2')print('22222')

4. 用例标题:@allure.title("用例1") or allure.dynamic.title('用例2') 两种方法都可以实现

@allure.title('用例1') //方法1
def test_1(self):print('11111')@allure.story('测试2')
def test_2(slef):allure.dynamic.title('用例2') //方法2print('22222')

 右边:

1. 测试用例严重级别:@allure.severity(allure.severity_level.BLOCKER) //BLOCKER(致命),CRITICAL(严重),NORMAL(一般),MINOR(提示),TRIVIAL(轻微),一般默认为NORMAL

@allure.severity(allure.severity_level.TRIVIAL)
@allure.story('测试3')
def test_3(slef):print('33333')

 2. 测试用例的描述:@allure.description("测试用例的描述")

@allure.description("测试用例的描述方法1")
@allure.title('测试4')
def test_4(slef):print('44444')@allure.title('测试5')
def test_5(slef):allure.dynamic.description("测试用例的描述方法2")print('55555')

3. 接口访问链接:@allure.link("接口链接")

4. BUG链接:@allure.issue("bug链接")

5. 测试用例链接:@allure.testcase("用例链接")

@allure.story('测试6')
@allure.link('https://www.baidu.com/0',name='接口链接')
@allure.issue('https://www.baidu.com/',name='bug链接')
@allure.testcase('https://www.baidu.com/',name='用例链接')
def test_6(slef):print('66666')

6. 测试用例的操作步骤:allure.step("第"+str(i)+"步"):

@allure.story('测试1')
def test_7(self):for i in range(0,10):with allure.step("第"+str(i)+"步"):pass

7. 测试附件:allure.attach(body=content,name="错误截图",attachment_type=allure.attachment_type.PNG) //一般用于错误截图(常用于web自动化测试)

@allure.story('测试1')
def test_8(self):# 附件上传需要使用二进制,可以是图片,可以是文本,可以是其它文件with open(r'D:\study\allure-2.25.0\allure-2.25.0\plugins\custom-logo-plugin\static\1.png',mode='rb') as f:content = f.read()allure.attach(body=content,name='错误截图',attachment_type=allure.attachment_type.PNG)

8. 文本内容的定制:一般应用于接口自动化

@allure.story('测试1')
def test_9(self):# 请求allure.attach('https://www.baidu.com/0',name='接口地址',attachment_type=allure.attachment_type.TEXT)allure.attach('接口参数,一般从yaml中获取',name='接口参数',attachment_type=allure.attachment_type.TEXT)allure.attach('请求方式:get/post',name='请求方式',attachment_type=allure.attachment_type.TEXT)allure.attach('请求头,一般从yaml中获取',name='请求头',attachment_type=allure.attachment_type.TEXT)# 响应allure.attach('响应文本,一般从yaml中获取', name='响应文本', attachment_type=allure.attachment_type.TEXT)allure.attach('执行结果:成功/失败', name='执行结果', attachment_type=allure.attachment_type.TEXT)

9. 数据驱动:

@allure.story('测试1')
@pytest.mark.parametrize('x', ['这是第1个测试值', "这是第2个测试值"])
def test_a(self,x):print(f'test_a中的X值为{x}')

 由于使用数据驱动,用例标题会展示参数数据化驱动中的所有参数,若不想要显示则需要修改allure配置

# 修改前
test_result.parameters.extend([Parameter(name=name, value=represent(value)) for name, value in params.items()if name not in current_param_names])# 修改后 (将列表内容去除即可)     
test_result.parameters.extend([])

5. allure局域网查看

局域网(内网):allure open ./reports

if __name__ == "__main__":pytest.main(['./test_study/test_allure.py'])os.system("allure generate ./temps -o ./reports --clean")os.system("allure open ./reports")

http://www.tj-hxxt.cn/news/28076.html

相关文章:

  • metro网站模板深圳网络品牌推广公司
  • 游戏推广群百度关键字优化价格
  • 手机微信网站开发教程推广公司是做什么的
  • 网站免费推广方案太极seo
  • 怎样做网站公司的销售百度推广开户免费
  • 网站域名备案和做网站如何优化关键词的排名
  • 企业为什么需要流程管理网站页面优化内容包括哪些
  • 我的世界做封面网站小程序免费制作平台
  • 域名还没备案可以做网站吗360渠道推广系统
  • 网站建设企业有哪些方面陕西优化疫情防控措施
  • 减粘装置设备设计要点杭州seo营销
  • 在线做海报网站移动端排名优化软件
  • brophp框架做网站品牌咨询
  • 网站建设公司好不好厦门seo专业培训学校
  • 中国建设银行网站登录不了760关键词排名查询
  • 给设计网站做图成都百度搜索排名优化
  • 网站站内优化怎么做百度的网址
  • 网站建设软件下载公众号软文怎么写
  • 网站建设 项目要求无锡百度信息流
  • 营销型网站建设公司易网拓百度站长seo
  • 用word做网站首页谷歌商店下载不了软件
  • 日韩网站模板源码网络营销技巧培训
  • 河南网站制作广告推广平台代理
  • 北京专业网站改版网站优化公司哪家效果好
  • 武汉高端网站制作蜜雪冰城网络营销案例分析
  • 做网站销售一个星期的计划色盲能治好吗
  • 车陂手机网站建设网络营销的招聘信息
  • 佛山网站建设外包满足seo需求的网站
  • asp.net 网站建设新东方在线网上课程
  • 做网站推广员工泸州网站优化推广