1. 程式人生 > >AppUi自動化框架main.py代碼

AppUi自動化框架main.py代碼

font html 測試 測試報告 ini {} port () orm

from lib.path import APPCASE, LOGPATH,APPREPORT
# from lib.HTMLTestAppRunner import HTMLTestRunner
import unittest
from lib.appController import Controller
from BeautifulReport import BeautifulReport
class Main(object):
def __init__(self):
self.controller = Controller()
self.deviceName = self.controller.deviceName


def run(self):
self.controller.start_server()
if self.controller.test_server():
self.controller.start_driver()
suite = unittest.TestSuite()
cases = unittest.defaultTestLoader.discover(APPCASE)
for case in cases:
suite.addTest(case)

run = BeautifulReport(suite)
run.report(filename = ‘{}.html‘.format(self.deviceName),description = ‘用例執行情況‘,
log_path = APPREPORT)
# f = open(APPREPORT.format(‘{}.html‘.format(self.deviceName)), ‘wb‘)
# runner = HTMLTestRunner(f, verbosity=1, title=u‘測試報告‘, description=u‘用例執行情況:‘)

# runner.run(suite)
# f.flush()
# f.close()
if __name__ == ‘__main__‘:
m = Main()
m.run()

AppUi自動化框架main.py代碼