from WoniuBoss4.lib.resource_train import ResourceTrain from WoniuBoss4.tools.utility import Utility from WoniuBoss4.tools.service import Service from parameterized import parameterized import unittest import time # 获取测试数据 resoure_train_datas = Utility.get_json("../config/testdata.conf") resoure_train_add = Utility.get_excel_GUI_tuple(resoure_train_datas[0]) resoure_train_tail = Utility.get_excel_GUI_tuple(resoure_train_datas[1]) resoure_train_edit = Utility.get_excel_GUI_tuple(resoure_train_datas[2]) resoure_train_query_one = Utility.get_excel_GUI_tuple(resoure_train_datas[3]) resoure_train_query_two = Utility.get_excel_GUI_tuple(resoure_train_datas[4]) class TestResourceTrain(unittest.TestCase): def setUp(self): print('test start') self.driver = Service.get_driver('../config/base.conf') Service.miss_login(self.driver, '../config/base.conf') self.driver.find_element_by_link_text(u'资源管理').click() self.train = ResourceTrain(self.driver) def tearDown(self): print('test over') time.sleep(2) self.driver.quit() # 新增资源 @parameterized.expand(resoure_train_add)
from selenium.webdriver.common.by import By from parameterized import parameterized import unittest import time from WoniuBoss4.lib.login import Login from WoniuBoss4.tools.service import Service from WoniuBoss4.tools.utility import Utility login_datas = Utility.get_json("../config/testdata.conf") login_data = Utility.get_excel_GUI_tuple(login_datas[0]) class TestLogin(unittest.TestCase): def setUp(self): self.driver = Service.get_driver('../config/base.conf') Service.open_page(self.driver, '../config/base.conf') self.login = Login(self.driver) def tearDown(self): time.sleep(2) self.driver.quit() # 测试登录功能 @parameterized.expand(login_data) def test_login(self, login_userName, login_userPASS, login_checkcode, login_expect): contents = { 'username': login_userName, 'password': login_userPASS,
from WoniuBoss4.lib.resource_allocation import ResourceAllocation from WoniuBoss4.tools.utility import Utility from WoniuBoss4.tools.service import Service from parameterized import parameterized import unittest import time # 获取测试数据 resource_allocation_datas = Utility.get_json("../config/testdata.conf") resource_allocation_query = Utility.get_excel_GUI_tuple(resource_allocation_datas[6]) class TestResourceTrain(unittest.TestCase): def setUp(self): print('test start') self.driver = Service.get_driver('../config/base.conf') Service.miss_login(self.driver, '../config/base.conf') self.driver.find_element_by_link_text(u'资源管理').click() self.allocation = ResourceAllocation(self.driver) def tearDown(self): print('test over') time.sleep(2) self.driver.quit() def test_alloacation_query_one(self): self.allocation.allocation_query_one() sql = 'select count(work_id) from customer' result = Utility.query_one('../config/base.conf', sql) try:
import time from selenium.webdriver.common.by import By import unittest from parameterized import parameterized from WoniuBoss4.lib.student_info import StudentInfo from WoniuBoss4.tools.service import Service from WoniuBoss4.tools.utility import Utility test_config_info = Utility.get_json('../config/testdata.conf') # search_stu_info = Utility.get_excel_GUI_tuple(test_config_info[1]) modify_stu_info = Utility.get_excel_GUI_tuple(test_config_info[2]) class StudentInfoTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.driver = Service.get_driver('../config/base.conf') cls.student_info = StudentInfo(cls.driver) @classmethod def tearDownClass(cls): cls.driver.quit() # @parameterized.expand(search_stu_info) # def test_a_serach_stu_info(cls, orien_name,class_name,status_name,stu_name,expect): # cls.student_info.do_search_info(orien_name,class_name,status_name,stu_name) # time.sleep(2)
from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from WoniuBoss4.lib.resource_public import ResourcePublic from WoniuBoss4.tools.utility import Utility from WoniuBoss4.tools.service import Service from parameterized import parameterized import unittest import time # 获取测试数据 resource_public_datas = Utility.get_json("../config/testdata.conf") resource_public_query = Utility.get_excel_GUI_tuple(resource_public_datas[7]) class TestRePublic(unittest.TestCase): def setUp(self): print('test start') self.driver = Service.get_driver('../config/base.conf') Service.miss_login(self.driver, '../config/base.conf') self.driver.find_element_by_link_text(u'资源管理').click() self.public = ResourcePublic(self.driver) def tearDown(self): print('test over') time.sleep(2) self.driver.quit() def test_resource_public_query_one(self): self.public.public_resource_query_one() try:
from selenium.webdriver.common.by import By import unittest from parameterized import parameterized from WoniuBoss4.lib.pychase_exam import PhaseExam from WoniuBoss4.tools.service import Service from WoniuBoss4.tools.utility import Utility test_config_info = Utility.get_json('../config/testdata.conf') import_sigle_phase_info = Utility.get_excel_GUI_tuple(test_config_info[3]) class PhaseExamTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.driver = Service.get_driver('../config/base.conf') cls.phase_exam = PhaseExam(cls.driver) @classmethod def tearDownClass(cls): cls.driver.quit() @parameterized.expand(import_sigle_phase_info) def test_a_entry_sigle_phase_exam(self, class_name, score, phase, comment, expect): self.phase_exam.do_entry_sigle_phase_exam(class_name, score, phase, comment) if Service.is_element_present( self.driver, By.CSS_SELECTOR, 'body > div.bootbox.modal.fade.mydialog.in > ' 'div > div'): actual = 'test import sigle phase exam fail'