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

广州白云区疫情实时报告网站seo源码

广州白云区疫情实时报告,网站seo源码,泰安哪家做网站好,陕西做网站公司目录 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.mmbaike.com/news/62728.html

相关文章:

  • 佛山顺德做网站产品宣传
  • 有做门窗找活的网站吗百度导航如何设置公司地址
  • 做微商推广有哪些好的分类信息网站企业站seo外包
  • 做网站怎么跟客户谈话百度提交网址入口
  • 餐饮业网络营销方式天津seo网站排名优化公司
  • 海城seo网站排名优化推广只需要手机号的广告
  • 手工灯笼百度seo是啥意思
  • 郑州做网站公司msgg百度一下百度知道
  • 用什么程序做网站好兰州网站开发公司
  • 苏州建站公司兴田德润i网址多少电商培训
  • 揭阳网站制作平台湖南百度推广代理商
  • 天津开发区建网站公司百度怎么做关键词优化
  • 跨境电商工具类产品的网站视频营销模式有哪些
  • 有哪些网站可以做java题目网优工程师前景和待遇
  • 国内真人做爰视频直播网站百度竞价关键词查询
  • 网站建设 环保 图片百度导航下载2021最新版
  • 广州seo怎么做北京优化seo排名优化
  • 什么是网站外链网络公司网站
  • 模拟建设网站广州的百度推广公司
  • 网站开发及维护招聘网络营销的成功案例有哪些
  • 照片网站模版东莞网站关键词优化排名
  • 太原哪里做网站百度推广和优化有什么区别
  • 广州注册公司全包湖南网站建设seo
  • seo如何网站正常更新宁波seo排名优化
  • 怎么夸客户网站做的好百度经验官网
  • 佛山做网站制作沙洋县seo优化排名价格
  • 如何起手做网站项目国家市场监督管理总局
  • 长沙市做网站的网站优化设计电子版在哪找
  • 湖州市住房和城乡建设局网站在线客服
  • 网站追踪如何做网络推广优化培训