当前位置:网站首页>ApiFox 基本使用教程(浅尝辄止,非广)
ApiFox 基本使用教程(浅尝辄止,非广)
2022-08-02 02:23:00 【万里长江雪】
文章目录
概述
ApiFox 集 API 文档、API 调试、API Mock、API 自动化测试 功能于一体,
Apifox = Postman + Swagger + Mock + JMeter
新建接口
在一个接口中,ApiFox 允许你添加以下部分:
- 接口名称、分组、状态、责任人、服务、标签、说明
- 请求方法(GET、POST、PATCH、PUT、DELETE、HEAD 等)
- 请求路径(比如
/hello/world/{world_id}?offset=0&limit=25) - 请求参数(Query 与 Path)
- 请求体
- 请求头
- Cookie
- Auth
- SSL 设置、自动重定向
- 响应结果(返回结果)

请求方法
ApiFox 支持定义 GET、POST、PUT、DELETE、OPTIONS、HEAD、PATCH、TRACE、CONNECT、COPY、LINK、UNLINK、PURGE、LOCK、UNLOCK、MKCOL、MOVE、PROPFIND、REPORT、VIEW 方法。
请求路径 & 请求参数
请求路径中填写 ip:port 或 ip:port/project_name 之后的路径
在请求路径中,可以添加请求参数(Query Parameters)和路径参数(Path Parameters),例如 /hello/world/{world_id}?offset=0&limit=25,其中的请求参数 offset、limit 与路径参数 world_id 都会在请求参数部分自动出现:
请求体

对于每个请求体中的字段,可以设置其数据类型、Mock 正则式、高级设置(如下图,可以设置默认值、枚举、数值范围等,可以通过编辑源码直接进行规则设置):

请求头
可以对每个接口设置请求头字段

响应体
响应体的字段设置类似于请求体

接口测试
对于后端来说,其除了是接口文档外,还是接口测试工具(参考 Postman)。

自动生成合适的测试数据
我们可以像使用 Postman 一样在接口测试中添加 Params、Body、Headers 等测试数据,但是其强大在于我们可以根据在前文的「请求体」中设置的 Mock 正则、默认值、枚举等信息自动生成接口测试数据!

保存测试用例
不同于 Postman 以组为粒度,ApiFox 以每个具体的接口为粒度保存测试用例:

Mock
在后端还没写好接口时,前端需要使用一个假数据接口来进行前端页面的数据渲染测试工作,ApiFox 提供了这个 Mock 功能,并可以根据以上设置的规则自动生成合适 Mock 数据:

先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- nacos startup error, the database has been configured, stand-alone startup
- to-be-read list
- NIO's Sword
- Pinduoduo leverages the consumer expo to promote the upgrading of domestic agricultural products brands and keep pace with international high-quality agricultural products
- 列表常用方法
- 淘宝详情.
- EFCore 反向工程
- BI - SQL 丨 WHILE
- 【web】理解 Cookie 和 Session 机制
- 53. 最小的k个数
猜你喜欢

Speed up your programs with bitwise operations

CASE2023

LeetCode brush diary: LCP 03. Machine's adventure

四元数、罗德里格斯公式、欧拉角、旋转矩阵推导和资料

Oracle数据类型介绍

2022-08-01 mysql/stoonedb慢SQL-Q18分析

Software testing Interface automation testing Pytest framework encapsulates requests library Encapsulates unified request and multiple base path processing Interface association encapsulation Test cas

Nanoprobes丨1-巯基-(三甘醇)甲醚功能化金纳米颗粒

Handwritten Blog Platform ~ Day Two
![[LeetCode Daily Question] - 103. Zigzag Level Order Traversal of Binary Tree](/img/b9/35813ae2972375fa728e3c11fab5d3.png)
[LeetCode Daily Question] - 103. Zigzag Level Order Traversal of Binary Tree
随机推荐
2022-08-01 Install mysql monitoring tool phhMyAdmin
Safety (1)
Redis Persistence - RDB and AOF
Rasa 3.x 学习系列- Rasa - Issues 4873 dispatcher.utter_message 学习笔记
A good book for newcomers to the workplace
Nanoprobes多组氨酸 (His-) 标签标记:重组蛋白检测方案
The first time I wrote a programming interview question for Niu Ke: input a string and return the letter with the most occurrences of the string
EFCore 反向工程
AntPathMatcher uses
GTK RGB图像绘制
leetcode / anagram in string - some permutation of s1 string is a substring of s2
C language inserted into the characters of simple exercises
How to adjust the cross cursor too small, CAD dream drawing calculation skills
【web】理解 Cookie 和 Session 机制
Chopper webshell feature analysis
790. 数的三次方根
JVM调优实战
Reflex WMS Intermediate Series 7: What should I do if I want to cancel the picking of an HD that has finished picking but has not yet been loaded?
29. 删除链表中重复的节点
Pinduoduo leverages the consumer expo to promote the upgrading of domestic agricultural products brands and keep pace with international high-quality agricultural products