# -*- coding: utf-8 -*- # @Author : leizi from bussinses.funnicgong import Xiugai_tes from selenium import webdriver import unittest,time,os,ddt from util import log from util.gettestdata import huoqu_test path=os.getcwd() case_path=path+'\\data\\case.xlsx' casedata=huoqu_test(case_path,3) @ddt.ddt class Test_xiugai(unittest.TestCase): def setUp(self): self.logs = log.log_message() self.derve=webdriver.Fi() self.xiugai_fun=Xiugai_tes(self.derve) @ddt.data(*casedata) def test_xiugai_1(self,casedata): self.password=casedata['yuanmi'] self.xiugaimi=casedata['xiugaimi'] self.xiugaimi1=casedata['xiugaimi1'] self.suc=casedata['suc'] self.assert_vale=casedata['assert_vale'] self.return_data=self.xiugai_fun.xiugai(self.suc,self.password,self.xiugaimi,self.xiugaimi1) self.logs.info_log("input: password:%s,xiugaimima:%s,xiugaimima1:%s,assert:%s"%(self.password,self.xiugaimi,self.xiugaimi1,self.assert_vale)) time.sleep(1) self.assertAlmostEqual(self.return_data,self.assert_vale) def tearDown(self): self.derve.quit()
from bussinses.funnicgong import Logintest from bussinses.funnicgong import SchoolTest import ddt import unittest import os from util import log from selenium import webdriver from util.gettestdata import huoqu_test # -*- coding: utf-8 -*- path = os.getcwd() case_path = path + '\\data\\case.xlsx' # 参数格式为[{},{}]或[{}] school_data = huoqu_test(case_path, 2) login_list = huoqu_test(case_path, 0) # excle内同一sheet取值 data = login_list[0] # 用列表包一层,是因为格式问题 login_data = [data] @ddt.ddt class TestSchoolselect(unittest.TestCase): @classmethod def setUpClass(cls): cls.logs = log.log_message() cls.driver = webdriver.Chrome() cls.driver.maximize_window()
from bussinses.funnicgong import Logintest from bussinses.funnicgong import StudentTest import ddt import unittest import os from util import log from selenium import webdriver from util.gettestdata import huoqu_test # -*- coding: utf-8 -*- # 数据填充 path = os.getcwd() case_path = path + '\\data\\case.xlsx' # 参数格式为[{},{}]或[{}] student_data = huoqu_test(case_path, 1) login_list = huoqu_test(case_path, 0) # excle内同一sheet取值 data = login_list[0] # 用列表包一层,是因为格式问题 login_data = [data] @ddt.ddt class Testselect(unittest.TestCase): @classmethod def setUpClass(cls): cls.logs = log.log_message() cls.driver = webdriver.Chrome()
from common.funCourseDB import CourseDB_test import ddt, unittest, os, time from util import log from selenium import webdriver from util.gettestdata import huoqu_test path = os.getcwd() case_path = path + '\\data\\case.xlsx' casedata = huoqu_test(case_path, 0) faultyTest_data = huoqu_test(case_path, 1) @ddt.ddt class TestCourseSearch(unittest.TestCase): def setUp(self): self.logs = log.log_message() self.driver = webdriver.Chrome() self.driver.maximize_window() self.driver.implicitly_wait(10) self.courseDB = CourseDB_test(self.driver) @ddt.data(*casedata) def test_searchCourse(self, casedata): # Set the test parameters self.name = casedata['short_name'] self.suc = casedata['suc'] self.assert_value = casedata['assert'] # Run the test re_data, chartExist = self.courseDB.search(self.suc, self.name) # Get screenshot and record for every test time.sleep(1)