Example #1
0
import readConfig as readConfig
import unittest
import paramunittest
from common.configLog import MyLog
from common import configHttp
from common import comm
from common import configDB

localRegisterQuick_xls = comm.get_xls("userCase.xlsx", "registerquick")
localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()
localConfigDB = configDB.MyDB()


@paramunittest.parametrized(*localRegisterQuick_xls)
class RegisterQuick(unittest.TestCase):
    def setParameters(self, case_name, method, token, email, result, code,
                      msg):
        """
        set parameters
        :param case_name:
        :param method:
        :param token:
        :param email:
        :param result:
        :param code:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
        self.method = str(method)
Example #2
0
import unittest
import paramunittest
import readConfig as readConfig
from common import comm
from common import configHttp
from common.configLog import MyLog
from common import businessCommon

localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()
localLogin_xls = comm.get_xls("userCase.xlsx", "login")
localAccountSetting_xls = comm.get_xls("userCase.xlsx", "accountSetting")


@paramunittest.parametrized(*localAccountSetting_xls)
class AccountSetting(unittest.TestCase):
    def setParameters(self, case_name, method, token, sex, telephone, nickname,
                      birthday, country_id, result, code, msg):
        """
        set params
        :param case_name:
        :param method:
        :param token:
        :param sex:
        :param telephone:
        :param nickname:
        :param birthday:
        :param country_id:
        :param result:
        :param code:
        :param msg:
import unittest
import paramunittest
from common import comm
from common.configLog import MyLog
import readConfig as readConfig
from common import configHttp as configHttp

eventInfo_xls = comm.get_xls("signCase.xlsx", "get_guest")
localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()
log = MyLog.get_log()
# log.build_log_format()  # 这个格式设置,全runtest只能调用一次,否则将重新输入log的info
logger = log.get_logger()


@paramunittest.parametrized(*eventInfo_xls)
class GetGuest(unittest.TestCase):
    def setParameters(self, case_name, method, eid, phone_query, data, realname, phone_assert, status, msg):
        """
        set params
        :param case_name:
        :param method:
        :param eid:
        :param phone_query:
        :param data:
        :param realname:
        :param phone_assert
        :param status:
        :param msg:
        :return:
        """
Example #4
0
import unittest
import requests
import time
import datetime
import sys
import os
import unittest
import paramunittest
from common import comm
from common.configLog import MyLog
import readConfig as readConfig
from common import configHttp as configHttp
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir)

eventInfo_xls = comm.get_xls("signCase.xlsx", "user_sign")  # 1.修改Excel读取文件!
localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()
log = MyLog.get_log()
# log.build_log_format()  # 这个格式设置,全runtest只能调用一次,否则将重新输入log的info
logger = log.get_logger()


@paramunittest.parametrized(*eventInfo_xls)
class AddGuest(unittest.TestCase):
    def setParameters(self, case_name, method, eid, phone, status, msg):
        """
        set params
        :param case_name:
        :param method:
        :param eid:
Example #5
0
import unittest
import paramunittest
import readConfig as readConfig
from common import configLog as Log
from common import comm
from common import configHttp as ConfigHttp
from common import businessCommon

getAddress_xls = comm.get_xls("userCase.xlsx", "getAddress")
localReadConfig = readConfig.ReadConfig()
configHttp = ConfigHttp.ConfigHttp()
info = {}


@paramunittest.parametrized(*getAddress_xls)
class GetAddress(unittest.TestCase):
    def setParameters(self, case_name, method, token, address_id, result, code, msg):
        """
        set params
        :param case_name:
        :param method:
        :param token:
        :param address_id:
        :param result:
        :param code:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
        self.method = str(method)
        self.token = str(token)
Example #6
0
import unittest
import paramunittest
import readConfig as ReadConfig
from common.configLog import MyLog
from common import comm
from common import configHttp
from common import businessCommon

localReadConfig = ReadConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()
localLogout_xls = comm.get_xls("userCase.xlsx", "logout")


@paramunittest.parametrized(*localLogout_xls)
class Logout(unittest.TestCase):
    def setParameters(self, case_name, method, token, result, code, msg):
        """
        set parameters
        :param case_name:
        :param method:
        :param token:
        :param result:
        :param code:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
        self.method = str(method)
        self.token = str(token)
        self.result = str(result)
        self.code = str(code)
Example #7
0
import unittest
import paramunittest
import readConfig as readConfig
from common.configLog import MyLog
from common import comm
from common import configHttp

localGenerate_xls = comm.get_xls("userCase.xlsx", "generate")
localConfigHttp = configHttp.ConfigHttp()
localReadConfig = readConfig.ReadConfig()


@paramunittest.parametrized(*localGenerate_xls)
class Generate(unittest.TestCase):
    def setParameters(self, case_name, method, result, code, msg):
        """
        set parameters
        :param case_name:
        :param method:
        :param result:
        :param code:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
        self.method = str(method)
        self.result = str(result)
        self.code = str(code)
        self.msg = str(msg)
        self.response = None
        self.info = None
Example #8
0
from common import comm
from common import configHttp
import readConfig as readConfig

localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()
# 分别把两个Excel的sheet取数为列表形式
localLogin_xls = comm.get_xls("userCase.xlsx", "login")
print(localLogin_xls)
localAddAddress_xls = comm.get_xls("userCase.xlsx", "addAddress")


