当前位置: 首页 > 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.hengruixuexiao.com/news/14182.html

相关文章:

  • 论坛怎样发帖推广网站优化建设
  • 做游戏网站多少钱百度指数查询官网大数据
  • 镇江整站优化最近10条重大新闻
  • dramwaver做网站app推广80元一单
  • 免费网站建设是什么微信引流推广
  • 网站搭建同一页不同按钮不同页面客服网站搭建
  • 网站备案提交管局优秀的软文
  • 兰州建设网站的网站seo优化设计
  • 企业网站色彩外贸网站推广方式
  • 政府 门户 网站建设阿里指数
  • 做北美市场用哪个网站百度统计怎么使用
  • 网站开发与设计俄罗斯搜索引擎yandex推广
  • 体育新闻最新消息女排什么是搜索引擎优化的核心
  • 简述企业网站建设的目的店铺推广渠道有哪些
  • 外贸网络做推广公司企业seo推广
  • 承德网站建设电话营销方案ppt
  • 网站 目录访问中国关键词官网
  • 中国商标买卖网站互动营销的案例有哪些
  • 深圳东门步行街地铁站百度提交网站入口
  • 网站开发华企云商app开发价格表
  • 新网站怎么做谷歌推广呢公司seo是指什么意思
  • 做游戏网站的需求分析1688精品货源网站入口
  • 网页qq登录网站扬州百度seo
  • 网站编辑的岗位职责关键词推广计划
  • 铜陵网站建设在线分析网站
  • 做网站用什么软件最简单昆明百度推广开户费用
  • 做社区网站成都关键词快速排名
  • 微网站建设及开发武汉百度百科
  • 手机版网站用什么开发的怎么样创建网站
  • 一个网站建设流程图市场调研分析