After using the domestic interface management artifact Apifox, I decided to "get out of the pit" from Postman


insert image description here


1. Getting to know Apifox

1. Why use Apifox tools

Under the background of current industry development, most projects are based on 前后端分离the architecture of , and are jointly developed by different teams such as front-end, back-end, testing, operation and maintenance, so whether the teams are good or not 协同合作will undoubtedly directly determine the final project. Effect. Collaboration is actually a pain point for most development teams. In order to facilitate team collaboration, some R&D management tools, such as Jira and Teambition, are also widely used. They mainly focus on project management, code hosting, and defect tracking.

However, in the actual development process, the collaboration between teams is very inefficient. For example, after the requirement review, the front-end and back-end interfaces are defined and an engineer is sent to define the API document (usually using Swagger); then enter the development process, and then The terminal develops the interface according to the API document, and needs to redefine it in Postman according to the document when debugging; before the back-end develops the interface, if the front-end needs to develop, it must go to the mock data according to the API document, that is, in Mock.js Rewrite the interface definition and Mock rules again; the test needs to write test cases in JMeter according to the document before the interface development is completed, and it is inevitable to write the interface definition again;

insert image description here

It can be seen that the entire development process revolves around the API. In this process, different teams need to operate the definition of the interface, which will easily lead to many problems such as inconsistent definitions during joint debugging. And also used different tools such as Swagger, Postman, Mock, JMeter, which obviously caused a lot of waste and inefficient use of resources.

The birth of Apifox is to solve the above problems, the research and development purpose of Apifox - 节省研发团队的每一分钟.

2. What are the functions of Apifox

In response to the above problems, Apifox has indeed proposed a practical solution. On the official website of Apifox, there is such a sentence Apifox = Postman + Swagger + Mock + JMeter, that is, the core functions of these four development tools are integrated together, making the front end , back-end, and testing can easily define and use APIs to avoid a lot of duplication of work. The most important thing is that any adjustments to the API can be synchronized to each team in real time to ensure the consistency of all aspects of the project process .

insert image description here
In addition, Apifox also has the following rich features:

  • API document : Visual interface document management, supports data structure definition, multiple interfaces reuse the same data structure, interface document follows OpenAPI specification, supports online sharing of interface document.
  • API debugging : With all the functions of Postman, it is easier to use, can automatically verify the data structure, and automatically find interface exceptions.
  • API automation test : complete interface scenario test function, support calling other programming languages.
  • API Data Mock : You can mock out very user-friendly data with zero configuration. The built-in mock.js rule engine supports custom expectations.
  • CI continuous integration : supports running interface tests in command line mode, and supports the integration of continuous integration tools such as Jenkins.
  • Database operation : Support database reading and interface verification.
  • Automatically generate code .
  • Data import/export : Supports import/export of more than ten data formats.
  • Teamwork .

For more detailed functions, please refer to the Apifox official website www.apifox.cn .

3. The development process under the API First concept

Apifox adheres to API firstthe advanced concept of (API first), that is, the development team first formulates the API, and then designs and develops around the API. After using Apifox, the development efficiency will be greatly improved, the working experience of all parties will be better, and the collaboration with external teams will be smoother. The development process under this concept is as follows:

development stage work tasks
design phase Determine the interface design ideas according to the requirements document. The interface designer designs the first draft of the interface, and then reviews the interface together with the front and back ends to improve the interface document.
development stage Front-end : Apifox will automatically generate Mock data according to the interface document, and directly enter the development process without writing Mock rules.
Backend : Use Apifox to define the debugging interface according to the interface. Even if the interface changes during the development process, the document can be automatically updated by modifying the interface definition during debugging.
Test : Generate test cases using interface test cases saved during backend debugging.
Joint debugging and testing phase At this point, all interface development is completed, and the test/backend uses the set test function to perform multi-interface integration testing.

2. Getting started with Apifox

1. Install Apifox

You can download Apifox directly from the official website. It can support Windows, Mac, and Linux platforms, or you can use the web version directly;

insert image description here
After the download is complete, click "Next" to install it. The first time you start the software, you need to register and log in.

insert image description here
The initial interface is as follows:

insert image description here

2. Team Management & Project Management

Click "New Team" to create;

insert image description here

The creation is successful as follows. You can create new projects, add members, and grant permissions in the team;

insert image description here

Next, create a new project;

insert image description here

Click on the project to enter as follows, you can perform related operations such as interface management, automated testing, project settings, and inviting members for this project;

insert image description here

3. Write interface documentation

Click "+" --> "New Interface";

The following is an example of a new login interface I created:

Interface address, basic interface information
insert image description here

Request parameter settings
insert image description here

Interface response settings
insert image description here

After setting the relevant properties, click Save, and an Apifox-based interface document will be generated. You can see that you can also run this interface or directly generate code operations;

insert image description here

4. Smart Mock Data

You can see that there is a Mock area in the document that contains the Mock url;

insert image description here

We copy the mock address, open it in the browser, and you can directly access the mock data;

insert image description here

After the API document is set, you can directly use this Mock address for development.

5. Share API documentation online

Click "Project Overview" to create a new online share;

insert image description here

Set parameters such as sharing objects;

insert image description here

Then you can copy the link to share;

insert image description here

View the link effect as follows;

insert image description here

6. Automated testing

Before performing automated testing, we first save the current interface document as a use case, so that the interface use case can be directly imported into automated testing later.

insert image description here

Click "Automated Test" --> "Test Case" --> "Create" to create a new test case;

insert image description here

After the creation is successful, click on the use case to enter, as follows;

insert image description here

Click "Add Step", and then select "Import from [Interface Use Case]";

insert image description here

After the use case is imported, it is as follows;

insert image description here

At this point, you can set the relevant running properties including the running environment, the number of threads, etc., and you can also test the data. Here, you can import CSV or manually add data sets.

insert image description here

Finally, click "Run" to test;

insert image description here

7. API Hub

Apifox provides us with the most commonly used APIs on the market, which can be easily used directly and debugged with one click.

Click "Switch Project", and then select API Hub, as follows;

insert image description here

Click to enter an API, we can select the interface to debug and run;

insert image description here

3. Direct access to Apifox elevator

Apifox, as 完全免费a domestic software, can be used by registering and logging in. How it works can only be known by your friends after you start using it. For software download and study, please go to Apifox official website: www.apifox.cn .

insert image description here


The above is a partial summary of Apifox by Xiaoma. Due to time, space and other reasons, only a small part of Apifox's functions are demonstrated here, and some of the most commonly used operations are shown to help you get started. More in-depth and easy-to-use functions still have to be discovered by yourself. , I believe you will find the real power of Apifox in practice.

Guess you like

Origin blog.csdn.net/weixin_53072519/article/details/126451185