As developers, including front-end, back-end, and testers, Postman is the most indispensable tool for us to debug API interfaces. But Postman doesn’t fully meet our various API requirements, such as maintaining API documentation, API mocks, API automated testing, and so on. Apifox, an API one-stop-shop tool, is literally beating Postman!
1. About Apifox
Postman + Swagger + Mock + JMeter Apifox is an integrated collaboration platform for API documentation, API debugging, API Mock and API automated testing. One-stop service for data synchronization between multiple systems.
2. How do I install it
First of all, we open the official website of Apifox: www.apifox.cn/, according to our system selection to download…
The website interface
First, we need to create a team. Apifox supports team management. You can invite your team mates to join in. And support cloud data sharing! Facilitate collaboration among team members
Create a team 🔧
We then create projects in that team, Apifox projects for permission management (such as administrator Settings, read-only permissions, and so on)
Create a project 📚
After successfully creating the project, we started to experience the powerful functions of Apifox!
Apifox is very considerate and provides a complete PET store CRUD API Demo for users to use, so that new users can try new products through the Demo at the first time! The following figure 👇
The Demo to try
3. Support API document import
Apifox supports import of Swagger, Postman, RAP2, JMeter, YApi, Eolinker, Apizza, ShowDoc, apiDoc and more than 20 other tools. Apifox is compatible with most data types on the market, so we don’t have to worry about data migration anymore!
How do I import interface documents through Apifox
By clicking the import button shown below 👇
Import the interface document 📒
Then select Swagger from the data format option in the import interface, select THE URL import Tab button, and enter Swagger’s data URL to 👇
Import the interface document 📒
After successful import, the import preview panel will be displayed, showing the interface to be imported, data model, etc. Apifox will convert the entity class returned by our interface into data model for future reuse
Generating interface data
When the above steps are complete, you can start debugging the interface. In the figure below, we can see that APifox has two Tab modules for viewing and modifying documents, which is convenient for us to manage interface documents.
4. Interface management
After playing with the above process, we started to experience the core basic features. For example, editing and debugging a single interface
4.1 Interface Design
The interface is inseparable from the interface request parameters and the description of each parameter. The parameters in the Apifox interface are very detailed.
Request Parameters interface
After talking about the request parameters, let’s take a look at the return results screen. The results are presented in a tree structure, and the main point is to support folding. Domestic mostly with type software is to do not have!
Return result interface
Finally, let’s take a look at another Tab function module to modify documents, supporting state modification, grouping and labeling functions
4.2 Interface Debugging
When it comes to interface debugging, I’m sure postman is the first thing that comes to mind, but you may not know that Apifox is more powerful than Postman
Apifox supports environment configuration, which gives us three environments by default: formal, test, and Mock services. It is convenient for us to make corresponding configurations according to different environment scenarios when developing interfaces
Multiple environment support
Before you start debugging the interface, we need to configure the leading Url defined by the environment, in this case the formal environment
Setting the leading Url
In addition, Apifox supports some custom operations before and after an interface call. In the Apifox interface, they are called pre – and post-operations respectively. As an example, the postfix operation
Pre-action & post-action
We add an assertion to the post-operation of one of the interfaces, and if the interface returns code=200, the operation succeeds
Support the assertion
Finally, we call this interface to verify this functionality! Found that the assertion results are not what we expected!
5. Customize scripts
Apifox supports both pre – and post-operation functions. It supports not only simple assertions and variable extraction, but also custom scripts (write your own JS files).
Supports custom scripts ✏️
Again, we use the above custom scripts to validate the data returned by our interface
6. Front-end Mock data
Mock data is also one of the most powerful features of Apifox, boasting the ability to generate very user-friendly Mock data with zero configuration.
Let’s take a look at what smart rules are built into Apifox 👇
Preset Mock rules
One particularly lovely rule is @image. We mock out different pictures according to different sizes as shown below: 👇
The Mock pictures 🖼 ️
If you feel that the built-in Mock function of Apifox is not enough for your application scenario, we can customize the Mock rule by supporting the familiar mock. js syntax 👇
Support Mockjs extension 🔧
Once you’ve configured your mock rules, just switch your environment to the Mock service and start calling the Mock data interface!
Is the data from Apifox Mock as humanized as the official website says? 👇
Humanized Mock data 🤩
A: wow! Whether it’s a picture, an ID, or a value in an array object, the Mock data is returned in the format I expect.
If the official default Mock rule doesn’t satisfy your scenario, you can customize the rule with Mockjs as mentioned above
7. Eggs
In addition to the powerful functions of Apifox, the interaction and design attract me the most. There is even a choice of theme, and I personally prefer to use the official default “dark background” and the main color “lake blue”
The last
In addition to powerful functions, THE UI interface interaction design of Apifox is also unmatched by similar software in China. Postman has almost all of the interface debugging features, including Mock data, API document management, automated testing, and more. It also has good extensibility, such as custom scripts, pre-actions, post-actions, and so on. After you experience it, you will say wow! 🤩
PS: In case you can’t find this article, please click “like” to browse and find it