一泊愧、附件類型
類型 |
類型值 |
文本 |
allure.attachment_type.TEXT |
CSV |
allure.attachment_type.CSV |
圖片 |
allure.attachment_type.JPG或PNG |
PDF |
allure.attachment_type.PDF |
html文件 |
allure.attachment_type.HTML |
json文件 |
allure.attachment_type.JSON |
xml文件 |
allure.attachment_type.XML |
mp4 |
allure.attachment_type.MP4 |
二袋狞、添加字符串附件
allure.attach(body,name,attachment_type,extention)
參數(shù)名 |
含義 |
舉例 |
body |
要添加的內(nèi)容 |
如response.json() |
name |
附件的文件名 |
如響應(yīng)報文 |
attachment_type |
如text崖蜜,見附件類型 |
見類型表 |
extention |
附件保存的文件后綴(可不填) |
|
二州胳、示例
class TestSignUp:
def login(self):
url = ''
req = {
"pwd": "string",
"userName": "string"
}
allure.attach(req, '請求', allure.attachment_type.TEXT)
resp = requests.post(url, json=req)
allure.attach(resp.text, '響應(yīng)', allure.attachment_type.TEXT)
三、查看報告