def setUp(self): self.log = Log() self.log.info('loginnull测试开始') case_excle = ReadCase('mltest.xlsx', '工作表1') self.login_url_null = case_excle.get_interface_url('login_null') self.login_data_null = case_excle.get_interface_data('login_null') self.login_headers_null = case_excle.get_intetface_headers('login_null')
def setUp(self): case_excle = ReadCase('mltest.xlsx', '工作表1') self.getnearbyplaces_url = case_excle.get_interface_url( 'getnearbyplaces', True) self.getnearbyplaces_data = case_excle.get_interface_data( 'getnearbyplaces') self.getnearbyplaces_headers = { 'Content-Type': 'application/json; charset=UTF-8' }
def setUp(self): print("测试准备,比如链接数据库,获取配置文件内容等操作") case_excle = ReadCase('mltest.xlsx', '工作表1') self.login_url = case_excle.get_interface_url('login') self.login_data = case_excle.get_interface_data('login') self.login_headers = case_excle.get_intetface_headers('login') self.login_data_error = case_excle.get_interface_data('login_error') self.login_url_error = case_excle.get_interface_url('login_error') self.login_headers_error = case_excle.get_intetface_headers( 'login_error')
def post_password_login3(self): "已注册过的手机号码,密码填写错误登录" casename = sys._getframe().f_code.co_name L.build_start_line(casename) case = ReadCase('login', 'post_password_login3', case_file).read_case_info()[0] L.info("获取到的用例信息为: %s" % str(case)) confighttp = ConfigHttp(*case) response = confighttp.post() result = response.json() L.info("返回的请求内容为: %s" % str(result)) self.assertEqual(result['code'], 500) self.assertEqual(result['message'], case[7]) L.build_end_line(casename)
def test_get_verification_code6(self): "未注册过的用户重置密码获取验证码" casename = sys._getframe().f_code.co_name L.build_start_line(casename) case = ReadCase('verification_code', 'get_verification_code6', case_file).read_case_info()[0] L.info("获取到的用例信息为: %s" % str(case)) confighttp = ConfigHttp(*case) response = confighttp.get('') result = response.json() L.info("返回的请求内容为: %s" % str(result)) self.assertEqual(result['code'], 10011005) self.assertIn(case[7], result['message']) L.build_end_line(casename)
def test_get_verification_code7(self): "注册码获取后的登录检查" casename = sys._getframe().f_code.co_name L.build_start_line(casename) case = ReadCase('verification_code', 'get_verification_code7', case_file).read_case_info() L.info("获取到的用例信息为: %s" % str(case)) L.info("第一步获取验证码") confighttp = ConfigHttp(*case[0]) response = confighttp.get('') result = response.json() L.info("第一步返回的请求内容为: %s" % str(result)) L.info("第二步登录注册") confighttp2 = ConfigHttp(*case[1]) response2 = confighttp2.post('') result2 = response2.json() L.info("返回的请求内容为: %s" % str(result2)) self.assertEqual(result2['code'], 200) self.assertIn(case[1][7], result['message']) L.build_end_line(casename)
def test_post_mobile_login2(self): "未注册过的手机号码,验证码登录" casename = sys._getframe().f_code.co_name L.build_start_line(casename) case = ReadCase('login', 'post_mobile_login2', case_file).read_case_info() print(case[0]) print(case[1]) L.info("获取到的用例信息为: %s" % str(case)) L.info("第一步获取验证码") confighttp = ConfigHttp(*case[0]) response = confighttp.get() result = response.json() L.info("第一步返回的请求内容为: %s" % str(result)) L.info("第二步登录") # time.sleep(60) confighttp2 = ConfigHttp(*case[1]) response2 = confighttp2.post() result2 = response2.json() L.info("返回的请求内容为: %s" % str(result2)) self.assertEqual(result['code'], 901003) self.assertIn(case[0][7], result['message']) L.build_end_line(casename)