Skip to content

http 接口测试无法使用 assert_api_response 断言 #136

@peeweep

Description

@peeweep
    def test_mycase_001(self):
        """【接口测试-管理员】管理员登录"""
        # 接口请求管理员登录
        # 接口请求成功
        self.host = "localhost:5000"
        self.server_domain = "http://" + self.host + "/"
        self.name = "admin"
        self.password = "123456"
        status, content = self.login_by_api()
>       self.assert_api_response(
            actual_status=status,
            actual_content=content,
            expect_status=200,
            expect_code=0, expect_msg='Login success'
        )
E       AttributeError: 'TestMyCase' object has no attribute 'assert_api_response'

我按照文档 HTTP 接口自动化测试 - 完整实例 使用 assert_api_response 断言,报错 has no attribute 'assert_api_response'

在 src/assert_common.py 中没有找到 assert_api_response, 请问 assert_api_response 是否需要我自己实现呢?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions