当前位置:网站首页>Domestic API management artifact used by the company
Domestic API management artifact used by the company
2022-07-05 16:26:00 【Phyllostachys pubescens】
1、 Preface
Brother Xu Zhu is engaged in back-end development , The back-end interface written at ordinary times , In order to swagger Generate API Interface document , Provided to the front-end call , Documents that interact with the front end ; And then use Postman Self test interface , Some interfaces with performance requirements will use JMeter Conduct interface Can test . Sometimes when developing the front end , want Mock Some of the data , Will use Mock.js To deal with it . It's not easy to do back-end work , To master a variety of tools to cooperate with daily work .
These software are in use , There are some 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 , Each of them 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 .
Later, the technical director of the company promoted Apifox : Set API file 、API debugging 、API Mock、API Automated testing integrated collaboration platform .
I'm on this Apifox With a certain understanding , Share with you .
2、Apifox Introduce
2.1、Apifox What is it?
Apifox yes API file 、API debugging 、API Mock、API Automated testing integrated collaboration platform , location Postman + Swagger + Mock + JMeter. Through a system 、 A piece of data , Solve the problem of data synchronization between multiple systems . Just define API file ,API debugging 、API data Mock、API Automated testing can be used directly , There is no need to redefine ;API Documentation and API Development and debugging use the same tool ,API After the commissioning, it can be guaranteed and API The document definition is exactly the same . Efficient 、 In time 、 accuracy !
2.2、Apifox How to solve the pain point problem
2.2.1、Apifox Core functions
Interface design :Apifox Interface documentation follows OpenApi 3.0 ( primary Swagger)、JSON Schema At the same time , Provides a very easy to use visual document management function , Zero learning cost , Very efficient . And support online sharing of interface documents .
Data model : Reusable data structure , Define the interface return data structure and request 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 the save as use case button , Interface use cases can be generated , 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 , For example, the parameters are correct, and the use case 、 Parameter error use case 、 Data is empty use case 、 Different data state 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 .
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 .
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 .
Interface automation 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 .
Quick request : similar Postman Interface debugging mode , The main purpose is to temporarily debug some interfaces that do not need to be documented , You can quickly debug without defining the interface in advance .
Code generation : Define according to the interface and data model , The system automatically generates the interface request code 、 Front end business code and back-end business code .
Teamwork :Apifox Born for teamwork , Interface cloud real-time synchronous update , A mature team / project / Member rights management , Meet the needs of various enterprises .
2.2.2、Apifox It's not just about getting through the data
If you think Apifox We just got the data through , To improve the efficiency of the R & D team , It would be wrong .Apifox And a lot of innovation , To improve the efficiency of developers .
2.2.2.1、 Interface support “ Use case management ”
Usually, an interface has multiple use cases , such as The right use case
Parameter error use case
Data is empty use case
Different data state use cases
. Define these different states of use cases when defining interfaces , Interface debugging directly run , Very efficient .
2.2.2.2、“ Data model ” Definition 、 quote
Data models can be defined independently , The data model can be referenced directly when defining the interface , Data models can also refer to each other . Same data structure , Just define it once and use it in many places ; Only one modification is needed , Multiple live updates , Avoid inconsistencies .
2.2.2.3、 During debugging “ Automatic verification ” data structure
Use Apifox When debugging the interface , According to the definition in the interface document , Automatically check whether the returned data structure is correct , It is not necessary to identify with the naked eye , There is no need to manually write assertion scripts to detect , Very efficient !
2.2.2.4、“ visualization ” Set assertion
Set assertion :
After operation , Look at the assertion results :
2.2.2.5、“ visualization ” Set extraction variables
2.2.2.6、 Support database operations
2.2.2.7、“ Zero configuration ”Mock Very human data
Let's start with a picture Apifox And other similar tools Zero configuration
mock The result of the data is :
It can be seen that Apifox Zero configuration
Mock The data is very close to the real situation , Front end development can use , You don't have to write it manually mock The rules .
2.2.3、 Apifox How to do high efficiency
、 Zero configuration
It's very human mock data
Apifox According to the data structure in the interface definition 、 data type , Automatic generation mock The rules .
Apifox Built in intelligence mock Rule base , According to the field name 、 Field data type , Intelligent optimization automatically generated mock The rules . Such as : The name contains the string
image
Ofstring
The type field , Automatically mock Give a picture address URL; Include stringtime
Ofstring
The type field , Automatically mock Give a time string ; Include stringcity
Ofstring
The type field , Automatically mock Name a city .
Apifox According to the built-in rules , Can automatically identify pictures 、 Head portrait 、 user name 、 cell-phone number 、 website 、 date 、 Time 、 Time stamp 、 mailbox 、 Province 、 City 、 Address 、IP Etc , thus Mock Very human data .
In addition to the built-in mock The rules , Users can also customize the rule base , Meet a variety of personalized needs . Support use
Regular expressions
、wildcard
To match field name customization mock The rules .
3、 Practice
3.1、 download
Download url , You can order it here Apifox , Support Windows(64 position )、Windows(32 position )、MacOS(Intel chip )、MacOS(M1 chip )、Linux(.Applmage)、Linux(.tar.gz).
You can also use Web The client version uses ( If you need to import a document , It is recommended to use the client )
3.2、 install
Follow the instructions of the installation package .
3.3、 Registered account
Recommended WeChat
Sweep the login code , If there is no account, an account will be created , Just scan the code to complete , In the future, you only need to scan the wechat code to log in .
It also supports email registration .
3.4、 Create a team
After successful login , Display as a team page . We will provide you with a Sample team
Medium The sample project
, You can click to enter , Learn and explore the software
You can also create your own team , Here's the picture
You can also ask your team members to invite you to an existing team , When accepting an invitation , You can click on the top right corner small bell
Operation .
3.5、 Create project
Here's the picture , You can click on the New projects
, Create new projects
3.6、 Entry project
Here we use New projects
For reference , You can 《 A minute , understand Apifox!》 Understand the general content , You can also click 《20 Minutes to learn Apifox》 Watch Video
3.7、 Import
Video teaching , You can have a look if you are interested .
Support import OpenApi ( primary Swagger)
、Postman
、HAR
、RAML
、RAP2
、JMeter
、YApi
、Eolinker
、NEI
、DOClever
、ApiPost
、Apizza
、DOCWAY
、ShowDoc
、apiDoc
、I/O Docs
、WADL
、Google Discovery
And so on , Facilitate the migration of old projects .
3.8、 export
Document teaching , You can have a look if you are interested .
Support direct export OpenAPI ( primary Swagger)
、HTML
、Markdown
And so on .
3.9、 Interface Overview page
3.10、 Interface design interface
Details can be found in Interface design teaching
Interface design defines the interface document specification ( Such as interface path 、 Parameters 、 Return value 、 Data structure, etc ).
and Postman Dissimilarity ,Apifox It's a distinction Interface design
and Interface operation
Of two concepts .
Interface design : namely New interface Interface or interface details edit Interface , The purpose is Define the interface document specification , instead of function Interface , Therefore, the interface can only define basic interface information 、
Parameter name
And parameter description , Instead of settingParameter values
. Parameter values 、 Pre script / Post script Please wait for information atInterface operation
Interface orInterface use cases
Interface filling .
Interface operation : That is... In the interface details function Interface , The purpose is Temporary commissioning interface , function After finishing , Need to click
Save as use case
, To fill in Parameter values 、 Pre script / Post script When the information is saved ; Otherwise closed tab after , This information will be lost .
3.11、 Interface operation interface
4、 summary
Never too old to learn , Keep pace with the times and learn new technologies , New tools , Sure enough, it can improve production efficiency .
How to download and use , Please see the practical part of the article , There is teaching guidance
边栏推荐
- How to use FRP intranet penetration +teamviewer to quickly connect to the intranet host at home when mobile office
- 服务器的数据库连不上了2003,10060“Unknown error“【服务已起、防火墙已关、端口已开、netlent 端口不通】
- 20. [stm32] realize the function of intelligent garbage can by using ultrasonic module and steering gear
- Query the latest record in SQL
- StarkWare:欲构建ZK“宇宙”
- Apiccloud cloud debugging solution
- Why should we learn mathematical modeling?
- 一文带你吃透js处理树状结构数据的增删改查
- CISP-PTE之PHP伪协议总结
- 视觉体验全面升级,豪威集团与英特尔Evo 3.0共同加速PC产业变革
猜你喜欢
sql中set标签的使用
单商户 V4.4,初心未变,实力依旧!
ES6 drill down - Async functions and symbol types
16. [stm32] starting from the principle, I will show you the DS18B20 temperature sensor - four digit digital tube displays the temperature
新春限定丨“牛年忘烦”礼包等你来领~
Five common negotiation strategies of consulting companies and how to safeguard their own interests
ES6深入—ES6 Generator 函数
五种常见的咨询公司谈判策略以及如何维护自己的利益
Seaborn draws 11 histograms
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
随机推荐
项目sql中批量update的时候参数类型设置错误
迁移/home分区
单商户 V4.4,初心未变,实力依旧!
Seaborn draws 11 histograms
Six common transaction solutions, you sing, I come on stage (no best, only better)
18.[stm32] read the ROM of DS18B20 temperature sensor and realize multi-point temperature measurement
Cartoon: what is MapReduce?
Query the latest record in SQL
scratch五彩糖葫芦 电子学会图形化编程scratch等级考试三级真题和答案解析2022年6月
利用GrayLog告警功能实现钉钉群机器人定时工作提醒
Apple 已弃用 NavigationView,使用 NavigationStack 和 NavigationSplitView 实现 SwiftUI 导航
Pits encountered in the use of boolean type in development
Single merchant v4.4 has the same original intention and strength!
list集合根据对象某属性求和,最大值等
Win11提示无法安全下载软件怎么办?Win11无法安全下载软件
Enterprise backup software Veritas NetBackup (NBU) 8.1.1 installation and deployment of server
Some cognitive thinking
践行自主可控3.0,真正开创中国人自己的开源事业
10分钟帮你搞定Zabbix监控平台告警推送到钉钉群
漫画:什么是服务熔断?