1.增加检查本地操作系统健全
2.增加xml测试报告示例
This commit is contained in:
yuanbaolei 2020-08-26 17:00:42 +08:00
parent 73bf288a67
commit 097722162c
4 changed files with 68 additions and 8 deletions

18
logs/1598432167.log Normal file
View File

@ -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')

View File

@ -10,11 +10,9 @@ import time
def sendMail(user, password, host, to, subject=None): def sendMail(user, password, host, to, subject=None):
smtp = SMTP(user=user, password=password, host=host)
time.sleep(3)
try: try:
smtp = SMTP(user=user, password=password, host=host)
time.sleep(3)
smtp.sender(to=to, subject=subject) smtp.sender(to=to, subject=subject)
smtp.sender(to=to)
return print('📮 Email sent successfull')
except Exception as error: except Exception as error:
return error, print('❌ Email failed to send\n', error) return error

View File

@ -1,4 +1,5 @@
import platform import platform
from seldom.logging import log
""" """
# 判断当前操作系统环境;以此来自动选择不同浏览器环境的驱动 # 判断当前操作系统环境;以此来自动选择不同浏览器环境的驱动
@ -8,13 +9,21 @@ import platform
def osSystem(path=''): def osSystem(path=''):
os_system = platform.system() os_system = platform.system()
if os_system == 'Windows': if os_system == 'Windows':
print('当前操作系统Windows') log.info('当前操作系统Windows')
pathWin = path + r'Browser_Driver/chromedriver84(win32).exe' pathWin = path + r'Browser_Driver/chromedriver84(win32).exe'
return pathWin return pathWin
if os_system == 'Darwin' or 'darwin' or 'Mac' or 'mac' or 'OS X': elif os_system == 'Darwin' or \
print('当前操作系统Mac OS') 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)' pathMac = path + r'Browser_Driver/chromedriver84(Mac64)'
return pathMac 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__': if __name__ == '__main__':

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite errors="0" failures="0" file="test01_login.py" name="test01_login.test01_login-20200826164952" skipped="0" tests="5" time="22.925" timestamp="2020-08-26T16:50:16">
<testcase classname="test01_login.test01_login" file="test_case/test01_login.py" line="34" name="test01" time="4.667" timestamp="2020-08-26T16:49:58">
<!--测试示例1-->
<system-out>
<![CDATA[用例说明test01
]]> </system-out>
</testcase>
<testcase classname="test01_login.test01_login" file="test_case/test01_login.py" line="41" name="test02" time="4.547" timestamp="2020-08-26T16:50:02">
<!--测试示例2-->
<system-out>
<![CDATA[用例说明test02
]]> </system-out>
</testcase>
<testcase classname="test01_login.test01_login" file="test_case/test01_login.py" line="49" name="test03" time="4.538" timestamp="2020-08-26T16:50:07">
<!--测试示例3-->
<system-out>
<![CDATA[用例说明test03
]]> </system-out>
</testcase>
<testcase classname="test01_login.test01_login" file="test_case/test01_login.py" line="56" name="test04" time="4.600" timestamp="2020-08-26T16:50:11">
<!--测试示例4-->
<system-out>
<![CDATA[用例说明test04
]]> </system-out>
</testcase>
<testcase classname="test01_login.test01_login" file="test_case/test01_login.py" line="63" name="test05" time="4.573" timestamp="2020-08-26T16:50:16">
<!--测试示例5-->
<system-out>
<![CDATA[用例说明test05
]]> </system-out>
</testcase>
</testsuite>
</testsuites>