Ejemplo n.º 1
0
 def test_login(self):
     #准备数据
     login_info = Utility.get_excel_to_dict(self.data_config_info[0])
     for info in login_info:
         login_url = info['URL']
         login_data = info['DATA']
         login_resp = Login().do_login(login_url, login_data)
         #将返回的正文当做预期结果
         login_resp_content = login_resp.text
         #断言
         flag = Utility.assert_equals(login_resp_content, info['CONTENT'])
         if flag:
             print('login test pass')
         else:
             print('login test fail')
Ejemplo n.º 2
0
 def test_querystaff(self, query_staff_url, post, query_staff_data,
                     status_code, content):
     querystaff_resp = self.hr.query_staff(query_staff_url,
                                           query_staff_data)
     sql_all = 'select count(employee_id) from employee'
     all_staff_number = Utility.query_one('..\\config\\base.conf',
                                          sql_all)[0]
     sql_part = 'select count(employee_id) from employee where region_id=3'
     part_staff_number = Utility.query_one('..\\config\\base.conf',
                                           sql_part)[0]
     if querystaff_resp.json()['totalRow'] == 0:
         actual = 'query zero'
     elif querystaff_resp.json()['totalRow'] == 1:
         actual = 'query one'
     elif querystaff_resp.json()['totalRow'] == all_staff_number:
         actual = 'query all'
     elif querystaff_resp.json()['totalRow'] == part_staff_number:
         actual = 'query part'
     else:
         actual = 'query error'
     self.assertEqual(actual, content)
Ejemplo n.º 3
0
    def test_queryStudentInfo(self, queryStudentInfo_url, post,
                              queryStudentInfo_data, status_code, content):
        queryStudentInfo_resp = self.student.queryStudentInfo(
            queryStudentInfo_url, queryStudentInfo_data)
        sql_all = 'select count(student_id) from student'
        all_student_number = Utility.query_one('..\\config\\base.conf',
                                               sql_all)[0]
        sql_part = 'select count(student_id) from student where student_class_id=59'
        part_student_number = Utility.query_one('..\\config\\base.conf',
                                                sql_part)[0]
        if queryStudentInfo_resp.json()['totalRow'] == 0:
            actual = 'query zero'
        elif queryStudentInfo_resp.json()['totalRow'] == 1:
            actual = 'query one'
        elif queryStudentInfo_resp.json()['totalRow'] == all_student_number:
            actual = 'query all'
        elif queryStudentInfo_resp.json()['totalRow'] == part_student_number:
            actual = 'query part'
        else:
            actual = 'query error'

        self.assertEqual(actual, content)
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)
    def test_querflow(self, query_flow_url, post, query_flow_data, status_code,
                      content):
        queryflow_resp = self.finance.query_flow(query_flow_url,
                                                 query_flow_data)
        sql_part01 = 'select count(detailed_id) from detailed_dealings where trading_time between "2018-05-29" and "2018-05-31"'
        part_flow_number01 = Utility.query_one('..\\config\\base.conf',
                                               sql_part01)[0]
        sql_part02 = 'select count(detailed_id) from detailed_dealings where trading_time between "2020-03-01" and "2020-03-31"'
        part_flow_number02 = Utility.query_one('..\\config\\base.conf',
                                               sql_part02)[0]
        sql_part03 = 'select count(detailed_id) from detailed_dealings where trading_time between "2020-04-01" and "2020-04-30"'
        part_flow_number03 = Utility.query_one('..\\config\\base.conf',
                                               sql_part03)[0]

        if queryflow_resp.json()['totalRow'] == part_flow_number01:
            actual = 'query part'
        elif queryflow_resp.json()['totalRow'] == part_flow_number02:
            actual = 'query lastmonth'
        elif queryflow_resp.json()['totalRow'] == part_flow_number03:
            actual = 'query thismonth'
        else:
            actual = 'query error'
        self.assertEqual(actual, content)
Ejemplo n.º 6
0
 def get_session(cls):
     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'])
     login_data = {
         "userName": base_info["USERNAME"],
         "userPass": base_info["PASSWORD"],
         "checkcode": base_info["VERIFYCODE"]
     }
     #print(login_data)
     session = requests.session()
     session.post(login_url, login_data)
     return session
Ejemplo n.º 7
0
 def test_queryuser(self, query_user_url, post, query_user_data,
                    status_code, content):
     queryuser_resp = self.backstage.query_user(query_user_url,
                                                query_user_data)
     sql_all = 'select count(id) from system_user'
     all_user_number = Utility.query_one('..\\config\\base.conf',
                                         sql_all)[0]
     if queryuser_resp.json()['totalRow'] == 0:
         actual = 'query zero'
     elif queryuser_resp.json()['totalRow'] == 1:
         actual = 'query one'
     elif queryuser_resp.json()['totalRow'] == all_user_number:
         actual = 'query all'
     else:
         actual = 'query error'
     self.assertEqual(actual, content)
Ejemplo n.º 8
0
import unittest
from parameterized import parameterized

