Beispiel #1
0
class TestRelateCustomer:
    def setup_class(self):
        self.api = CommonApi()

    def setup_method(self):
        with allure.step('前置条件1:上传两条抓拍数据'):
            for _ in range(0, 2):
                upload.run()
            time.sleep(5)

    @allure.feature('关联客户')
    @allure.story('迭代一')
    @allure.description("用例名称:关联客户,成单数+1,我的客户+1")
    @allure.severity('blocker')
    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
Beispiel #2
0
class TestMyCustomer:
    def setup_class(self):
        # self.api = BaseApi()
        self.common = CommonApi()
        self.config = Config()

    def setup_method(self):
        with allure.step('前置条件1:已跟进一个客户'):
            for _ in range(0, 1):
                upload.run()
            time.sleep(5)
            self.input_personName = random_str()
            res_json = self.common.common_save_trace_info(
                optional_personName=self.input_personName)
            attachJson(res_json, "接口详细信息")

    @allure.feature('我的客户')
    @allure.story('我的客户')
    @allure.description("用例名称:新跟进一个客户,查看我的客户列表更新")
    @allure.severity('blocker')
    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
Beispiel #3
0
class TestChangeCustomerInfo:
    def setup_class(self):
        # self.api = BaseApi()
        self.common = CommonApi()
        self.config = Config()

    @allure.feature('修改我的客户')
    @allure.story('修改我的客户')
    @allure.description("用例名称:修改我的客户名称电话,查看更新后结果")
    @allure.severity('blocker')
    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