AutoFramework/Temp/test_case.py

58 lines
1.9 KiB
Python

import sys
import time
import unittest
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from Base.Class.Logger import *
from Base.Class.Http import *
# log = Logger(name='test', level='DEBUG', ch={
# "level": 'DEBUG',
# "format": '{asctime} - {name} - {levelname[0]}: {message}'
# })
log = Logger(name='test', level='DEBUG')
class TestDemo(unittest.TestCase):
def test_one1(self):
time.sleep(0.047)
# import os
# os.system('echo Case One1 Exec...')
# time.sleep(5)
assert 1 == 1
log.i("Info...")
log.w("Warnning...")
print("STDOUT", file=sys.stdout)
print("STDERR", file=sys.stderr)
def test_two22(self):
time.sleep(0.036)
# log.d("正在断言...")
log.e('错误啦!!!')
assert 'A' in 'Hello!', '断言失败'
def test_tre333(self):
print('[TestErrorImg]./01.png[/TestErrorImg]')
a(1)
time.sleep(0.025)
# assert a == 10
def test_fou444(self):
print('[TestErrorImg]./01.png[/TestErrorImg]')
print('[TestErrorImg]./2022072523501942.png[/TestErrorImg]')
print('[TestErrorImg]./2022072523501235.png[/TestErrorImg]')
raise Exception('Errors')
driver_option = Options()
driver_option.binary_location = 'C:/Users/zhaoyafan/AppData/Local/360Chrome/Chrome/Application/360chrome.exe'
browser = webdriver.Chrome(executable_path='D:/ChromeDriver_Win32_86.0.4240.22/chromedriver.exe',options=driver_option)
browser.maximize_window()
browser.get(url='https://www.fanscloud.net/')
# time.sleep(5)
raise Exception('Errors')
def test_0123456789ABC(self):
Request().http('GET',"http://more-md.fanscloud.net/iplookup", proxy="http://127.0.0.1:8888")
pass
if __name__ == '__main__':
unittest.main()