当前位置:网站首页>Powerful domestic API management tool
Powerful domestic API management tool
2022-07-06 22:00:00 【Peach blossom key God】
Preface
If you are a Java Back end Development Engineer , image Swagger、Postman、RAP These tools , It should be familiar ! It brings a lot of convenience to our interface development , But because these are independent frameworks , There is no interoperability between , Therefore, when coordinating among multiple frameworks , Inevitably, it will bring some repetitive work ;
Today, let's introduce a powerful domestic tool :Apifox, take Swagger 、 Postman 、 RAP 、 JMeter The function of is perfectly integrated , A tool , Fix it all .
What is? Apifox
Apifox = Interface debugging + Interface documents are generated quickly + Standardized management of interface documents +Mock API+ Interface process test .
Common interface management schemes :
API file :Swagger
debugging API:Postman
Mock API data :RAP
API automated testing :JMeter
Apifox The original intention is to improve the efficiency of various roles of the R & D team ! The audience of the product is the front-end development 、 The whole R & D technical team composed of back-end development and testing personnel and technical managers .
Apifox Integrate each role of the R & D team through the collaboration function .
function
- 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 debugging : 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 .
Use
API Interface to use
send out HTTP request
API Interface function layout
API Request parameters
Header and cookie Parameters
You can set or import Header Parameters ,cookie You can also set
Query Parameters
Query Support construction URL Parameters , Support at the same time RESTful Of PATH Parameters ( Such as :id)
Body Parameters
Body There are three types form-data / x-www-form-urlencoded / raw , Each type offers three different UI Interface
- When you need to submit a form , Switch to x-www-form-urlencoded
- When you need to submit a form with documents , Switch to form-data
- When you need to send JSON Object or other objects , Switch to the corresponding raw The type is enough
API Request and response
Click the send button , If there is data returned , The returned data... Will be displayed , response time , Response code ,Cookie etc. .
Be careful : The default returned data is Pretty Pattern , Easy to view JSON XML Format . You can switch Native or preview Pattern See other types .
return Headers
Set global parameters
Here's a reminder , I also found out the setting of this global parameter after looking for a long time . It's a little deep , The main reason is that there are too many functions, haha .
Here you can also set up a test environment 、 Global environment 、 Global variables 、 Local mock、 Cloud mock etc. , It has complete functions and is very powerful .
One click document generation
Generating documentation
New interface
Set interface information
Set direct save
Integration of interface documents
Modifying the interface here directly modifies the document , It is very convenient . The modified document and interface can be updated synchronously in real time to call the open system API All developers , It avoids a lot of communication and notification work required for project interface upgrading or iteration .
Document export
Import postman\swagger file
Import documents can be added in the interface management office
Support import OpenApi (Swagger)、Postman、apiDoc、HAR、RAML、RAP2、YApi、Eolinker、NEI、DOClever、ApiPost 、Apizza 、ShowDoc、API Blueprint、I/O Docs、WADL、Google Discovery And so on , Facilitate the migration of old projects .
Support timed automatic import OpenApi (Swagger)、apiDoc、Apifox Format data .
Share documents online
You can share your interface with other members , You can also set our access password 、 Expiration time, etc. click on the Project Overview =》 New share
Mock
Most enterprises adopt agile development for their products , In order to ensure multi terminal synchronization , Once the plan is determined , It needs to pass Mock Generate API Data rules for ; In this way, multiple terminals can be developed according to document rules , The team will not interfere with each other because they see each other's progress 、 Interact with each other .
To write Mock The rules
stay APIfox in ,Mock Rule templates support rich types
The basic data ( Fix json structure )
{
"code": "0",
"data": {
"name": " Zhang Sanfeng ",
"age": 100
},
"desc": " success "
}
The basic data (Mock Random json structure )
{
"code": "0",
"data": {
"list|20": [{
"name": "@name",
"age": "@integer(2)"
}],
"url": "https://localhost/create"
},
"desc": " success "
}
RESTFUL Logical data
In some scenarios , We may need to according to the input parameter rules of the interface , Add appropriate logic processing before returning data . A simple scenario is the login scenario , The user name and password are required , Determine whether the login is successful . Or , We need to according to the product ID Dynamically return product information , wait .
Now? ,Apifox Of Mock Services provide a solution to this scenario .
In the following example , We used _req.body object , Its meaning is :
When post Request for x-www-form-urlencoded perhaps application/json When the method is submitted , We can get the parameter object of the request .
{
"code": "0000", "data": {
"verifySuccess": function() {
let body = _req.body; return body.username === 'admin' && body.password === '123456'; }, "userInfo": function() {
let body = _req.body; if (body.username === 'admin' && body.password === '123456') {
return Mock.mock({
username: "admin", email: "@email", address: "@address" }); } else {
return null; } }, }, "desc": " success "}
obtain Mock Address
- Switch to Mock Environment to test
Click on the quick request directly
automated testing
Process test is a test for a set of interfaces , Choose the appropriate environment , Can be run as a series of requests .
When you want to automate API When testing , Process testing is very useful .
Create a test process
step :
- New interface , And add assertions
- Open process test , Create a new process
- Add a test interface to the process
- Selection environment , Click to start testing
- View the returned test interface
summary
thus ,Apifox The common core functions have been introduced , but Apifox The power of is not limited to this , In team management 、 Collaborative management 、 Many aspects of project management are excellent , If you haven't used it , It is suggested to try , I believe that after use , Will fall in love with !
download
Official website address :www.apifox.cn
边栏推荐
- [Yu Yue education] reference materials for surgical skills teaching in Tongji University
- GPS from getting started to giving up (XVIII), multipath effect
- Redistemplate common collection instructions opsforzset (VI)
- C how to set two columns comboboxcolumn in DataGridView to bind a secondary linkage effect of cascading events
- Persistence / caching of RDD in spark
- guava:Collections. The collection created by unmodifiablexxx is not immutable
- Reset Mikrotik Routeros using netinstall
- JPEG2000-Matlab源码实现
- Why is the cluster mode of spark on Yan better than the client mode
- make menuconfig出现recipe for target ‘menuconfig‘ failed错误
猜你喜欢
Why rdd/dataset is needed in spark
GPS从入门到放弃(十二)、 多普勒定速
C how to set two columns comboboxcolumn in DataGridView to bind a secondary linkage effect of cascading events
【sciter】: 基于 sciter 封装通知栏组件
麦趣尔砸了小众奶招牌
GPS from entry to abandonment (XVII), tropospheric delay
PostgreSQL install GIS plug-in create extension PostGIS_ topology
Huawei has launched attacks in many industries at the same time, and its frightening technology has made European and American enterprises tremble
GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)
Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?
随机推荐
一行代码可以做些什么?
Checkpoint of RDD in spark
语谱图怎么看
[Chongqing Guangdong education] Tianjin urban construction university concrete structure design principle a reference
It's not my boast. You haven't used this fairy idea plug-in!
强化学习-学习笔记5 | AlphaGo
AI 企业多云存储架构实践 | 深势科技分享
Search map website [quadratic] [for search map, search fan, search book]
Codeforces Round #274 (Div. 2) –A Expression
Uni app app half screen continuous code scanning
设置状态栏样式Demo
20 large visual screens that are highly praised by the boss, with source code templates!
Guava: three ways to create immutablexxx objects
NPM run dev start project error document is not defined
MariaDb数据库管理系统的学习(一)安装示意图
14 years Bachelor degree, transferred to software testing, salary 13.5k
Save and retrieve strings
Yyds dry goods inventory C language recursive implementation of Hanoi Tower
Kohana 数据库
Vit paper details