Ejemplo n.º 1
0
class TestMarkTypeCount:
    def setup_class(self):
        self.api = CommonApi()

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

    @allure.feature('接口关联业务逻辑')
    @allure.story('标记为非客户-总客流')
    @allure.description("用例名称:上传一张客流标记为非客户之后,统计数量减1")
    @allure.severity('blocker')
    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
Ejemplo n.º 2
0
class TestResumeCustomer:
    def setup_class(self):
        self.api = CommonApi()

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

    @allure.feature('接口关联业务逻辑')
    @allure.story('标记为无效客户客户-总客流')
    @allure.description("用例名称:上传一张客流标记为无效客户之后,恢复为客流,去跟进")
    @allure.severity('blocker')
    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
Ejemplo n.º 3
0
class TestMarkSnapType:
    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)

    def teardown_method(self):
        pass

    @allure.feature('标记为非客户')
    @allure.story('标记为非客户')
    @allure.description("用例名称:上传一张客流标记为非客户")
    @allure.severity('blocker')
    def test_required_field(self):
        expect_msg = "请求成功"
        with allure.step('步骤1:发送请求'):
            response = self.common.common_mark_snap_type()
            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

# 店员业绩

    class TestClerkTradeList:
        def setup_class(self):
            # self.api = BaseApi()
            self.common = CommonApi()
            self.config = Config()

        def setup_method(self):
            pass

        def teardown_method(self):
            pass

        @allure.feature('查看所有店员的业绩')
        @allure.story('查看所有店员的业绩')
        @allure.description("用例名称:查看所有店员的业绩")
        @allure.severity('blocker')
        def test_required_field(self):
            expect_msg = "请求成功"
            with allure.step('步骤1:发送请求'):
                response = self.common.common_clerk_tradelist()
                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