sudo snap install postman
。sudo dpkg -i postman.deb
,若报依赖错误则运行:sudo apt-get install -f
。创建请求
Content-Type
(如application/json
)、认证信息(如Authorization: Bearer <token>
)。raw
格式,输入JSON数据(如{"key":"value"}
)。发送请求并验证响应
pm.test("Status code is 200", () => pm.response.to.have.status(200));
pm.test("Response has user ID", () => pm.expect(pm.response.json().id).to.be.a('number'));
。管理测试集合与环境
{{base_url}}
),方便切换测试环境(开发/测试/生产)。高级功能(可选)
newman
命令行工具将测试集成到Jenkins等工具。以上步骤参考自,可根据实际需求选择安装方式和测试场景。