示例#1
0
    def setUp(self):
        unittest.TestCase.setUp(self)
        self.wd = WebDriverDoBeforeTest()
        self.wd.className = "LaboratoryManagement"
        self.wd.beforeClass()

        self.logger = LogObj()

        self.weblogin = web_login()
        self.weblogin.back_LoginPage(3)

        self.driver = self.weblogin.driver
        self.driverapi = WebdriverApi(self.driver)

        self.em = ExcelManager("UsersLogin.xls")
    def setUp(self):
        unittest.TestCase.setUp(self)
        self.logger = LogObj()

        self.weblogin = web_login()
        self.weblogin.back_SigninPage()  #返回到student 签到的页面

        self.wd = WebDriverDoBeforeTest()
        self.wd.className = "studentSignin.Signin"
        self.wd.beforeClass()
        self.wd.driver = self.weblogin.driver

        self.webdriverpai = WebdriverApi(self.weblogin.driver)

        self.conn = Execute_SQL()
示例#3
0
def test_run_suite():
    logger = LogObj()
    logger.debug("测试集test_run_suite执行了")
    html_obj = html_reporter()      #调用html测试报告方法
    suite = unittest.TestSuite()    #调用套件自动执行容器 
    
    for key in lists_class:
        #将lists_class中的类通过加载器进行加载
        suite.addTests(unittest.defaultTestLoader.loadTestsFromTestCase(key))
        
    #使用htmltestrunner生成html报告
    tle = "   LabDigitalPlatform By Python Design Testing By Author jayzhen"
    drp = "   基于Spring MVC的实验室数字化平台-自动化测试 V1.0版本 -自动化测试报告"
    runner = HTMLTestRunner.HTMLTestRunner(stream=html_obj,title=tle,description=drp)
    #批量执行容器中的测试用例
    runner.run(suite)
示例#4
0
 def __init__(self):
     self.logger = LogObj()
     self.fc = FileChecK()
     boolean = self.fc.is_has_file("db.ini")
     if boolean:
         self.inipath = self.fc.get_fileabspath()
     self.conf = Config(self.inipath)
     self.host = str(self.conf.get("dbset", "host"))
     self.port = int(self.conf.get("dbset", "port"))
     self.user = str(self.conf.get("dbset", "user"))
     self.passwd = str(self.conf.get("dbset", "passwd"))
     self.db = str(self.conf.get("dbset", "db"))
     self.charset = str(self.conf.get("dbset", "charset"))
     self.conn = MySQLdb.Connect(self.host, self.user, self.passwd, self.db,
                                 self.port, self.charset)
     self.logger.debug("数据库初始化完成" + self.host + str(self.port) + self.db +
                       self.charset)
 def __init__(self):
     self.driver = None
     self.className = None
     self.beforeSuiteStarts = 0
     self.afterSuiteStops = 0
     self.beforeClassStarts = 0
     self.afterClassStops = 0
     self.beforeTestStarts = 0
     self.afterTestStops = 0
     fc = FileChecK()
     boolean = fc.is_has_file("framework.ini")
     if boolean:
         self.projectpath = fc.getProjectPath()
         self.fwInipath = fc.get_fileabspath()
     self.logger = LogObj()
     self.capturePath = os.path.join(
         self.projectpath,
         Config(self.fwInipath).get("capturePath", "capturePath"))
示例#6
0
def html_reporter():
    logger = LogObj()
    fc = FileChecK()
    pro_path = fc.getProjectPath()
    boolean = fc.is_has_file("framework.ini")
    if boolean:
        inipath = fc.get_fileabspath()
        fw_conf = Config(inipath)
    htmlrp_path = fw_conf.get("htmlreportPath", "htmlreportPath")
    htmreportl_abs_path = os.path.join(pro_path,htmlrp_path)
    timecurrent = DateTimeManager().formatedTime("%Y-%m-%d-%H-%M-%S")
    logger.debug("=====创建了一个html文件报告,路径是::"+htmreportl_abs_path) 
    if not os.path.exists(htmreportl_abs_path):
        os.makedirs(htmreportl_abs_path)
    file_path = str(htmreportl_abs_path)+timecurrent+"-LDP-TestingRreporter.html"
    try:
        if os.path.exists(file_path):
            html_obj = open(file_path,"a") #打开文件   追加
            return html_obj
        else:
            html_obj = file(file_path,"wb+")
            return html_obj 
    except Exception,e:
        logger.error("创建html_reporter出现错误"+str(e)) 
 def __init__(self):
     self.__fileabspath = None  #不可访问的
     self.__logger = LogObj()