Ejemplo n.º 1
0
    def test_add_flow(self, money, countparty, record, expect):
        add_flow_data = {
            'moneyNo': money,
            'counterpartyName': countparty,
            'textarea': record
        }
        #新增之前检查流水的总数
        sql = 'select count(detailed_id) from detailed_dealings'
        old_flow_count = Utility.query_one('..\\config\\base.conf', sql)
        # 执行添加流水的操作
        self.financial.add_flow('..\\config\\base.conf', add_flow_data)
        # 对添加动作的结果进行验证
        if Service.is_element_present(self.driver, By.CSS_SELECTOR,
                                      'button.btn:nth-child(10)'):
            time.sleep(2)
            # 用于获取弹出页面的文本内容
            content = self.driver.find_element_by_xpath(
                '/html/body/div[7]/div[3]/div/div/div/div[1]/div[4]/div[1]/div[2]/div[2]/table/tbody/tr[1]/td[13]/button'
            ).text
            if '修改' in content:
                actual = 'add-success'
            else:
                actual = 'add-fail'
        else:
            # 判断表中的记录数是否增加
            new_flow_count = Utility.query_one('..\\config\\base.conf', sql)
            if new_flow_count[0] - old_flow_count[0] == 1:
                actual = 'add-success'
            else:
                actual = 'add-fail'

        self.assertEqual(actual, expect)
Ejemplo n.º 2
0
	def get_driver(cls,base_config_path):
		contents = Utility.get_json(base_config_path)
		from selenium import webdriver
		driver = getattr(webdriver, contents['BROWSER'])()
		driver.implicitly_wait(10)
		driver.maximize_window()
		return driver
Ejemplo n.º 3
0
	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': 'username', 'value': contents['username']})
		driver.add_cookie({'name': 'password', 'value': contents['password']})
		driver.add_cookie({'name':'token','value':contents['token']})
		driver.add_cookie({'name':'workId','value':contents['workId']})
		cls.open_page(driver, base_config_path)
Ejemplo n.º 4
0
    def start(self):
        from HTMLTestRunner import HTMLTestRunner
        ts = unittest.TestSuite()
        loader = unittest.TestLoader()
        testcase_names = Utility.trans_str('..\\config\\test.conf')

        tests = loader.loadTestsFromNames(testcase_names)
        ts.addTests(tests)
        # 测试报告文件名称的格式为:xxxx-xx-xx_xx_xx_xx_report.html
        import time
        ctime = time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime())
        with open('..\\report\\%s_report.html' % (ctime), 'w') as file:
            runner = HTMLTestRunner(stream=file, verbosity=2)
            runner.run(ts)
Ejemplo n.º 5
0
 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': 'username', 'value': contents['username']})
     driver.add_cookie({'name': 'password', 'value': contents['password']})
     driver.add_cookie({
         'name': 'JSESSIONID',
         'value': contents['JSESSIONID']
     })
     driver.add_cookie({
         'name': 'rememberMe',
         'value': contents['rememberMe']
     })
     cls.open_page(driver, base_config_path)
Ejemplo n.º 6
0
	def open_page(cls, driver, base_config_path):
		contents = Utility.get_json(base_config_path)
		URL = 'http://%s:%s/%s' % (contents['HOSTNAME'], contents['PORT'], contents['AURL'])
		driver.get(URL)
Ejemplo n.º 7
0
from selenium.webdriver.common.by import By

from woniuboss.tools.service import Service
from woniuboss.tools.utility import Utility
import unittest
from parameterized import parameterized

# 获取测试数据
data_config_info = Utility.get_json('..\\config\\testdata.conf')
# 查询资源
test_qureyNetCus_info = Utility.get_excel_to_tuple(data_config_info[1])
# 新增资源
test_addCus_info = Utility.get_excel_to_tuple(data_config_info[2])
# 上传简历
test_validateUpload_info = Utility.get_excel_to_tuple(data_config_info[3])


class TestMarket(unittest.TestCase):
    @classmethod
    def setUp(cls):
        cls.driver = Service.get_driver('..\\config\\base.conf')
        from woniuboss.lib.market import Market
        cls.market = Market(cls.driver)

    @classmethod
    def tearDown(cls):
        cls.driver.quit()

    # 查询资源
    # @parameterized.expand(test_qureyNetCus_info)
    # def test_qureyNetCus(self,stime,etime,expect):
import time
import unittest
from parameterized import parameterized
from selenium.webdriver.common.by import By

from woniuboss.lib.employment_manage import EmployManage
from woniuboss.tools.service import Service
from woniuboss.tools.utility import Utility

test_config_info = Utility.get_json('..\\config\\testdata.conf')
technical_interview_info = Utility.get_excel_to_tuple(test_config_info[7])
mock_interview_info = Utility.get_excel_to_tuple(test_config_info[8])
search__info = Utility.get_excel_to_tuple(test_config_info[10])


