# pytest测试框架 **Repository Path**: joyamon/pytest-test-framework ## Basic Information - **Project Name**: pytest测试框架 - **Description**: pytest测试框架 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-01-12 - **Last Updated**: 2023-11-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 数据驱动测试框架 #### 一.框架结构 ​ ![](C:./pytest-test-framework/pytestTestFramework/pictures/frame.png) * common ```yaml common目录下存放一些公共方法: __init__.py # Python中package的标识文件 cmd.py # 复制文件 get_case_file.py #获取目录下的文件名称 readYaml.py #读取yaml文件 writeTxt.py #向text文件写入数据 writeYaml.py #向yaml文件写入数据 ``` ​ ![](C:./pytestTestFramework/pictures/common.png) * config ```yaml config包下包含读取配置文件的方法和ini配置文件 __init__.py # Python中package的标识文件 read_config.py # 读取配置文件方法 router.ini # 配置文件 ``` ​ ![](C:./pytestTestFramework/pictures/config.png) * dataModels ```yaml dataModels目录如下: query.yaml # 生成测试用例模板文件 ``` ​ ![](C:./pytestTestFramework/pictures/dataModels.png) * executionTestcases ```yaml executionTestcases目录如下: test_cases.py # 用于组织测试用例 context.py # 处理接口上下文方法 ``` ​ ![](C:./pytestTestFramework/pictures/executionTestcases.png) * logs ```yaml logs 目录如下: makelog.py # 生成日志的方法 log-2022-09-09.log # 生成日志文件 ``` ​ ![](C:./pytestTestFramework/pictures/logs.png) * pictures ```yaml pictures存放项目图片 ``` ​ ![](C:./pytestTestFramework/pictures/pictures.png) * processingContext ```yaml processingContext目录如下; replace.py # 依赖模板生成测试用例数据 ``` ​ ![](C:./pytestTestFramework/pictures/processingContext.png) * register_dataModels ```yaml register_dataModels目录如下: dataModels_filename.yaml # 注册模板文件名称 ``` ​ ![](C:./pytestTestFramework/pictures/register_dataModels.png) * allure-result ```yaml report # 测试报告 *.json # 测试报告json数据 environment.properties # 测试报告 environment 配置数据 打开测试报告.bat # 用于本地打开测试报告 ``` ​ ![](C:./pytestTestFramework/pictures/report.png) * request ```yaml request目录如下: __init__.py # Python中package的标识文件 request_method.py # 发送请求方法 ``` ​ ![](C:./pytestTestFramework/pictures/request.png) * settings ```yaml settings目录如下: __init__.py # Python中package的标识文件 settings.py # 查找项目目录(文件)方法 ``` ​ ![](C:./pytestTestFramework/pictures/settings.png) * testcases ```yaml testcases 目录存放测试用例数据(由模板自动生成,无需创建) getToken.yaml query.yaml ``` ​ ![](C:./pytestTestFramework/pictures/testcases.png) * run.py ```yaml run.py # 程序运行入口 ``` ​ ![](C:./pytestTestFramework/pictures/run.png)