예제 #1
0
class TestMatchStation(unittest.TestCase):
    def setUp(self):
        print("**********CASE START**********")

    def tearDown(self):
        print("**********CASE END**********")

    data_list = configData.get_xls('shopCase.xlsx', 'matchStation')

    def test_matchStation_error(self):

        request = ConfigHttp()

        data = self.data_list[1]

        if data[1].lower() == 'post':
            request.set_url(data[2])
            request.set_headers({
                "content-type":
                "application/x-www-form-urlencoded;charset=utf-8"
            })
            request.set_data({"lng": data[3], "lat": data[4]})
            response = request.post()
            response_json = response.json()
            code = response_json.get('code')
            message = response_json.get('message')
            print(code, message)
            self.assertEqual(code, int(data[5]))
            self.assertEqual(message, data[6])
예제 #2
0
def set_test_case(xls_name):
    xls_sheet = configData.get_xls_sheet(xls_name)
    for sh in xls_sheet:
        # 获取sheet的参数列表
        xls_params = configData.get_params_xls(xls_name, sh)
        # 获取参数sheet的所有参数值
        test_xls = configData.get_xls(xls_name, sh)
        for txl in test_xls:
            lt = LoadTest(sh, xls_params, *txl)
            # run test case
            lt.run_test()
        print("<--------------------Test " + sh +
              " Finsish-------------------->\n\n")
예제 #3
0
import unittest
import paramunittest
import readConfig as readConfig
from common import Log as Log
from common import configData
from common import configHttp as ConfigHttp

login_xls = configData.get_xls("userCase.xlsx", "login")
localReadConfig = readConfig.ReadConfig()
configHttp = ConfigHttp.ConfigHttp()
info = {}


@paramunittest.parametrized(*login_xls)
class Login(unittest.TestCase):
    def setParameters(self, case_name, method, username, password, checkcode,
                      msg):
        """
        set params
        :param case_name:
        :param method:
        :param username:
        :param password:
        :param checkcode
        :param code:
        :param data:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
        self.method = str(method)