from woniuboss2.lib.hr_manage import Hr
from woniuboss2.tools.utility import Utility

data_config_info = Utility.get_json('..\\config\\testdata.conf')
test_addstaff_info = Utility.get_excel_to_tuple(data_config_info[2])
test_querystaff_info = Utility.get_excel_to_tuple(data_config_info[3])
test_editstaff_info = Utility.get_excel_to_tuple(data_config_info[4])


class HrTest(unittest.TestCase):
    def setUp(self):
        self.hr = Hr()

    def tearDown(self):
        pass

    @parameterized.expand(test_addstaff_info)
    def test_addstaff(self, add_staff_url, post, add_staff_data, status_code,
                      content):
        addstaff_resp = self.hr.add_staff(add_staff_url, add_staff_data)
        self.assertEqual(addstaff_resp.text, content)

    #查询0条,查询1条,查询部分,查询所有
    @parameterized.expand(test_querystaff_info)
    def test_querystaff(self, query_staff_url, post, query_staff_data,
                        status_code, content):
        querystaff_resp = self.hr.query_staff(query_staff_url,
                                              query_staff_data)
Ejemplo n.º 9
0
import unittest
from parameterized import parameterized

from woniuboss2.lib.backstage_manage import Backstage
from woniuboss2.tools.utility import Utility

data_config_info = Utility.get_json('..\\config\\testdata.conf')
test_addrole_info = Utility.get_excel_to_tuple(data_config_info[5])
test_queryuser_info = Utility.get_excel_to_tuple(data_config_info[6])


class BackstageTest(unittest.TestCase):
    def setUp(self):
        self.backstage = Backstage()

    def tearDown(self):
        pass

    @parameterized.expand(test_addrole_info)
    def test_add_role(self, add_role_url, post, add_role_data, status_code,
                      content):
        add_role_resp = self.backstage.add_role(add_role_url, add_role_data)
        self.assertEqual(add_role_resp.text, content)

    # 查询0条,查询1条,查询所有
    @parameterized.expand(test_queryuser_info)
    def test_queryuser(self, query_user_url, post, query_user_data,
                       status_code, content):
        queryuser_resp = self.backstage.query_user(query_user_url,
                                                   query_user_data)
        sql_all = 'select count(id) from system_user'
import unittest
from parameterized import parameterized
from woniuboss2.lib.financial_manage import Finance
from woniuboss2.tools.utility import Utility

data_config_info = Utility.get_json('..\\config\\testdata.conf')
test_addflow_info = Utility.get_excel_to_tuple(data_config_info[1])
test_queryflow_info = Utility.get_excel_to_tuple(data_config_info[7])
test_editflow_info = Utility.get_excel_to_tuple(data_config_info[8])


class FinancialTest(unittest.TestCase):
    def setUp(self):
        self.finance = Finance()

    def tearDown(self):
        pass

    @parameterized.expand(test_addflow_info)
    def test_addflow(self, addflow_url, post, addflow_data, status_code,
                     content):
        addflow_resp = self.finance.add_flow(addflow_url, addflow_data)
        self.assertEqual(addflow_resp.text, content)

    # 按条件查询
    @parameterized.expand(test_queryflow_info)
    def test_querflow(self, query_flow_url, post, query_flow_data, status_code,
                      content):
        queryflow_resp = self.finance.query_flow(query_flow_url,
                                                 query_flow_data)
        sql_part01 = 'select count(detailed_id) from detailed_dealings where trading_time between "2018-05-29" and "2018-05-31"'
Ejemplo n.º 11
0
from woniuboss2.lib.student import Student
from woniuboss2.tools.utility import Utility
import unittest
from parameterized import parameterized

data_config_info = Utility.get_json('..\\config\\testdata.conf')
test_queryStudentInfo_info = Utility.get_excel_to_tuple(data_config_info[1])
test_selectInfo_info = Utility.get_excel_to_tuple(data_config_info[2])
test_saveNewInfo_info = Utility.get_excel_to_tuple(data_config_info[3])
test_saveLeave_info = Utility.get_excel_to_tuple(data_config_info[4])
test_saveModLeave_info = Utility.get_excel_to_tuple(data_config_info[5])
test_terminateLeave_info = Utility.get_excel_to_tuple(data_config_info[6])
test_queryLeave_info = Utility.get_excel_to_tuple(data_config_info[7])
test_saveUpLeave_info = Utility.get_excel_to_tuple(data_config_info[8])
test_quertAtteResult_info = Utility.get_excel_to_tuple(data_config_info[9])
# test_queryPhaseExam_info=Utility.get_excel_to_tuple(data_config_info[10])
test_saveScore_info = Utility.get_excel_to_tuple(data_config_info[11])
test_updateRepeat_info = Utility.get_excel_to_tuple(data_config_info[12])
test_showPhaseExam_info = Utility.get_excel_to_tuple(data_config_info[13])
test_queryStuOfClass_info = Utility.get_excel_to_tuple(data_config_info[14])
test_allocate_info = Utility.get_excel_to_tuple(data_config_info[15])
# test_saveCourse_info=Utility.get_excel_to_tuple(data_config_info[16])
test_saveModifyCourse_info = Utility.get_excel_to_tuple(data_config_info[17])


