def __init__(self): conf = Config() self.request = Request.Request() self.host = conf.host_debug self.test = Assert.Assertions() self.login = Login_interface() self.g = globals()
def setUpClass(cls): cls.initEvn = initEvn() cls.req_url = cls.initEvn.host cls.login = Login_interface() cls.resource = Resource_interface() cls.g = globals() cls.g["Cookie"] = initEvn().get_userCookie() LOG.info('测试用例开始执行')
def setUpClass(cls): cls.initEvn = initEvn() cls.req_url = cls.initEvn.host cls.product = Product_interface() cls.login = Login_interface() cls.user_token, cls.appid = initEvn().get_userToken() # 商品名称 cls.productName = "测试" + str(int(time.time())) cls.goodsName = "测试" + str(int(time.time())) cls.g = globals() LOG.info('测试用例开始执行')
class initEvn(): def __init__(self): conf = Config() self.request = Request.Request() self.host = conf.host_debug self.test = Assert.Assertions() self.login = Login_interface() self.g = globals() # 定义报告详情 def test_report(self): conf = Config() env = "private_debug" conf.set_conf(env, "versioncode", "V3.5") tester = conf.get_conf(env, "tester") environment = conf.get_conf(env, "environment") versioncode = conf.get_conf(env, "versioncode") details = tester + "_" + environment + versioncode return details def get_userToken(self): # 用户登录 token, appid = self.login.login(self.host, phoneNumber="15527060286", password="******") # 获取 用户token user_token = self.login.get_userToken(self.host, appId=appid, token=token) return user_token, appid