当前位置:网站首页>Apifox (postman + swagger + mock + JMeter), an artifact of full stack development and efficiency improvement
Apifox (postman + swagger + mock + JMeter), an artifact of full stack development and efficiency improvement
2022-07-05 00:36:00 【Straw hat Luffy driven by interest】
One 、ApiFox brief introduction
Introduce :ApiFox It's an integrated API file 、API debugging 、API Mock、API An integrated collaboration platform with multiple functions such as automated testing .
Functional orientation :
Apifox = Postman + Swagger + Mock + JMeter
.Download and install : Official website download address
After downloading, install it directly . If you don't want to install the client , It can also be used directly WEB edition , More lightweight .
Two 、ApiFox Usage scenarios of
Apifox Interface management 、 Development 、 Test the whole process integration tool , Use the audience for the entire R & D technology team , The main users are The front-end development
、 The backend development
and Testers
.
- The front-end development
- Interface document management
- Interface data Mock
- Interface debugging
- Front end code is automatically generated
- The backend development
- Interface document management
- Interface debugging
- Interface automation testing
- Back end code is automatically generated
- Testers
- Interface debugging
- Interface automation testing
3、 ... and 、ApiFox With the advantage of one enemy four
In the use of Postman + Swagger + Mock + JMeter when , We often encounter the following problems :
It's very difficult to maintain data consistency between different tools 、 Inefficient . And it's not just about the workload , The bigger problem is data inconsistency between multiple systems , Leading to inefficient collaboration 、 Frequent problems , Developers and testers are in agony .
- Developers in Swagger After defining the document , Interface debugging also needs to go Postman Define it again .
- The front-end development Mock When it comes to data mockjs Define it again , You also need to set it manually Mock The rules .
- Testers need to go to JMeter Define it again .
- Front end according to mockjs Mock The data is developed , Back end according to Swagger The defined interface document is developed , They all passed the test , I thought I could go online right away , As a result, a variety of problems were found :
- The interface changed during development , Only modified Swagger, But they didn't synchronize the changes in time mockjs.
- The interface data type of back-end development is inconsistent with the document , It's hard to see the problem with the naked eye .
- Again , Test in JMeter Well written test cases , When it's really running, you'll find all kinds of inconsistencies .
- Time is long. , The inconsistencies will get more and more serious .
ApiFox How to solve these problems ?
Apifox = Postman + Swagger + Mock + JMeter
Apifox yes API file 、API debugging 、API Mock、API Automated testing integrated collaboration platform .
Through a system 、 A piece of data , Solve the problem of data synchronization between multiple systems . Just define the interface document , Interface debugging 、 data Mock、 Interface testing can be used directly , There is no need to redefine ; Interface documentation and interface development debugging use the same tool , After the interface debugging is completed, it can ensure that it is completely consistent with the interface document definition . Efficient 、 In time 、 accuracy !
Four 、ApiFox Simple introduction
Install the client ( Or use WEB End ) after , You can use it directly :
- Create new teams and projects :
- Set the theme :( Default is white theme )
- The interface test : Get weather data
The corresponding results after running are as follows :
{
"reason": " The query is successful !",
"result": {
"city": " Hangzhou ",
"realtime": {
"temperature": "14",
"humidity": "55",
"info": " Fine ",
"wid": "00",
"direct": " dongfeng ",
"power": "3 level ",
"aqi": "140"
},
"future": [
{
"date": "2022-02-27",
"temperature": "8/14℃",
"weather": " Sunny to cloudy ",
"wid": {
"day": "00",
"night": "01"
},
"direct": " The east wind turns and there is no wind direction "
},
{
"date": "2022-02-28",
"temperature": "9/20℃",
"weather": " Cloudy to drizzle ",
"wid": {
"day": "01",
"night": "07"
},
"direct": " Continue to turn from no wind to northwest wind "
},
{
"date": "2022-03-01",
"temperature": "7/15℃",
"weather": " Light rain ",
"wid": {
"day": "07",
"night": "07"
},
"direct": " The northwest wind turns and there is no wind direction "
},
{
"date": "2022-03-02",
"temperature": "7/17℃",
"weather": " It's sunny to cloudy ",
"wid": {
"day": "00",
"night": "02"
},
"direct": " There is no wind direction "
},
{
"date": "2022-03-03",
"temperature": "8/14℃",
"weather": " Light to moderate rain ",
"wid": {
"day": "07",
"night": "21"
},
"direct": " There is no wind direction "
}
]
},
"error_code": 0
}
5、 ... and 、API Interface design and interface documents
Apifox Interface documentation follows OpenApi 3.0 ( primary Swagger)、JSON Schema At the same time , It's very easy to use visualization
Document management function , Zero learning cost , Very efficient . And support online sharing of interface documents .
When we define API After the interface , It can be directly generated online API file :
6、 ... and 、API data Mock
Interface data Mock: built-in Mock.js Rules engine , Very convenient mock All kinds of data , And you can define the data structure and write mock The rules . Support adding “ expect ”, According to the request parameters, different mock data . most important of all Apifox Zero configuration
that will do Mock Very human data , The details are introduced later in this paper .
- Create a new Mock Interface :
- Define the interface name and input parameters :
- Set up mock The corresponding result :
We can click the preview to view the generated random mock data (ApiFox The most intelligent place is , He can set it according to you mock Parameters , To automatically identify and randomly select the corresponding parameter values , For example, our birthday The field will be automatically recognized as birthday ):
- Code auto generation :
We can customize mock Data interface , To automatically generate the corresponding entity class code .
- preservation mock Interface , And run the test :
Test browser access :
7、 ... and 、API automated testing
Provide interface set testing , You can choose the interface ( Or interface use cases ) Quickly create test sets . At present, more functions of interface automation test are still under development , Coming soon ! The goal is : JMeter Some functions are basically , And use it better .
- Reference resources :ApiFox Official documentation of automated testing
8、 ... and 、 Database integration
As shown in the figure below ,ApiFox You can connect to remote or local databases , It can be used as a lightweight visualization tool for database operation :
make new connection :
Support multiple source data import :
Nine 、 Online debugging
This document is written in Apifox It's done , I have tried this tool before , I didn't expect that so many powerful new functions have come out recently .
Click the run button in the upper right corner of the document , Will appear “ The online operation ” Module :
You can directly debug the interface on this interface ! direct 1. Fill in the parameters ,2. Select environment ,3. Point send , The interface request is sent out ! Here is the return result ! There is no need for Postman! Not to mention API Copy it again !
I thought. , If before the launch , It's using Apifox Words , There is simply no accident :
Parameter does not exist ? I got the data after online debugging , By comparison, I know which parameter does not exist
Wrong parameter type ? alike , After online commissioning , By comparison , I know which parameter has the wrong type
Interface does not exist ( Because the interface is written incorrectly )? When debugging, it will be reported that the interface does not exist , Find the back end at the first time ~
Ten 、ApiHub
ApiHub It integrates many third-party applications Api Tools , for example :
Let's take a gaud map API Use case of :
- Use the Gaud map API Call the weather interface : Reference documents
The effect is as follows :
Of course, you can also test other interface calling functions of Gaode map here ~
other
Besides ApiFox It also has many other functions , for example :
- Data model : Reusable data structure , Defining interfaces
Return data structure
AndRequest parameter data structure
( only JSON and XML Pattern ) You can directly reference . Support model direct nested reference , direct JSON/XML Smart import , Support oneOf、allOf And other advanced combination modes . - Interface debugging :Postman Some functions , For example, environment variables 、 In front of / Post script 、Cookie/Session Global Shared And so on ,Apifox There are , And ratio Postman More efficient and easy to use . After the interface runs, click
Save as use case
Button , It can generateInterface use cases
, Interface use cases can be run directly later , No more parameters need to be entered , Very convenient . Custom script 100% compatible Postman grammar , And support running javascript、java、python、php、js、BeanShell、go、shell、ruby、lua And other language codes . - Interface use cases : Usually, an interface has multiple use cases , such as
The parameters are correct
Use cases 、Parameter error
Use cases 、Data is empty
Use cases 、Different data states
Use cases, etc . The correctness of data will be automatically verified when running the interface case , Using interface use cases to debug interfaces is very efficient . - Database operation : Support reading database data , Used as an interface request parameter . Support reading database data , Used to verify ( Assertion ) Whether the interface request is successful .
- Quick request : similar Postman Interface debugging mode , It is mainly used for temporary debugging
No documentation required
The interface of , You can quickly debug without defining the interface in advance . - Code generation : Define according to the interface and data model , Automatic system generation
Interface request code
、Front end business code
AndBack end business code
. - Teamwork :Apifox Born for teamwork , Interface cloud real-time synchronous update , ripe
The team / project / Member rights
management , Meet the needs of various enterprises . - …
Want to know more , You can check the official website :ApiFox Official website address ,ApiFox Official Q & A qun
边栏推荐
- 华为百万聘请数据治理专家!背后的千亿市场值得关注
- js如何实现数组转树
- [Peking University] tensorflow2.0-1-opening
- Learn C language from scratch day 024
- Learning of basic amplification circuit
- Life is changeable, and the large intestine covers the small intestine. This time, I can really go home to see my daughter-in-law...
- 7. Scala process control
- Hologres Query管理及超时处理
- The waterfall flow layout demo2 (method 2) used by the uniapp wechat applet (copy and paste can be used without other processing)
- Kibana index, mapping, document operation
猜你喜欢
2022.07.03(LC_6111_统计放置房子的方式数)
Learn C language from scratch day 024
Tester's algorithm interview question - find mode
华为200万年薪聘请数据治理专家!背后的千亿市场值得关注
Continuous modification of business scenario functions
Specification for fs4061a boost 8.4v charging IC chip and fs4061b boost 12.6V charging IC chip datasheet
全栈开发提效神器——ApiFox(Postman + Swagger + Mock + JMeter)
A new method for analyzing the trend chart of London Silver
ORB(Oriented FAST and Rotated BRIEF)
leetcode518,377
随机推荐
挖财学院开户安全的吗?开户怎么开?
[selenium automation] common notes
A new method for analyzing the trend chart of London Silver
Reasons and solutions of redis cache penetration and avalanche
uniapp微信小程序拿来即用的瀑布流布局demo2(方法二)(复制粘贴即可使用,无需做其他处理)
分布式BASE理论
Kibana index, mapping, document operation
[Yocto RM]11 - Features
JS how to realize array to tree
Two numbers replace each other
[Yocto RM]10 - Images
Nine Qi single chip microcomputer ny8b062d single key control four LED States
js如何实现数组转树
Life is changeable, and the large intestine covers the small intestine. This time, I can really go home to see my daughter-in-law...
uniapp上传头像
[论文阅读] CarveMix: A Simple Data Augmentation Method for Brain Lesion Segmentation
Fs8b711s14 electric wine bottle opener MCU IC scheme development special integrated IC
巩固表达式C# 案例简单变量运算
实战模拟│JWT 登录认证
Hisilicon 3559 universal platform construction: YUV422 pit stepping record