1. 程式人生 > >簡單方便的api介面測試工具:Chrome瀏覽器外掛postman

簡單方便的api介面測試工具:Chrome瀏覽器外掛postman

Postman可以用來方便地測試自己的api介面,全球已經有幾萬家公司幾百萬人在使用。具體的官方介紹:
Postman makes API development faster, easier, and better. The free app is used by more than 3.5 million developers and 30,000 companies worldwide. Postman is designed with the developer in mind, and packed with features and options.

Postman features include:
  • Powerful, simple to use GUI
  • Saved history of API requests
  • Unlimited collections, environments, tests, and sharing
  • Automated testing with collection runner
  • Web-viewable, detailed API documentation
  • Flexible API monitoring, for uptime, performance, and accuracy
  • Mock servers, to support split-stack development

使用Chrome瀏覽器外掛postman測試api介面:
1、開啟Chrome瀏覽器的“應用”管理視窗,點選“Chrome網上應用商店”:


2、搜尋“postman”,找到“開發者工具”上萬人打星的那一個,“新增至CHROME”:

3、在“應用管理視窗”就可以看到postman的圖示了,點選開啟:


4、可能會提示登入,使用google賬號登入就行了


5、建立新的測試:
1)、點選“+”號建立一個新測試用例
2)、選擇GET、POST等一種請求method
3)、選擇Body要傳送的內容,(或點選“Params”填寫key-value引數)
4)、選擇Body的引數型別
5)、選擇Body的編碼格式
6)、填寫Body的具體內容(比如json格式的請求引數)
7)、點選“Send”傳送請求、並檢視結果
8)、歷史記錄會記錄在左邊




6、儲存測試用例:

點選“Save”,選擇或參加一個目錄,就可以儲存測試用例了。在視窗的左邊的Collections標籤裡面可以看到儲存過的測試用例。可以直接“Run”了。