Loading...
Loading...
Compare original and translation side by side
api-testing-enprompts/api-testing.mdapi-testing-enprompts/api-testing.mdprompts/api-testing.mdprompts/api-testing.mdexamples/postman-rest-api/cd examples/postman-rest-api
npm install -g newman
./newman-run.shexamples/postman-rest-api/cd examples/postman-rest-api
npm install -g newman
./newman-run.sh| 工具 | 适用场景 | 优势 |
|---|---|---|
| Postman/Newman | REST API 测试 | 易用、可视化、CI/CD 集成 |
| REST Assured | Java 项目 | 强类型、BDD 风格 |
| Pytest + Requests | Python 项目 | 灵活、生态丰富 |
| SuperTest | Node.js 项目 | 与 Express 集成好 |
| GraphQL Playground | GraphQL API | 专为 GraphQL 设计 |
| Tool | Applicable Scenario | Advantages |
|---|---|---|
| Postman/Newman | REST API testing | Easy to use, visual, CI/CD integration |
| REST Assured | Java projects | Strongly typed, BDD style |
| Pytest + Requests | Python projects | Flexible, rich ecosystem |
| SuperTest | Node.js projects | Good integration with Express |
| GraphQL Playground | GraphQL API | Designed specifically for GraphQL |
newman: command not foundundefinednewman: command not foundundefinedundefinedundefined{{variable}}-enewman run collection.json -e environment.json{{variable}}-enewman run collection.json -e environment.jsonSSL certificate problemundefinedSSL certificate problemundefinedundefinedundefinedError: ETIMEDOUTError: ESOCKETTIMEDOUTundefinedError: ETIMEDOUTError: ESOCKETTIMEDOUTundefinedundefinedundefinedpm.response.json()// 在 Tests 中添加调试信息
console.log(pm.response.json());pm.response.json()// Add debugging information in Tests
console.log(pm.response.json());// 在第一个请求的 Tests 中保存数据
pm.environment.set("userId", pm.response.json().id);
// 在后续请求中使用
// URL: {{baseUrl}}/users/{{userId}}// Save data in Tests of the first request
pm.environment.set("userId", pm.response.json().id);
// Use it in subsequent requests
// URL: {{baseUrl}}/users/{{userId}}--delay-request 200--bail--delay-request 200--bail