超詳細!Postman安裝與使用(教科書級)
大家好,我是阿沐,我來了啊~(文章首發於微信公眾號:程式設計師阿沐,轉載請註明出處!)
本節大綱
Øpostman簡介
Øpostman環境安裝
Øpostman介面測試-get請求
Øpostman介面測試-post請求
01。postman簡介
postman是什麼?
• Postman是一款功能強大的網頁除錯與傳送網頁 HTTP 請求的介面測試工具。
postman有幾種安裝方式?
• 兩種,應用程式和瀏覽器外掛
postman安裝方式
02。postman環境安裝
postman下載
下載地址: https://www。getpostman。com/apps
支援系統: Mac / windows / linux
安裝方法:雙擊 exe 檔案可以完成安裝
postman安裝
postman安裝詳情在postman安裝。docx文件中
postman介面介紹
Ø 主介面
Ø 請求面板
1。 URL:請求地址,如果有引數會自動解析顯示在 Params 中,如果手動在 Params 新增引數,也會自動補充到 URL 中
2。 Method:支援幾乎所有的 Method:get / post / put / patch / delete / copy
3。 Headers:可以隨時新增、編輯 header 屬性,打出首字母時,會貼心的在下拉選單中顯示標準的屬性
4。 Request Body
Form-data: 可以上場一個檔案作為 key 的 value 提交, key-value 不寫入 URL ,而是直接提交
X-www-form-urlencoded:key-value 會寫入 URL
Raw: 可以包含任何東西,都會隨著請求傳送
Binary:image,audio,video,text files
Ø 響應面板
Ø 響應介紹:
1。 可以儲存、複製、搜尋響應內容
2。 有body / cookie / header / test 四個板塊
3。 Body提供三種檢視檢視:
Pretty: 格式化後顯示,方便檢視
Raw: 最原始資料,及 text 格式
Preview: 自動解析 HTML 頁面並顯示
4。 Status / time / size單獨顯示在旁邊,滑鼠懸浮可以檢視詳情。
03。postman介面測試-get請求
postman介面測試
Ø postman進行介面測試的必要條件:
1。 請求地址(url)
2。 請求協議:http , webservice
3。 請求方式:get/post , resful
4。 請求頭
5。 引數:表單提交,請求體提交
Ø postman 進行介面收發包的過程;簡單理解,介面收發包的過程就像透過快遞公司寄快遞,
需要知道對方的地址( URL )、選擇快遞公司( HTTP )、填快遞單(頭域資訊)、包裝快
遞物品(傳送請求體引數)
postman介面測試-get請求
Ø postman傳送 get 請求
Ø 介面文件
04。postman介面測試-post請求
postman介面測試-post請求
Ø postman傳送 post 請求
Ø 案例1 :電商介面文件: 1 、電商登入介面
postman介面測試-post請求
Ø postman傳送 post 請求總結
Ø post請求的引數是在 body 中傳遞,有多種傳值方式,需要根據頭部引數的 Content-Type 的
值來確定選擇哪種方式傳值。
Ø Content-Type取值與 body 傳值方式對應關係
Ø postman傳送 post 請求
Ø 案例2 :電商介面文件: 2 、電商上傳檔案介面
postman介面測試-post請求
Ø postman傳送 post 請求
Ø 案例3 :電商介面文件: 3 、住邏輯登入介面
文章首發於微信公眾號:程式設計師阿沐,轉載請註明出處!
————————————————
版權宣告:本文為CSDN博主「軟體測試阿沐」的原創文章,遵循CC 4。0 BY-SA版權協議,轉載請附上原文出處連結及本宣告。