# login
def login():
    """
    login
    :return: token
    """
    # set url
    url = comm.get_url_from_xml('login')
    localConfigHttp.set_url(url)

    # set header
    token = localReadConfig.get_headers("token_v")
    header = {"token": token}
    localConfigHttp.set_headers(header)

    # set data
    data = {"email": localLogin_xls[0][3], "password": localLogin_xls[0][4]}
    localConfigHttp.set_data(data)
Example #9
0
import unittest
import requests
import time
import datetime
import sys
import os
import unittest
import paramunittest
from common import comm
from common.configLog import MyLog
import readConfig as readConfig
from common import configHttp as configHttp
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir)

eventInfo_xls = comm.get_xls("signCase.xlsx", "add_guest")  # 1.修改Excel读取文件!
localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()
log = MyLog.get_log()
# log.build_log_format()  # 这个格式设置,全runtest只能调用一次,否则将重新输入log的info
logger = log.get_logger()
now = time.strftime("%Y-%m-%d", time.localtime(time.time()))  # yyyy-mm-dd


@paramunittest.parametrized(*eventInfo_xls)
class AddGuest(unittest.TestCase):
    def setParameters(self, case_name, method, eid, realname, phone, status,
                      msg):
        """
        set params
        :param case_name:
Example #10
0
import unittest
import paramunittest
import readConfig as readConfig
from common import configHttp
from common import businessCommon
from common import comm
from common.configLog import MyLog

localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()
localUpdatePassword_xls = comm.get_xls("userCase.xlsx", "updatePassword")


@paramunittest.parametrized(*localUpdatePassword_xls)
class UpdatePassword(unittest.TestCase):

    def setParameters(self, case_name, method, token, old_password, password, password_confirm, result, code, msg):
        """
        set parameters
        :param case_name:
        :param method:
        :param token:
        :param old_password:
        :param password:
        :param password_confirm:
        :param result:
        :param code:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
Example #11
0
import unittest
import paramunittest
import readConfig as readConfig
from common import configLog as Log
from common import comm
from common import configHttp as ConfigHttp

login_xls = comm.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, token, email, password, result,
                      code, msg):
        """
        set params
        :param case_name:
        :param method:
        :param token:
        :param email:
        :param password:
        :param result:
        :param code:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
        self.method = str(method)
Example #12
0
import unittest
import paramunittest
import readConfig as readConfig
from common import configLog as Log
from common import comm
from common import configHttp as ConfigHttp

deleteAddress_xls = comm.get_xls("userCase.xlsx", "deleteAddress")
localReadConfig = readConfig.ReadConfig()
configHttp = ConfigHttp.ConfigHttp()


@paramunittest.parametrized(*deleteAddress_xls)
class DeleteAddress(unittest.TestCase):
    def setParameters(self, case_name, method, address_id, result, code, msg):
        """
        set params
        :param case_name:
        :param method:
        :param address_id:
        :param code:
        :param result:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
        self.method = str(method)
        self.address_id = str(address_id)
        self.code = str(code)
        self.result = str(result)
        self.msg = str(msg)
Example #13
0
import unittest
import paramunittest
from common import comm
from common.configLog import MyLog
import readConfig as readConfig
from common import configHttp as configHttp

productInfo_xls = comm.get_xls("productCase.xlsx", "getProductInfo")
localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()


@paramunittest.parametrized(*productInfo_xls)
class ProductInfo(unittest.TestCase):
    def setParameters(self, case_name, method, token, goods_id, result, code,
                      msg):
        """
        set params
        :param case_name:
        :param method:
        :param token:
        :param goods_id:
        :param result:
        :param code:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
        self.method = str(method)
        self.token = str(token)
        self.goodsId = str(goods_id)
Example #14
0
import unittest
import paramunittest
import readConfig as readConfig
from common.configLog import MyLog
from common import comm
from common import configHttp

localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()
localLoginFB_xls = comm.get_xls("userCase.xlsx", "loginFB")


@paramunittest.parametrized(*localLoginFB_xls)
class LoginFB(unittest.TestCase):
    def setParameters(self, case_name, method, token, email, facebook_id,
                      fbtoken, invite_agency, code, msg):
        """
        set parameters
        :param case_name:
        :param method:
        :param token:
        :param email:
        :param facebook_id:
        :param fbtoken:
        :param invite_agency:
        :param code:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
        self.method = str(method)
Example #15
0
import os
import unittest
import paramunittest
import readConfig as readConfig
from common import comm
from common import configHttp
from common import businessCommon
from common.configLog import MyLog

localUploadImg_xls = comm.get_xls("userCase.xlsx", "uploadImg")
localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()


@paramunittest.parametrized(*localUploadImg_xls)
class UploadImg(unittest.TestCase):
    def setParameters(self, case_name, method, token, whole, file, result,
                      code, msg):
        """
        set param
        :param case_name:
        :param method:
        :param token:
        :param whole:
        :param file:
        :param result:
        :param code:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
Example #16
0
import unittest
import paramunittest
import readConfig as readConfig
from common import configLog as Log
from common import comm
from common import configHttp as ConfigHttp
from common import businessCommon

addressList_xls = comm.get_xls("userCase.xlsx", "getAddressList")
localReadConfig = readConfig.ReadConfig()
configHttp = ConfigHttp.ConfigHttp()
info = {}


@paramunittest.parametrized(*addressList_xls)
class GetAddressList(unittest.TestCase):
    def setParameters(self, case_name, method, token, result, code, msg):
        """
        set params
        :param case_name:
        :param method:
        :param token:
        :param result:
        :param code:
        :param msg:
        :return:
        """
        self.case_name = str(case_name)
        self.method = str(method)
        self.token = str(token)
        self.result = str(result)