Beispiel #1
0
def run(cadir):
    filename = Utils.createFolder(cadir[0])  # 创建文件夹
    log = Logger.Loger()
    log.info(cadir[2] + u"测试开始")
    log.info(u"开始创建文件夹和文件")
    log.info(u"日志文件:" + filename[0])
    log.info(u"报告文件:" + filename[1])
    log.info(u"文件夹和文件创建成功")
    log.info(u"开始执行测试用例")
    result, infos = runTest(cadir[0], cadir[1])  # 收集和执行测试用例
    log.info(u"测试用例执行完成,开始写入报告")
    if cadir[2] == "functiontest":
        Utils.createReport(result, infos, filename, cadir[3])  # 测试结果写入报告
    log.info(u"报告写入结束,测试结束")
    log.info(u"开始发送邮件……")
    isSuccess = Utils.sendMail(filename[1], cadir[3])
    log.info(isSuccess)
    log.info(
        "================================================================\n")
# !/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2018/11/12 23:37
# @Author  : zhushaoxin
# @Email   : [email protected]
# @File    : BaseTestCase.py

import unittest
from src.common import Logger
from selenium import webdriver

log = Logger.Loger()


class BaseCaseClass(unittest.TestCase):
    def setUp(self):
        #         options = webdriver.ChromeOptions()
        #         options.add_experimental_option("excludeSwitches",["ignore-certificate-errors"])
        #         options.add_argument("--user-data-dir=C:/Users/Administrator/AppData/Local/Google/Chrome/User Data/Default");
        #         self.driver = webdriver.Chrome(chrome_options=options)
        self.driver = webdriver.Ie()
        self.url = "http://baidu.com"

    def tearDown(self):
        self.driver.close()

    @staticmethod
    def loginfo(msgstr):
        log.info(msgstr)