class EmployTest(unittest.TestCase):
    def setUp(self):
        self.driver = Service.get_driver('..\\config\\base.conf')
        self.employ = EmployManage(self.driver)

    def tearDown(self):
        self.driver.quit()

    @parameterized.expand(technical_interview_info)
    def test_technical_interview(self, q_content, e_content, expect):
        technical_interview_data = {
            'question_content': q_content,
            'evalute_content': e_content
        }
        # 执行技术面试的操作
        self.employ.technical_interview('..\\config\\base.conf',
import time,unittest
from parameterized import parameterized

# 获取登录用的测试信息
from woniuboss.lib.login import Login
from woniuboss.tools.service import Service
from woniuboss.tools.utility import Utility

test_config_info = Utility.get_json('..\\config\\testdata.conf')
login_info = Utility.get_excel_to_tuple(test_config_info[0])


class LoginTest(unittest.TestCase):

	@classmethod
	def setUpClass(cls):
		cls.driver = Service.get_driver('..\\config\\base.conf')
		cls.login = Login(cls.driver)

	@classmethod
	def tearDownClass(cls):
		cls.driver.quit()

	@parameterized.expand(login_info)
	def test_login(self,uname,upass,vfcode,expect):
		# 将参数重新组织成字典
		login_data = {'username':uname,'password':upass,'verification':vfcode}
		self.login.do_login('..\\config\\base.conf',login_data)
		from selenium.webdriver.common.by import By
		if Service.is_element_present(self.driver,By.LINK_TEXT,'注销'):
			actual = 'success'
Ejemplo n.º 10
0
from selenium.webdriver.common.by import By
from woniuboss.tools.service import Service
from woniuboss.tools.utility import Utility
import unittest
from parameterized import parameterized
# 获取测试数据
data_config_info = Utility.get_json('..\\config\\testdata.conf')
# 咨询部数据
test_query_console_info = Utility.get_excel_to_tuple(data_config_info[5])


class TestReport(unittest.TestCase):
    @classmethod
    def setUp(cls):
        cls.driver = Service.get_driver('..\\config\\base.conf')
        from woniuboss.lib.report import Report
        cls.report = Report(cls.driver)

    @classmethod
    def tearDown(cls):
        cls.driver.quit()

    # # 咨询部报表中心功能测试
    # @parameterized.expand(test_query_console_info)
    # def test_query_console(self,stime,etime,expect):
    #     query_console_data = {'stime': stime, 'etime': etime}
    #     self.report.query_console('..\\config\\base.conf', query_console_data)
    #     if Service.is_element_present(self.driver, By.CSS_SELECTOR, '#成都 > thead:nth-child(1) > tr:nth-child(1) > th:nth-child(1)'):
    #         actual = 'query_successful'
    #     else:
    #         actual = 'query_failed'
Ejemplo n.º 11
0
import time
import unittest
from parameterized import parameterized
from selenium.webdriver.common.by import By

from woniuboss.lib.financial_manage import FinancialManage
from woniuboss.tools.service import Service
from woniuboss.tools.utility import Utility

test_config_info = Utility.get_json('..\\config\\testdata.conf')
add_flow_info = Utility.get_excel_to_tuple(test_config_info[1])
add_password_info = Utility.get_excel_to_tuple(test_config_info[9])


class FinancialTest(unittest.TestCase):
    def setUp(self):
        self.driver = Service.get_driver('..\\config\\base.conf')
        self.financial = FinancialManage(self.driver)

    def tearDown(self):
        self.driver.quit()

    @parameterized.expand(add_flow_info)
    def test_add_flow(self, money, countparty, record, expect):
        add_flow_data = {
            'moneyNo': money,
            'counterpartyName': countparty,
            'textarea': record
        }
        #新增之前检查流水的总数
        sql = 'select count(detailed_id) from detailed_dealings'
Ejemplo n.º 12
0
from selenium.webdriver.common.by import By

from woniuboss.tools.service import Service
from woniuboss.tools.utility import Utility
import unittest
from parameterized import parameterized
# 获取测试数据
data_config_info = Utility.get_json('..\\config\\testdata.conf')
# 咨询部数据
test_add_resource_info = Utility.get_excel_to_tuple(data_config_info[8])

test_edit_resource_info = Utility.get_excel_to_tuple(data_config_info[9])
test_set_info = Utility.get_excel_to_tuple(data_config_info[10])
test_add_role_info = Utility.get_excel_to_tuple(data_config_info[11])
test_edit_role_info = Utility.get_excel_to_tuple(data_config_info[12])
test_query_username_info = Utility.get_excel_to_tuple(data_config_info[13])
test_user_set_info = Utility.get_excel_to_tuple(data_config_info[14])
test_dict_add_info = Utility.get_excel_to_tuple(data_config_info[15])
test_details_edit_info = Utility.get_excel_to_tuple(data_config_info[16])


class TestManagement(unittest.TestCase):
    @classmethod
    def setUp(cls):
        cls.driver = Service.get_driver('..\\config\\base.conf')
        from woniuboss.lib.management import Management
        cls.management = Management(cls.driver)

    @classmethod
    def tearDown(cls):
        cls.driver.quit()
Ejemplo n.º 13
0
from selenium.webdriver.common.by import By
from woniuboss.tools.service import Service
from woniuboss.tools.utility import Utility
import unittest
from parameterized import parameterized

# 获取测试数据
data_config_info = Utility.get_json('..\\config\\testdata.conf')
# 登录密码数据
test_change_login_password_info = Utility.get_excel_to_tuple(
    data_config_info[6])
# 二级密码数据
test_change_second_password_info = Utility.get_excel_to_tuple(
    data_config_info[7])


class TestPassword(unittest.TestCase):
    @classmethod
    def setUp(cls):
        cls.driver = Service.get_driver('..\\config\\base.conf')
        from woniuboss.lib.password import Password
        cls.password = Password(cls.driver)

    @classmethod
    def tearDown(cls):
        cls.driver.quit()

    # 修改登录密码功能测试
    @parameterized.expand(test_change_login_password_info)
    def test_query_console(self, oldpw, newpw1, newpw2, expect):
        change_login_password_data = {