From 097722162cb439a820196ffe02c06873ff7824ed Mon Sep 17 00:00:00 2001 From: yuanbaolei <2652612315@qq.com> Date: Wed, 26 Aug 2020 17:00:42 +0800 Subject: [PATCH] =?UTF-8?q?***=201.=E5=A2=9E=E5=8A=A0=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E6=93=8D=E4=BD=9C=E7=B3=BB=E7=BB=9F=E5=81=A5?= =?UTF-8?q?=E5=85=A8=202.=E5=A2=9E=E5=8A=A0xml=E6=B5=8B=E8=AF=95=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logs/1598432167.log | 18 ++++++++++++++++ models/mail.py | 8 +++---- models/osDriver.py | 15 ++++++++++--- reports/XML测试报告示例.xml | 35 +++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 logs/1598432167.log create mode 100644 reports/XML测试报告示例.xml diff --git a/logs/1598432167.log b/logs/1598432167.log new file mode 100644 index 0000000..a984357 --- /dev/null +++ b/logs/1598432167.log @@ -0,0 +1,18 @@ +2020-08-26 16:56:08 [INFO] 当前操作系统:Mac OS +2020-08-26 16:56:10 [INFO] + _ _ + | | | | + ___ ___ | | __| | ___ _ __ ___ +/ __| / _ \| | / _` | / _ \ | '_ ` _ \ +\__ \| __/| || (_| || (_) || | | | | | +|___/ \___||_| \__,_| \___/ |_| |_| |_| +----------------------------------------- + @itest.info + +2020-08-26 16:56:16 [INFO] 👀 assertText: 百度一下. +2020-08-26 16:56:20 [INFO] 👀 assertText: 百度一下. +2020-08-26 16:56:25 [INFO] 👀 assertText: 百度一下. +2020-08-26 16:56:30 [INFO] 👀 assertText: 百度一下. +2020-08-26 16:56:34 [INFO] 👀 assertText: 百度一下. +2020-08-26 16:56:34 [INFO] generated html file: file:////Users/yuanbaolei/work/GitHub/UIautoDemo/reports/2020_08_26_16_56_10_result.html +2020-08-26 16:56:38 [ERROR] ❌ Email failed to send!!(535, b'Error: authentication failed') diff --git a/models/mail.py b/models/mail.py index 4279364..d678b9c 100644 --- a/models/mail.py +++ b/models/mail.py @@ -10,11 +10,9 @@ import time def sendMail(user, password, host, to, subject=None): - smtp = SMTP(user=user, password=password, host=host) - time.sleep(3) try: + smtp = SMTP(user=user, password=password, host=host) + time.sleep(3) smtp.sender(to=to, subject=subject) - smtp.sender(to=to) - return print('📮 Email sent successfull!') except Exception as error: - return error, print('❌ Email failed to send!\n', error) + return error diff --git a/models/osDriver.py b/models/osDriver.py index b715ad1..8c0673b 100644 --- a/models/osDriver.py +++ b/models/osDriver.py @@ -1,4 +1,5 @@ import platform +from seldom.logging import log """ # 判断当前操作系统环境;以此来自动选择不同浏览器环境的驱动 @@ -8,13 +9,21 @@ import platform def osSystem(path=''): os_system = platform.system() if os_system == 'Windows': - print('当前操作系统:Windows') + log.info('当前操作系统:Windows') pathWin = path + r'Browser_Driver/chromedriver84(win32).exe' return pathWin - if os_system == 'Darwin' or 'darwin' or 'Mac' or 'mac' or 'OS X': - print('当前操作系统:Mac OS') + elif os_system == 'Darwin' or \ + os_system == 'darwin' or \ + os_system == 'Mac' or \ + os_system == 'mac' or \ + os_system == 'OS X': + log.info('当前操作系统:Mac OS') pathMac = path + r'Browser_Driver/chromedriver84(Mac64)' return pathMac + else: + log.error("当前操作系统 " + os_system) + raise SystemExit(log.error(' ❌ The current operating system environment is not Windows or Mac, ' + 'please confirm the current environment!!')) if __name__ == '__main__': diff --git a/reports/XML测试报告示例.xml b/reports/XML测试报告示例.xml new file mode 100644 index 0000000..1df7eb0 --- /dev/null +++ b/reports/XML测试报告示例.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +