def test_required_field(self):
        expect_msg = "请求成功"
        with allure.step('步骤1:发送请求'):
            response = self.api.common_datalist()
            attachJson(response.json(), '接口的相关参数信息')
            response1 = self.api.common_datalist(optional_dataType=1)
            attachJson(response1.json(), '接口的相关参数信息')
            response2 = self.api.common_datalist(optional_dataType=2)
            attachJson(response2.json(), '接口的相关参数信息')
            response3 = self.api.common_datalist(optional_dataType=3)
            attachJson(response3.json(), '接口的相关参数信息')
        with allure.step('步骤2:获取响应信息'):
            response_msg = parseJson_by_objectpath(response.json(),
                                                   "$.message")
            response_areaCode = parseJson_by_objectpath(
                response.json(), "$.*.data.areaCode")
            response_imagePath = parseJson_by_objectpath(
                response.json(), "$.*.data.imagePath")

            attachText("", "接口返回的提示信息:{}".format(response_msg))
            attachText("", "接口返回的提示信息:{}".format(response_areaCode))

        with allure.step('步骤3:检查点校验'):
            attachText("", "期望状态码:{}".format(expect_msg))
            attachText("", "实际状态码:{}".format(response_msg))
            attachText("", "返回区域编码:{}".format(response_areaCode))
            attachText("", "返回图片地址:{}".format(response_imagePath))
            assert expect_msg == response_msg
            assert len(response_areaCode) != 0
            assert len(response_imagePath) != 0
    def test_relate_customer(self):
        response = self.api.common_snap_data_count()
        response_donecount01 = parseJson_by_objectpath(response.json(),
                                                       "$.*.data.doneCount")
        response = self.api.common_relate_customer()
        expect_msg = "添加成功"
        with allure.step('步骤1:发送请求'):
            attachJson(response.json(), '接口的相关参数信息')
        with allure.step('步骤2:获取响应信息'):
            response_msg = parseJson_by_objectpath(response.json(),
                                                   "$.message")

        with allure.step('步骤3:检查点校验'):
            attachText("", "期望状态码:{}".format(expect_msg))
            attachText("", "实际返回参数:{}".format(response_msg))
            assert expect_msg == response_msg

        with allure.step('步骤4:后置条件:成单数+1,我的客户+1'):
            response = self.api.common_snap_data_count()
            response_donecount02 = parseJson_by_objectpath(
                response.json(), "$.*.data.doneCount")
            response = self.api.common_my_customer()
            response_personName01 = parseJson_by_objectpath(
                response.json(), "$.*.data.personName")
            attachText("", "期望返回成单数:{}".format(response_donecount01))
            attachText("", "实际返回成单数:{}".format(response_donecount02))
            attachText("", "期望返回客户姓名:{}".format(self.api.personName02))
            attachText("", "实际返回客户姓名:{}".format(response_personName01))
            assert response_donecount02 == response_donecount01 + 1
            assert self.api.personName02 in response_personName01
    def test_business_(self):
        self.api.common_mark_snap_type(required_vipType=1)
        response = self.api.common_resume_first_customer()
        expect_msg = "请求成功"
        with allure.step('步骤1:发送请求'):
            attachJson(response.json(), '接口的相关参数信息')
            # attachJson(response1.json(), '接口的相关参数信息')
        with allure.step('步骤2:获取响应信息'):
            response_msg = parseJson_by_objectpath(response.json(),
                                                   "$.message")

        with allure.step('步骤3:检查点校验'):
            attachText("", "期望状态码:{}".format(expect_msg))
            assert expect_msg == response_msg

        with allure.step('后置条件:去跟进'):
            expect_msg = "添加成功"
            with allure.step('步骤1:发送请求'):
                response = self.api.common_save_trace_info()
                attachJson(response.json(), '接口的相关参数信息')
            with allure.step('步骤2:获取响应信息'):
                response_msg = parseJson_by_objectpath(response.json(),
                                                       "$.message")
            with allure.step('步骤3:检查点校验'):
                attachText("", "期望状态码:{}".format(expect_msg))
                attachText("", "实际状态码:{}".format(response_msg))
            assert expect_msg == response_msg
    def test_required_field(self):
        expect_msg = "请求成功"
        with allure.step('步骤1:发送请求'):
            response = self.common.common_snap_data_count()
            attachJson(response.json(), '接口的相关参数信息')

        with allure.step('步骤2:获取响应信息'):
            response_msg = parseJson_by_objectpath(response.json(),
                                                   "$.message")
            response_doingcount = parseJson_by_objectpath(
                response.json(), "$.*.data.doingCount")
            response_donecount = parseJson_by_objectpath(
                response.json(), "$.*.data.doneCount")
            response_nocount = parseJson_by_objectpath(response.json(),
                                                       "$.*.data.noCount")
            response_sumcount = parseJson_by_objectpath(
                response.json(), "$.*.data.sumCount")

        with allure.step('步骤3:检查点校验'):
            attachText("", "期望状态码:{}".format(expect_msg))
            attachText("", "实际状态码:{}".format(response_msg))
            attachText("", "返回跟进数量:{}".format(response_doingcount))
            attachText("", "返回未跟进数量:{}".format(response_nocount))
            attachText("", "返回成单数量:{}".format(response_donecount))
            attachText("", "返回总客流数量:{}".format(response_sumcount))
            assert expect_msg == response_msg
            assert response_sumcount > 0
            assert response_doingcount > 0
            assert response_nocount > 0
            assert response_donecount > 0
            assert response_sumcount >= response_donecount + response_nocount + response_doingcount
    def test_required_field(self):
        expect_msg = "请求成功"
        with allure.step('步骤1:发送请求'):
            response = self.common.common_change_customer_info()
            time.sleep(2)
            response2 = self.common.common_my_customer()
            attachJson(response.json(), '接口的相关参数信息')
            attachJson(response2.json(), '接口的相关参数信息')

        with allure.step('步骤2:获取响应信息'):
            response_msg = parseJson_by_objectpath(response.json(),
                                                   "$.message")
            response_personName = parseJson_by_objectpath(
                response2.json(), "$.*.data.personName")
            response_phone = parseJson_by_objectpath(response2.json(),
                                                     "$.*.data.phone")

        with allure.step('步骤3:检查点校验'):
            attachText("", "期望状态码:{}".format(expect_msg))
            attachText("", "实际状态码:{}".format(response_msg))
            attachText("", "期望返回客户姓名:{}".format(self.common.personName02))
            attachText("", "实际返回客户姓名:{}".format(response_personName))
            attachText("", "期望返回客户电话:{}".format(self.common.phone02))
            attachText("", "实际返回客户电话:{}".format(response_phone))

        assert expect_msg == response_msg
        assert self.common.personName02 in response_personName
        assert self.common.phone02 in response_phone
 def test_business_(self):
     response = self.api.common_snap_data_count()
     self.api.common_mark_snap_type()
     time.sleep(3)
     response1 = self.api.common_snap_data_count()
     expect_msg = "请求成功"
     with allure.step('步骤1:发送请求'):
         attachJson(response.json(), '接口的相关参数信息')
         attachJson(response1.json(), '接口的相关参数信息')
     with allure.step('步骤2:获取响应信息'):
         response_msg = parseJson_by_objectpath(response.json(),
                                                "$.message")
         response_msg1 = parseJson_by_objectpath(response1.json(),
                                                 "$.message")
         response_count = parseJson_by_objectpath(response.json(),
                                                  "$.*.data.sumCount")
         response_count1 = parseJson_by_objectpath(response1.json(),
                                                   "$.*.data.sumCount")
         attachText("", "接口返回的提示信息:{}".format(response_msg))
         attachText("", "接口返回的提示信息:{}".format(response_msg1))
         attachText("", "接口返回的提示信息:{}".format(response_count))
         attachText("", "接口返回的提示信息:{}".format(response_count1))
     with allure.step('步骤3:检查点校验'):
         attachText("", "期望状态码:{}".format(expect_msg))
         attachText("", "期望状态码:{}".format(response_msg))
         attachText("", "标记非效客户前的数量:{}".format(response_count))
         attachText("", "标记非效客户后的数量:{}".format(response_count1))
         assert expect_msg == response_msg
         assert response_count == response_count1 + 1
Exemple #7
0
    def common_add_trace_info(self,
                              required_token=None,
                              required_areaCode=None,
                              required_isTrade=None,
                              required_phone=None,
                              required_snapId=None,
                              required_personCode=None,
                              required_personName=None,
                              optional_remark=None,
                              optionael_brands=None,
                              optional_used=None,
                              optional_intention=None):
        # for _ in range(0,1):
        #     upload.run()
        # time.sleep(5)
        self.common_save_trace_info()
        self.response = self.common_datalist().json()
        num = get_num(
            parseJson_by_objectpath(self.response, "$.*.data.personName"))
        self.personName = parseJson_by_objectpath(self.response,
                                                  "$.*.data.personName")[num]

        self.personCode = parseJson_by_objectpath(self.response,
                                                  "$.*.data.personCode")[num]

        self.phone = parseJson_by_objectpath(self.response,
                                             "$.*.data.phone")[num]
        self.snapId = \
            parseJson_by_objectpath(self.response, "$.*.data.snapId")[num]
        if required_token is None: required_token = self.token
        if required_areaCode is None: required_areaCode = self.areaCode
        if required_isTrade is None: required_isTrade = 1
        if required_snapId is None: required_snapId = self.snapId
        if required_personCode is None: required_personCode = self.personCode
        if required_personName is None: required_personName = self.personName
        if optional_remark is None: optional_remark = "追加记录..."
        if optionael_brands is None: optionael_brands = ["黄金", "白金", "钻石"]
        if optional_used is None: optional_used = ["送礼", "收藏", "自用"]
        if optional_intention is None: optional_intention = "高"
        if required_phone is None: required_phone = self.phone
        return self.base_add_trace_info(
            required_token=required_token,
            required_areaCode=required_areaCode,
            required_isTrade=required_isTrade,
            required_snapId=required_snapId,
            required_personCode=required_personCode,
            required_personName=required_personName,
            optional_remark=optional_remark,
            optionael_brands=optionael_brands,
            optional_used=optional_used,
            optional_intention=optional_intention,
            required_phone=required_phone)
Exemple #8
0
 def common_resume_first_customer(self,
                                  reqiured_snapId=None,
                                  required_token=None):
     if required_token is None: required_token = self.token
     self.response = self.common_datalist().json()
     snapId = parseJson_by_objectpath(self.response, "$.*.data.snapId")[0]
     if reqiured_snapId is None: reqiured_snapId = snapId
     return self.base_resume_first_customer(required_token=required_token,
                                            reqiured_snapId=reqiured_snapId)
Exemple #9
0
    def common_relate_customer(self,
                               required_token=None,
                               required_areaCode=None,
                               required_imagePathList=None,
                               required_imageHeader=None,
                               required_isTrade=None,
                               required_snapId=None,
                               required_snapIdList=None,
                               required_personCode=None,
                               required_personName=None,
                               required_phone=None):
        self.response = self.common_datalist(optional_dataType=1).json()
        self.phone02 = random_num()
        self.personName02 = random_str()
        self.snapId = \
            parseJson_by_objectpath(self.response, "$.*.data.snapId")[0]
        self.imagePath = parseJson_by_objectpath(self.response,
                                                 "$.*.data.imagePath")[1]
        self.imageHeader = parseJson_by_objectpath(self.response,
                                                   "$.*.data.imagePath")[0]
        if required_token is None: required_token = self.token
        if required_areaCode is None: required_areaCode = self.areaCode
        if required_personCode is None: required_personCode = 0
        if required_snapId is None: required_snapId = self.snapId
        if required_imagePathList is None:
            required_imagePathList = [self.imagePath]
        if required_imageHeader is None:
            required_imageHeader = self.imageHeader
        if required_isTrade is None: required_isTrade = 1
        if required_personName is None: required_personName = self.personName02
        if required_phone is None: required_phone = self.phone02
        if required_snapIdList is None: required_snapIdList = [self.snapId - 1]

        return self.base_relate_customer(
            required_token=required_token,
            required_personCode=required_personCode,
            required_personName=required_personName,
            required_phone=required_phone,
            required_snapIdList=required_snapIdList,
            required_imageHeader=required_imageHeader,
            required_imagePathList=required_imagePathList,
            required_isTrade=required_isTrade,
            required_areaCode=required_areaCode,
            required_snapId=required_snapId)
Exemple #10
0
    def test_required_field(self):
        expect_msg = "请求成功"
        with allure.step('步骤1:发送请求'):
            response = self.common.common_my_customer()
            attachJson(response.json(), '接口的相关参数信息')

            with allure.step('步骤2:获取响应信息'):
                response_personName = parseJson_by_objectpath(
                    response.json(), "$.*.data.personName")
                response_msg = parseJson_by_objectpath(response.json(),
                                                       "$.message")

            with allure.step('步骤3:检查点校验'):
                attachText("", "输入客户姓名:{}".format(self.input_personName))
                attachText("", "返回客户姓名:{}".format(response_personName))
                attachText("", "期望状态码:{}".format(expect_msg))
                attachText("", "实际状态码:{}".format(response_msg))

            assert expect_msg == response_msg
            assert self.input_personName in response_personName
Exemple #11
0
 def test_required_field(self):
     expect_msg = "添加成功"
     with allure.step('步骤1:发送请求'):
         response = self.common.common_save_trace_info()
         attachJson(response.json(), '接口的相关参数信息')
     with allure.step('步骤2:获取响应信息'):
         response_msg = parseJson_by_objectpath(response.json(),
                                                "$.message")
     with allure.step('步骤3:检查点校验'):
         attachText("", "期望状态码:{}".format(expect_msg))
         attachText("", "实际状态码:{}".format(response_msg))
     assert expect_msg == response_msg
Exemple #12
0
    def __init__(self):
        self.config = Config()
        self.request = MyRequest()
        self.config = Config()
        self.log = MyLog()
        self.session = requests.session()
        response = self.login().json()
        print(response)
        text = parseJson_by_objectpath(response, "$.*.message")
        self.token = parseJson_by_objectpath(response, "$.*.data.token")
        self.areaCode = parseJson_by_objectpath(response, "$.*.data.areaCode")

        try:
            if text == "登录成功":
                self.log.log_info("登入成功...")
            else:
                self.log.log_error("登入失败...")
                exit("登入失败...")
        except:
            self.log.log_warning("登录时出现异常:请检查域名信息是否正确...")
            exit(1)
Exemple #13
0
 def common_save_trace_info(self,
                            required_token=None,
                            required_snapId=None,
                            required_areaCode=None,
                            optional_phone=None,
                            optional_personName=None,
                            required_image=None,
                            required_isTrade=None,
                            optionael_brands=None,
                            optional_used=None,
                            optional_intention=None,
                            optional_remark=None):
     self.response = self.common_datalist().json()
     self.snapId = \
         parseJson_by_objectpath(self.response, "$.*.data.snapId")[0]
     self.imagePath = parseJson_by_objectpath(self.response,
                                              "$.*.data.imagePath")[0]
     if required_token is None: required_token = self.token
     if required_snapId is None: required_snapId = self.snapId
     if required_areaCode is None: required_areaCode = self.areaCode
     if optional_phone is None: optional_phone = random_num()
     if optional_personName is None: optional_personName = random_str()
     if required_image is None: required_image = self.imagePath
     if required_isTrade is None: required_isTrade = 0
     if optionael_brands is None: optionael_brands = ["黄金"]
     if optional_used is None: optional_used = ["自己用"]
     if optional_intention is None: optional_intention = "中"
     if optional_remark is None: optional_remark = "测试..."
     return self.base_save_trace_info(
         required_token=required_token,
         required_snapId=required_snapId,
         required_areaCode=required_areaCode,
         required_phone=optional_phone,
         optional_personName=optional_personName,
         required_image=required_image,
         required_isTrade=required_isTrade,
         optionael_brands=optionael_brands,
         optional_used=optional_used,
         optional_intention=optional_intention,
         optional_remark=optional_remark)