class StudentTest(unittest.TestCase):
    def setUp(self) -> None:
        self.student = Student()
        print('test start')

    def tearDown(self) -> None:
Ejemplo n.º 12
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#====#====#====#====
#Author:
#CreatDate:
#Version:
#====#====#====#====
import json
import unittest
from parameterized import parameterized

from woniuboss2.lib.enterprise import EtprsManage
from woniuboss2.tools.utility import Utility

# 获取测试数据
data_config_info = Utility.get_json('..\\config\\testdata.conf')
#新增企业
test_add_company_info = Utility.get_excel_to_tuple(data_config_info[17])
#查询企业
test_query_etprs_info = Utility.get_excel_to_tuple(data_config_info[18])


class TestEnterprise(unittest.TestCase):
    def setUp(self):
        print("test start")

    def tearDown(self):
        print("test end")

    # 新增企业
    @parameterized.expand(test_add_company_info)
Ejemplo n.º 13
0
 def __init__(self, data_config_path):
     self.data_config_info = Utility.get_json(data_config_path)
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#====#====#====#====
#Author:
#CreatDate:
#Version:
#====#====#====#====
import unittest
from parameterized import parameterized
from woniuboss2.tools.utility import Utility
from woniuboss2.lib.training import Tran
# 获取测试数据
data_config_info = Utility.get_json('..\\config\\testdata.conf')
query_message_info = Utility.get_excel_to_tuple(data_config_info[1])
query_resume_info = Utility.get_excel_to_tuple(data_config_info[2])
Track_resources_info = Utility.get_excel_to_tuple(data_config_info[3])
Modify_information_info = Utility.get_excel_to_tuple(data_config_info[4])
add_information_info = Utility.get_excel_to_tuple(data_config_info[5])
transfer_query_info = Utility.get_excel_to_tuple(data_config_info[6])
transfer_view_info = Utility.get_excel_to_tuple(data_config_info[7])
transfer_commit_info = Utility.get_excel_to_tuple(data_config_info[8])
distribution_query_info = Utility.get_excel_to_tuple(data_config_info[9])
Proportionate_distribution_info = Utility.get_excel_to_tuple(
    data_config_info[10])
Public_query_info = Utility.get_excel_to_tuple(data_config_info[11])
Public_claim_info = Utility.get_excel_to_tuple(data_config_info[12])


class TestTrain(unittest.TestCase):
    def setUp(self):
        def setUp(self):
Ejemplo n.º 15
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#====#====#====#====
#Author:
#CreatDate:
#Version:
#====#====#====#====
from woniuboss2.tools.utility import Utility
from woniuboss2.lib.employment import Employment
import unittest
from parameterized import parameterized

# 获取测试数据
data_config_info = Utility.get_json('..\\config\\testdata.conf')
#技术面试
test_Interview_info = Utility.get_excel_to_tuple(data_config_info[19])
#就业管理
test_obtainEmployment_info = Utility.get_excel_to_tuple(data_config_info[20])


class TestEmployment(unittest.TestCase):
    def setUp(self):
        print("test start")

    def tearDown(self):
        print("test end")

    # 技术面试
    @parameterized.expand(test_Interview_info)
    def test_Interview(self, Interview_url, post, Interview_data, status_code,
                       content):
Ejemplo n.º 16
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#====#====#====#====
#Author:
#CreatDate:
#Version:
#====#====#====#====
from woniuboss2.tools.utility import Utility
from woniuboss2.lib.finance import Finance
import unittest
from parameterized import parameterized

# 获取测试数据
data_config_info = Utility.get_json('..\\config\\testdata.conf')

#新增流水
test_addFinancial_info = Utility.get_excel_to_tuple(data_config_info[13])
#上月查询
test_Query_lastmonth_info = Utility.get_excel_to_tuple(data_config_info[14])
#本月查询
test_Query_thismonth_info = Utility.get_excel_to_tuple(data_config_info[15])
#学员缴费
test_studentpayment_info = Utility.get_excel_to_tuple(data_config_info[16])


class TestFinance(unittest.TestCase):
    def setUp(self):
        print("test start")

    def tearDown(self):
        print("test end")
Ejemplo n.º 17
0
from woniuboss2.tools.utility import Utility
from woniuboss2.lib.market import Market
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[18])
# 新增资源
test_addCus_info = Utility.get_excel_to_tuple(data_config_info[19])
# 上传简历
test_validateUpload_info = Utility.get_excel_to_tuple(data_config_info[20])


class TestMarket(unittest.TestCase):
    def setUp(self):
        print("test start")

    def tearDown(self):
        print("test end")

    # 新增资源
    @parameterized.expand(test_addCus_info)
    def test_addCus(self, addCus_url, post, addCus_data, status_code, content):
        market_add_resp = Market().addCus(addCus_url, addCus_data)
        actual = market_add_resp
        # 断言
        self.assertEqual(actual, content)

    # 上传简历