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

网站制作时wordpress 子目录 404

网站制作时,wordpress 子目录 404,保险网站,大于二高端网站建设前言 在编写自动化测试用例的时候经常会遇到需要编写流程性测试用例的场景#xff0c;一般流程性的测试用例的测试步骤比较多#xff0c;我们在测试用例中添加详细的步骤会提高测试用例的可阅读性。 allure提供的装饰器allure.step()是allure测试报告框架非常有用的功能一般流程性的测试用例的测试步骤比较多我们在测试用例中添加详细的步骤会提高测试用例的可阅读性。 allure提供的装饰器allure.step()是allure测试报告框架非常有用的功能它能帮助我们在测试用例中对测试步骤进行详细的描述。 allure.step的使用例子 实现一个购物的场景1.登录2.浏览商品3.将商品加入到购物车中4.下单5.支付订单 # file_name: test_allure_step.pyimport pytest import allureallure.step def login():执行登录逻辑:return:print(执行登录逻辑)allure.step def scan_good():执行浏览商品逻辑:return:print(执行浏览商品逻辑)allure.step def add_good_to_shopping_car():将商品添加到购物车:return:print(将商品添加到购物车)allure.step def generator_order():生成订单:return:print(生成订单)allure.step def pay():支付订单:return:print(支付订单)def test_buy_good():测试购买商品步骤1登录步骤2浏览商品步骤3将商品加入到购物车中步骤4下单步骤5支付:return:login()scan_good()add_good_to_shopping_car()generator_order()pay()with allure.step(断言):assert 1if __name__ __main__:pytest.main([-s, test_allure_step.py])执行命令 pytest test_allure_step.py --alluredir./report/result_data allure serve ./report/result_data查看测试报告展示效果 从报告中可以看到我们事先通过allure.step()定义好的步骤都展示在测试用例test_buy_good()下了。 allure.step支持嵌套step中调用step # file_name: steps.pyimport allureallure.step def passing_step_02():print(执行步骤02)pass测试用例 # file_name: test_allure_step_nested.pyimport pytest import allurefrom .steps import passing_step_02 # 从外部模块中导入allure.step def passing_step_01():print(执行步骤01)passallure.step def step_with_nested_steps():这个步骤中调用nested_step():return:nested_step()allure.step def nested_step_with_arguments(arg1, arg2):passallure.step def nested_step():这个步骤中调用nested_step_with_arguments()并且传递参数:return:nested_step_with_arguments(1, abc)def test_with_imported_step():测试allure.step()支持调用从外部模块导入的step:return:passing_step_01()passing_step_02()def test_with_nested_steps():测试allure.step()支持嵌套调用step:return:passing_step_01()step_with_nested_steps()passing_step_02()if __name__ __main__:pytest.main([-s, test_allure_step_nested.py])执行命令 pytest test_allure_step_nested.py --alluredir./report/result_dataallure serve ./report/result_data查看测试报告展示效果 从上面的结果中可以看到 step可以先保存到其他模块中在测试用例中需要用到的时候导入就可以了step也支持在一个step中嵌套调用其他的step嵌套的形式在测试报告中以树形展示出来了 allure.step支持添加描述且通过占位符传递参数 # file_name: test_allure_step_with_placeholder.pyimport pytest import allureallure.step(这是一个带描述语的step并且通过占位符传递参数positional {0},keyword {key}) def step_title_with_placeholder(arg1, keyNone):passdef test_step_with_placeholder():step_title_with_placeholder(1, keysomething)step_title_with_placeholder(2)step_title_with_placeholder(3, keyanything)if __name__ __main__:pytest.main([-s, test_allure_step_with_placeholder.py])执行命令 pytest test_allure_step_with_placeholder.py --alluredir./report/result_dataallure serve ./report/result_data查看测试报告展示效果 从上面的执行结果中可以看到allure.step()是支持输入描述的并且支持通过占位符向描述中传递参数。 在conftest.py文件中定义allure.step conftest.py文件 # file_name: conftest.pyimport pytest import allurepytest.fixture() def fixture_with_conftest_step():conftest_step()allure.step(这是一个在conftest.py文件中的step) def conftest_step():pass测试用例 # file_name: test_allure_step_in_fixture_from_conftest.pyimport pytest import allureallure.step def passed_step():passdef test_with_step_in_fixture_from_conftest(fixture_with_conftest_step):passed_step()if __name__ __main__:pytest.main([-s, test_allure_step_in_fixture_from_conftest.py])执行命令 pytest test_allure_step_in_fixture_from_conftest.py --alluredir./report/result_dataallure serve ./report/result_data查看测试报告展示效果 从运行结果中可以看到在fixture中定义的step会在setup和teardown单独以树形结构展示出来。 这可能是B站最详细的pytest自动化测试框架教程整整100小时全程实战
http://www.w-s-a.com/news/219361/

相关文章:

  • 云南省滇中引水工程建设管理局网站jsp个人网站设计
  • 网站建设 域名业务 邮箱互联网装饰网站
  • 建设厅技工在哪个网站上查询有了网站模板 还要怎样做
  • 城市联盟网站怎么做百度云网站建设视频教程
  • 织梦cms 官方网站网页视频如何下载到电脑
  • 查询建设公司业绩网站国外外链平台
  • 搭建直播网站需要怎么做做石材网站步骤
  • 移动网站如何做权重wordpress 统计字数 插件
  • 编写网站的软件百度指数教程
  • 网站改版建议策划书做设计什么兼职网站
  • 北京做兼职网站文创产品设计流程
  • 南阳做玉器网站wordpress 图片被缩小
  • 自己做网站卖衣服cms做网站容易不
  • 安徽安搜做的网站怎么样手机网站商城建设答辩问题
  • 分析不同网站的优缺点房产网站定制
  • 深圳工业设计大展2021论坛与网站做优化哪个更好
  • 什么网站做招聘比较好网络营销渠道管理
  • 网站建设选择什么模式淘宝网站可以做轮播吗
  • 山西免费网站制作乌市高新区建设局网站
  • 公司网站建设费用会计处理手机app免费下载
  • 网站的做网站的公司网站有些什么内容
  • 网站新类型wordpress 随机文章
  • 电商网站建设会计分录朝阳市网站公司
  • 正邦网站建设 优帮云百姓网征婚
  • 企业网站有哪些举几个例子端午节网站建设目的
  • 南京免费发布信息网站网站建设与管理职责
  • 无锡市建设培训中心网站企业vi设计是啥
  • 宿松网站建设推荐秒搜科技国家官方网站
  • 网站的服务器选择wordpress文章底部加分享
  • 天津专业的网站建设公司阿里云服务器 wordpress