simple_automation_framework(简称:SAF)使用最简单的模式就可以实现需要功能和测试效果,也是xiaobaiauto2的简化版SAF继承了selenium、requests/httpx、appium、loguru、xiaobaiauto2、飞书机器人、钉钉机器人、企业微信机器人(暂时不支持)、禅道提单API
Project description
simlpe_automation_framework
介绍
simple_automation_framework(简称:SAF)
使用最简单的模式就可以实现需要功能和测试效果,也是xiaobaiauto2的简化版
SAF继承了selenium、requests/httpx、appium、loguru、xiaobaiauto2、飞书机器人、钉钉机器人、企业微信机器人(暂时不支持)、禅道提单API
软件架构
xiaobaiauo2的简化版
版本注意
尽量使用Python 3.9.* 版本
防止某些库出现不兼容问题,导致功能不可使用
安装教程
pip config set global.index-url https://pypi.douban.com/simple 注:将pip源修改为国内源
pip install saf
使用说明
- 优先修改saf/data/config.py中飞书/钉钉的webhook
class feishu(object):
@staticmethod
def webhook():
return 'https://open.feishu.cn/open-apis/bot/v2/hook/xxxx'
class dingding(object):
@staticmethod
def webhook():
return 'https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxx'
- conftest.py(保持此文件与用例文件在同目录下)
# filename = conftest.py
from saf import *
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item):
"""
:param item:
"""
outcome = yield
report = outcome.get_result()
if report.outcome == 'failed':
# 调用机器人发送执行结果
robot_send_message(robot_name='feishu', msg=f'测试脚本:{report.nodeid.split("::")[0]}\n测试用例:{report.nodeid.split("::")[1]}\n测试结果:{report.outcome}')
# robot_send_message(robot_name='dingding', msg=f'测试脚本:{report.nodeid.split("::")[0]}\n测试用例:{report.nodeid.split("::")[1]}\n测试结果:{report.outcome}')
# robot_send_message(robot_name='feishu,dingding', msg=f'测试脚本:{report.nodeid.split("::")[0]}\n测试用例:{report.nodeid.split("::")[1]}\n测试结果:{report.outcome}')
- 用例文件
# fielname = test_xiaobai_auto_script.py
def setup_module():
''' 用例脚本执行之前需要准备的信息 '''
...
def teardown_module():
''' 用例脚本执行之后需要清除的信息 '''
def setup_function():
''' 初始化测试用例执行之前状态信息 '''
...
def teardown_function():
''' 清除测试用例执行之后所产生的信息 '''
...
def test_yewu_name_a():
''' 用例函数
需要针对业务场景的测试步骤的实现
1、UI测试就是定位需要操作的界面节点然后执行操作
2、API测试就是执行相关接口实现接口的功能
需要针对每次的结果添加断言进行判断处理
'''
def test_yewu_name_b():
''' 用例函数
需要针对业务场景的测试步骤的实现
1、UI测试就是定位需要操作的界面节点然后执行操作
2、API测试就是执行相关接口实现接口的功能
需要针对每次的结果添加断言进行判断处理
'''
saf>=1.0, 拷贝web自动化模板到D:\autoProject目录下
xiaobaicmd -t web -d D:\autoProject
参与贡献
更新日志
version | info |
---|---|
1.0 | 基本实现web自动化模板功能 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xiaobaisaf-1.0.tar.gz
(22.7 kB
view hashes)
Built Distribution
xiaobaisaf-1.0-py3-none-any.whl
(24.2 kB
view hashes)