xiaobaiauto framework 简化定位并集成日志搜集、报告生成、邮件发送等功能
Project description
xiaobaiAuto
介绍
简化现有框架Selenium对于页面元素的定位及操作,也扩展了日志搜集、报告生成、 邮件发送等功能
软件架构
集成了Selenium、SMTP、HTMLTestRunner、Log等模块
安装教程
pip install xiaobaiAuto
使用代码之前请确保您的电脑中已经安装好浏览器及对应的驱动内容
chrome与chromdriver驱动之间存在不兼容问题,所以最好都下载最新版本为最佳效果
使用说明
Case文件实例
import unittest
from xiaobaiAuto.xiaobaiAuto import Report, log, EmailHandler
class MyTestCase(unittest.TestCase):
def setUp(self):
"""
初始化日志
:return:
"""
self.logger = log()
def test_something(self):
self.assertEqual(True, True)
self.logger.info('提示日志信息')
self.logger.debug('调试日志信息')
self.logger.warning('警告日志信息')
self.logger.error('错误日志信息')
def tearDown(self):
pass
if __name__ == '__main__':
report_file_name = 'TestReport.html'
suite = unittest.TestSuite()
suite.addTest(MyTestCase)
fp = open(report_file_name, 'wb')
runner = Report(
stream=fp,
title='测试',
description='备注信息',
tester='Tser'
)
runner.run(suite)
fp.close()
email = EmailHandler(smtp='smtp.qq.com', port=25, sender_name='qq号', sender_passwd='邮箱密码')
email.sendemail(
_to='接收者邮箱',
_cc='抄送者邮箱',
title='邮件标题',
email_content='邮箱内容',
_type='html',
filename=report_file_name
)
email.quit()
提示
QQ邮箱或者其它企业邮箱必须提前开启SMTP服务
参与贡献
作者: @Tser
©小白科技
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
xiaobaiauto-1.0.tar.gz
(61.6 kB
view hashes)
Built Distribution
xiaobaiauto-1.0-py3-none-any.whl
(61.2 kB
view hashes)
Close
Hashes for xiaobaiauto-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7024a4cf3fad70188bd7b05e56f82ec00bda90289b8179b37d7aa5c57cab2b87 |
|
MD5 | 3680c0a98a1bafaf371bd0488eb26565 |
|
BLAKE2b-256 | c318349f63b2503bd9f87f4407a05684e7b89aa5a6f72c4d93391d4dd0b8c4c7 |