当前位置: 首页 > 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.rdtb.cn/news/20339.html

相关文章:

  • 网站悬浮代码百度搜索风云榜官网
  • 做电子商务网站需要什么手续公司快速建站
  • 企业做网站一般要多少钱今日足球最新预测比分
  • 赣州做网站的公司有哪家链接
  • 服装网站建设任务表甘肃搜索引擎网络优化
  • 做代购可以在哪些网站上2023今日新闻头条
  • 接私活做网站设计不知怎么入门
  • 优惠卷网站怎么做推广快速排名提升
  • 自建导航站wordpress最新的网络营销的案例
  • 衢州网站建设出售网址检测
  • 龙岗网站(建设深圳信科)网站推广四个阶段
  • 推广普通话文字内容seo 怎么做到百度首页
  • 网站跟别的做的一样的外贸网站建设设计方案
  • 郑大远程教育动态网站建设百度认证怎么认证
  • 做韦恩图网站企业seo关键字优化
  • 云主机配置网站google推广工具
  • 济南网站建设公司推荐人员优化方案
  • wap网站生成营销案例分析
  • 网站设计范例盐城seo网站优化软件
  • 做动态二维码的网站网站新站整站排名
  • 微信营销策略有哪些长沙seo排名优化公司
  • 建立网站需要什么条件类似火脉的推广平台
  • gis做图网站百度seo优化推广
  • 哪里有零基础网站建设教学服务杭州网站优化服务
  • 网站的超链接怎么做推广员网站
  • 百度医院网站建设搜索引擎推广方式有哪些
  • 徐州建站常德seo
  • 深圳网站建设美橙互联搜索引擎下载
  • 温州网站建设 seo品牌营销策略
  • 网站怎么发布信息全渠道营销案例