Exemple #14
0
 def common_mark_snap_type(self,
                           required_token=None,
                           required_snapId=None,
                           required_vipType=None):
     self.response = self.common_datalist().json()
     self.snapId = \
         parseJson_by_objectpath(self.response, "$.*.data.snapId")[0]
     if required_token is None: required_token = self.token
     if required_snapId is None: required_snapId = self.snapId
     if required_vipType is None: required_vipType = 0
     return self.base_mark_snap_type(required_token=required_token,
                                     required_snapId=required_snapId,
                                     required_vipType=required_vipType)
Exemple #15
0
 def test_required_field(self):
     expect_msg = "参数token:token不能为空"
     expect_msg2 = "参数areaCode:区域编码不能为空"
     with allure.step('步骤1:发送请求'):
         response = self.api.base_datalist(
             required_areaCode=self.api.areaCode)
         attachJson(response.json(), '接口的相关参数信息')
         response2 = self.api.base_datalist(required_token=self.api.token)
         attachJson(response2.json(), '接口的相关参数信息')
     with allure.step('步骤2:获取响应信息'):
         response_msg = parseJson_by_objectpath(response.json(),
                                                "$.message")
         response_msg2 = parseJson_by_objectpath(response2.json(),
                                                 "$.message")
         attachText("", "接口返回的提示信息:{}".format(response_msg))
         attachText("", "接口返回的提示信息:{}".format(response_msg2))
     with allure.step('步骤3:检查点校验'):
         attachText("", "期望状态码:{}".format(expect_msg))
         attachText("", "实际状态码:{}".format(response_msg))
         attachText("", "期望状态码:{}".format(expect_msg2))
         attachText("", "实际状态码:{}".format(response_msg2))
         assert expect_msg == response_msg
         assert expect_msg2 == response_msg2
Exemple #16
0
    def common_change_customer_info(self,
                                    required_token=None,
                                    required_personCode=None,
                                    optional_phone=None,
                                    optional_personName=None):
        self.response = self.common_datalist().json()
        self.phone02 = random_num()
        self.personName02 = random_str()
        num = get_num(
            parseJson_by_objectpath(self.response, "$.*.data.personName"))
        self.personCode02 = parseJson_by_objectpath(self.response,
                                                    "$.*.data.personCode")[num]

        if required_token is None: required_token = self.token
        if required_personCode is None: required_personCode = self.personCode02
        if optional_phone is None: optional_phone = self.phone02
        if optional_personName is None: optional_personName = self.personName02

        return self.base_change_customer_info(
            required_token=required_token,
            required_personCode=required_personCode,
            optional_personName=optional_personName,
            optional_phone=optional_phone,
        )
