学无先后,达者为师

网站首页 Python教程 正文

UI自动化之python+pytest+allure+selenium

作者:Gia_ouyang 更新时间: 2021-12-02 Python教程

一、基础搭建

1.下载pycharm,配置环境变量
2.安装对应版本的webdriver,将webdriver放在项目根目录
3.pip install pytest
4.pip install allure

二、框架设计

在这里插入图片描述

三、目录详解

1.common读取yaml文件
yaml_handle.py
在这里插入图片描述
2.config 路径及环境配置
1)config.yaml
在这里插入图片描述
2)path.py
在这里插入图片描述
3.pages页面方法封装
包括url打开,页面元素点击等操作,采用PO模式
注意:每个页面分开写,即一个页面一个py文件
在这里插入图片描述
4.report文件夹,存放测试报告,此处不做概述

5.testcase测试用例
文件命名规则test_*.py
在这里插入图片描述
6.conftest.py前后置
放在全局,那就是全局性前后置
在这里插入图片描述
7.pytest.ini运行参数配置
在这里插入图片描述

8.run.py执行文件
在这里插入图片描述

原文链接:https://blog.csdn.net/Gia_ouyang/article/details/122124455

栏目分类
最近更新