更新readme文件

This commit is contained in:
wangjie 2024-03-22 16:13:37 +08:00
parent b147737743
commit 1cf3c8883b
10 changed files with 23 additions and 11 deletions

View File

@ -1,9 +1,8 @@
# SensoroApi
# SensoroApiAutoTest
## 联系方式:
- 对本框架有任何疑问均可加入自动化交流群:
![img_2.png](img_2.png)
- 如群二维码过期,请联系我微信拉你入群(记得备注添加原因) wj1641540482
![img_1.png](img_1.png)
- CSDN博客https://blog.csdn.net/weixin_65784341?spm=1011.2415.3001.5343
- 对本框架有任何疑问均可加我微信拉你入自动化交流群(记得备注添加原因) wj1641540482
![img_1.png](files/images/微信二维码.png)
## 实现功能:
- 测试数据隔离, 实现数据驱动
@ -41,7 +40,7 @@
则需要先在终端执行下方的命令将终端编码格式改为utf-8再执行上方install命令即可解决编码问题
* ``` chcp 65001 ```
* 或者直接使用pycharm自带的提示功能安装依赖包推荐这种
![img.png](img.png)
![img.png](files/images/安装提示.png)
## 项目结构
@ -163,7 +162,15 @@
### 2.使用实例
#### 2.1接口定义及测试用例准备
#### 2.1配置项目各环境默认参数
- 在lins_environment.py中进行各个环境相关的基础配置
![img.png](files/images/环境配置.png)
#### 2.2配置项目运行相关参数
- 在settings.py中配置项目运行的环境、通知方式、通知内容等
![img.png](files/images/项目设置.png)
#### 2.3接口定义及测试用例准备
- 定义接口在pageApi目录下设计接口对象
@ -259,7 +266,7 @@ class TestLogin: # 测试类名
expected: '账号异常①,请联系管理员'
```
#### 2.1整体项目运行流程
#### 2.4项目运行
- 方式1在run.py中配置需要运行的测试用例及对整个测试的一些其他配置然后直接右键运行该文件
- 方式2如果在Jenkins上运行可以通过命令行启动的方式执行此方式可以指定运行环境是否发送通知等参数例如python3 run.py

View File

@ -19,6 +19,9 @@ CONFIGS_DIR = os.path.join(BASE_DIR, 'configs')
# datas目录的路径
DATAS_DIR = os.path.join(BASE_DIR, 'datas')
# files目录的路径
FILES_DIR = os.path.join(BASE_DIR, 'files')
# pageApi目录的路径
PAGE_API_DIR = os.path.join(BASE_DIR, 'pageApi')

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 247 KiB

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

BIN
img_2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 KiB

8
run.py
View File

@ -21,7 +21,8 @@ from common.mail_sender import MailSender
from common.robot_sender import EnterpriseWechatNotification
from common.settings import IS_SEND_EMAIL, IS_SEND_WECHAT, wechat_webhook_url, wechat_content, email_content, \
email_config, max_fail, rerun, reruns_delay
from configs.dir_path_config import BASE_DIR, TEMP_DIR, PYTEST_REPORT_DIR, PYTEST_RESULT_DIR, ALLURE_REPORT_DIR
from configs.dir_path_config import BASE_DIR, TEMP_DIR, PYTEST_REPORT_DIR, PYTEST_RESULT_DIR, ALLURE_REPORT_DIR, \
FILES_DIR
from utils.data_handle import DataProcessor
from utils.file_handle import FileHandle
from utils.report_data_handle import ReportDataHandle
@ -72,8 +73,9 @@ if __name__ == '__main__':
# 修改allure报告标题
AllureReportBeautiful.set_report_name("Sensoro自动化测试报告")
# 将本地启动脚本和查看allure报告方法放入报告目录下面
FileHandle.copy_file(BASE_DIR + os.sep + 'open_report.sh', ALLURE_REPORT_DIR)
FileHandle.copy_file(BASE_DIR + os.sep + '查看allure报告方法', ALLURE_REPORT_DIR)
allure_files = os.path.join(FILES_DIR, 'allure_files')
FileHandle.copy_file(allure_files + os.sep + 'open_report.sh', ALLURE_REPORT_DIR)
FileHandle.copy_file(allure_files + os.sep + '查看allure报告方法', ALLURE_REPORT_DIR)
# ------------------------------发送通知消息----------------------------------
# 发送企业微信群聊