2026/1/22 22:48:22
网站建设
项目流程
网站建设开源,1771wan网页游戏,网吧可以做网站吗,搜索引擎优化公司排行1、通过装饰器实现#通过装饰器进行美化import allureallure.epic(PC端) #一级归类
allure.feature(首页) #二级归类
class TestLogin(object):allure.story(登录) #三级归类allure.title(用正确的账号密码登录) …1、通过装饰器实现#通过装饰器进行美化 import allure allure.epic(PC端) #一级归类 allure.feature(首页) #二级归类 class TestLogin(object): allure.story(登录) #三级归类 allure.title(用正确的账号密码登录) #用例标题 allure.severity(allure.severity_level.CRITICAL) #优先级 # BLOCKER blocker 优先级等级 # CRITICAL critical # NORMAL normal # MINOR minor # TRIVIAL trivial # classmethod def testlogin3(self): print(用类方法写用例) allure.story(登录) allure.title(用错误的账号密码登录) # staticmethod def testlogin4(self): print(用实例方法写用例) allure.story(登录) allure.title(用不存在的账号密码登录) def testlogin5(self): print(用实例方法写用例)报告呈现优先级呈现2、获取详细的响应日志:import allure r3 requests.post(http://localhost:8080/login, data{username: zhangsan, password: 123456 }) allure.attach(str(r3.request.url), 请求地址, attachment_typeallure.attachment_type.TEXT) allure.attach(str(r3.request.method), 请求方法, attachment_typeallure.attachment_type.TEXT) allure.attach(str(r3.request.headers), 请求header, attachment_typeallure.attachment_type.TEXT) allure.attach(str(r3.request.body), 请求body, attachment_typeallure.attachment_type.TEXT) allure.attach(str(r3.status_code), 响应状态码, attachment_typeallure.attachment_type.TEXT) allure.attach(str(r3.headers), 响应header, attachment_typeallure.attachment_type.TEXT) allure.attach(str(r3.text), 响应body, attachment_typeallure.attachment_type.TEXT)报告示例