Esempio n. 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")
Esempio n. 2
0
from src.app import server
from src.common import Logger
from src.model.job_model import BatchJob
from src.util import (
    get_initial_create_time_dict,
    get_update_time_dict,
    validate_and_dump_in_schema,
)

log = Logger()


def create_one(insert_args):
    insert_data = {**insert_args, **get_initial_create_time_dict()}
    log.info(f"job_repository : create_one : batch_job_id = {insert_data['_id']}")
    batch_job_schema = BatchJob()
    obj = validate_and_dump_in_schema(insert_data, batch_job_schema)
    return server.get_mongo_db().AtxDataBatchJobs.insert_one(obj)


def find_one(batch_job_id):
    return server.get_mongo_db().AtxDataBatchJobs.find_one({"_id": batch_job_id})


def update_one(batch_job_id, update_args):
    update_data = {**update_args, **get_update_time_dict()}
    log.info(f"job_repository : update_one : batch_job_id = {batch_job_id}")
    return server.get_mongo_db().AtxDataBatchJobs.update_one(
        {"_id": batch_job_id}, {"$set": update_data}
    )
# !/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)