当前位置:网站首页>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
边栏推荐
- ES6 drill down - ES6 generator function
- ES6深入—ES6 Generator 函数
- Cartoon: what is MapReduce?
- The difference between abstract classes and interfaces
- Coding devsecops helps financial enterprises run out of digital acceleration
- 单商户 V4.4,初心未变,实力依旧!
- ES6 deep - ES6 class class
- 一些認知的思考
- Boost the development of digital economy and consolidate the base of digital talents - the digital talent competition was successfully held in Kunming
- Codasip adds verify safe startup function to risc-v processor series
猜你喜欢
Batch update in the project
极坐标扇图使用场景与功能详解
Replknet: it's not that large convolution is bad, but that convolution is not large enough. 31x31 convolution. Let's have a look at | CVPR 2022
《21天精通TypeScript-3》-安装搭建TypeScript开发环境.md
Single merchant v4.4 has the same original intention and strength!
Subclasses and superclasses of abstract classes
The new version of effect editor is online! 3D rendering, labeling, and animation, this time an editor is enough
抽象类中子类与父类
单商户 V4.4,初心未变,实力依旧!
17. [stm32] use only three wires to drive LCD1602 LCD
随机推荐
抽象类中子类与父类
不敢买的思考
Dataarts studio data architecture - Introduction to data standards
tf.sequence_mask函数讲解案例
Transaction rollback exception
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
The difference between abstract classes and interfaces
Parameter type setting error during batch update in project SQL
The list set is summed up according to a certain attribute of the object, the maximum value, etc
单商户 V4.4,初心未变,实力依旧!
异常com.alibaba.fastjson.JSONException: not match : - =
Arduino controls a tiny hexapod 3D printing robot
16. [stm32] starting from the principle, I will show you the DS18B20 temperature sensor - four digit digital tube displays the temperature
10 minutes to help you get ZABBIX monitoring platform alarm pushed to nail group
Research and practice of super-resolution technology in the field of real-time audio and video
RLock锁的使用
obj集合转为实体集合
英特尔第13代Raptor Lake处理器信息曝光:更多核心 更大缓存
2020-2022 two-year anniversary of creation
Practice independent and controllable 3.0 and truly create the open source business of the Chinese people