Exemple #17
0
    def test_business_(self):
        WSI_MASK_PATH = 'F:\\模拟上传数据\\6000_picture'  # 存放图片的文件夹路径
        wsi_mask_paths = glob.glob(os.path.join(WSI_MASK_PATH, '*.jpg'))
        path = random.choice(wsi_mask_paths)
        self.picturePath = path
        upload.run(picture=self.picturePath)
        time.sleep(5)
        self.api.common_save_trace_info(required_isTrade=0)
        time.sleep(5)
        response = self.api.common_datalist()
        time.sleep(5)
        upload.run(picture=path)
        time.sleep(5)
        response2 = self.api.common_datalist()
        time.sleep(5)
        self.api.common_save_trace_info(required_isTrade=1)
        response1 = self.api.common_datalist()
        expect_msg = "请求成功"
        with allure.step('步骤1:发送请求'):
            attachJson(response.json(), '接口的相关参数信息')
            attachJson(response1.json(), '接口的相关参数信息')
            attachJson(response2.json(), '接口的相关参数信息')

        with allure.step('步骤2:获取响应信息'):
            response_msg = parseJson_by_objectpath(response.json(),
                                                   "$.message")
            response_personName = parseJson_by_objectpath(
                response.json(), "$.*.data.personName")[0]
            response_msg1 = parseJson_by_objectpath(response1.json(),
                                                    "$.message")
            response_personName2 = parseJson_by_objectpath(
                response2.json(), "$.*.data.personName")[0]
            response_vipType = parseJson_by_objectpath(response.json(),
                                                       "$.*.data.vipType")[0]
            response_vipType1 = parseJson_by_objectpath(
                response1.json(), "$.*.data.vipType")[0]
            attachText("", "接口返回的提示信息:{}".format(response_msg))
            attachText("", "接口返回的提示信息:{}".format(response_msg1))
            attachText("", "接口返回跟进后的客户姓名:{}".format(response_personName))
            attachText("", "接口返回下次来访识别的客户姓名:{}".format(response_personName2))

        with allure.step('步骤3:检查点校验'):
            attachText("", "期望状态码:{}".format(expect_msg))
            attachText("", "实际返回参数:{}".format(response_vipType))
            attachText("", "期望返回参数:{}".format(2))
            attachText("", "实际返回参数:{}".format(response_vipType1))
            attachText("", "期望返回参数:{}".format(3))
            attachText("", "第一次跟进后的客户名:{}".format(response_personName))
            attachText("", "客户第二次来会员识别的客户名:{}".format(response_personName2))
            assert response_vipType == 2
            assert response_vipType1 == 3
            assert expect_msg == response_msg
            assert expect_msg == response_msg1
            assert response_personName2 == response_personName
Exemple #18
0
 def test_business_(self):
     expect_msg = "请求成功"
     with allure.step('步骤1:发送请求'):
         response = self.api.common_datalist()
         attachJson(response.json(), '接口的相关参数信息')
         response1 = self.api.common_datalist(optional_dataType=1)
         attachJson(response1.json(), '接口的相关参数信息')
         response2 = self.api.common_datalist(optional_dataType=2)
         attachJson(response2.json(), '接口的相关参数信息')
         response3 = self.api.common_datalist(optional_dataType=3)
         attachJson(response3.json(), '接口的相关参数信息')
     with allure.step('步骤2:获取响应信息'):
         response_msg = parseJson_by_objectpath(response.json(),
                                                "$.message")
         response_phone = parseJson_by_objectpath(response.json(),
                                                  "$.*.data.phone")
         # response_areaName = parseJson_by_objectpath(response.json(), "$.*.data.areaName")
         response_areaCode = parseJson_by_objectpath(
             response.json(), "$.*.data.areaCode")
         response_imagePath = parseJson_by_objectpath(
             response.json(), "$.*.data.imagePath")
         response_vipType1 = parseJson_by_objectpath(
             response1.json(), "$.*.data.vipType")
         response_vipType2 = parseJson_by_objectpath(
             response2.json(), "$.*.data.vipType")
         response_vipType3 = parseJson_by_objectpath(
             response3.json(), "$.*.data.vipType")
         attachText("", "接口返回的提示信息:{}".format(response_msg))
         attachText("", "接口返回的提示信息:{}".format(response_areaCode))
         # attachText("", "接口返回的提示信息:{}".format(response_areaName))
         attachText("", "接口返回的提示信息:{}".format(response_vipType1))
         attachText("", "接口返回的提示信息:{}".format(response_vipType2))
         attachText("", "接口返回的提示信息:{}".format(response_vipType3))
     with allure.step('步骤3:检查点校验'):
         attachText("", "期望状态码:{}".format(expect_msg))
         attachText("", "实际状态码:{}".format(response_msg))
         attachText("", "期望状vipType:{}".format(-1))
         attachText("", "实际状vipType:{}".format(response_vipType1))
         attachText("", "期望状vipType:{}".format(2))
         attachText("", "实际状vipType:{}".format(response_vipType2))
         attachText("", "期望状vipType:{}".format(3))
         attachText("", "实际状vipType:{}".format(response_vipType3))
         assert expect_msg == response_msg
         assert len(response_phone) != 0
         assert -1 in response_vipType1
         assert 2 in response_vipType2
         assert 3 in response_vipType3