def get_driver(cls, path):
     contents = Utility.get_json(path)
     from selenium import webdriver
     driver = getattr(webdriver, contents['BROWSER'])()
     driver.implicitly_wait(10)
     driver.maximize_window()
     return driver
 def get_session(cls, sum):
     base_info = Utility.get_json('..\\config\\base.conf')
     login_url = "%s://%s:%s/%s/" % (
         base_info['PROTOCOL'],
         base_info['HOSTNAME'],
         base_info['PORT'],
         base_info['AURL'],
     )
     # print(login_url)
     base_data = Utility.get_json('..\\config\\Account.conf')
     login_data = {
         'userName': base_data[sum]['userName'],
         'userPass': base_data[sum]['userPass'],
         'checkcode': base_data[sum]['checkcode']
     }
     # print(login_data)
     session = requests.session()
     resp = session.post(login_url, login_data)
     # print(resp.text)
     return session
 def miss_login(cls, driver, base_config_path):
     cls.open_page(driver, base_config_path)
     # 通过字典方式传递cookie信息
     contents = Utility.get_json(base_config_path)
     driver.add_cookie({
         'name': 'JSESSIONID',
         'value': contents['JSESSIONID']
     })
     driver.add_cookie({
         'name': 'rememberMe',
         'value': contents['rememberMe']
     })
     time.sleep(2)
     cls.open_page(driver, base_config_path)
Exemple #4
0
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)
Exemple #5
0
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,
Exemple #6
0
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:
 def open_page(cls, driver, path):
     contents = Utility.get_json(path)
     URL = '%s://%s:%s/%s' % (contents['PROTOCOL'], contents['HOSTNAME'],
                              contents['PORT'], contents['AURL'])
     # print(URL)
     driver.get(URL)
Exemple #8
0
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)
Exemple #9
0
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: