How to use Apifox to do a simple interface test

Why do we need to do interface testing?

Interface testing is the most common test in daily testing. Interface testing can detect data interaction, whether parameter transmission is normal, and detect mutual logical dependencies between systems.

Whether it is front-end, back-end or testing, they will all come into contact with interface testing. It can be seen that a good choice of testing tools can greatly reduce the work of the team and improve the efficiency and quality of the development team.

Why choose Apifox

Apifox is a collaboration platform integrating Postman, Swagger, JMeter and Mock. When contacting interface testing, the selection of interface testing tools is particularly important, which not only saves costs but also improves efficiency. The first interface testing tool I came into contact with was postman. This platform is simple and easy for beginners to use, and the graphical interface is also very intuitive. However, many functions of postman are paid, which will increase development costs; Second is swagger, which is very useful for generating interface documents. Finally, there is Apifox. After being exposed to Apifox, you no longer need to use other interface testing tools separately, which makes interface testing easier to manage.

Advantages of Apifox

1. Graphical interface, fully Chinese version, simple and easy to use.
2. Most of the functions are open source, which reduces development costs (except for privatized deployment)
3. Apifox has all the functions that Postman has
4. Supports interface reuse
5. Supports data import, strong portability
6. Smart mock , custom data type

A simple interface test case to help you understand Apifox in seconds

When we open Apifox, we can create a new project. We can make our projects private and view them only for ourselves, and we can also invite members to join our team.

Apifox has multiple ways of writing interface tests. Here are two commonly used ones. The first is to create a new interface directly in the project and fill in the corresponding interface, name, parameters, etc. The other method is to import through packet capture. This method is very convenient and basically does not require writing any parameters. Let me give you an example, and you will find that this method is simply not very enjoyable!

Take the Baidu homepage as an example. We need to test whether Baidu can be accessed normally, and we can generate an interface by capturing packets.

insert image description here

Enter Baidu homepage, after F12, refresh the web page, find the corresponding event, and copy the path

insert image description hereIn this way, we capture the request and can directly generate the interface in Apifox. Click the plus button in the middle and choose to import packet capture data

insert image description here
Paste the packet capture document we just copied here using ctrl+v

insert image description here
After clicking OK, Apifox will automatically fill in the corresponding address and parameters for us. We just need to click Send to test this interface.

insert image description here

insert image description here
What is generated in this way is a request, and we can also save it as an interface.

insert image description here
After generating the interface, we can click Run to execute the interface and test whether the interface can be used normally. At the same time, we can also save this interface as a use case.

A simple interface test is completed. For novices and novices, Apifox is very easy to use and has powerful functions. After reading this, you can try to practice some simple interface tests yourself, maybe you can use them in your future work.


Finally, I would like to share with you some of my learning materials:

the above content should be the most comprehensive and complete preparation warehouse for software testing friends. In order to better organize each module, I also refer to many high-quality blog posts on the Internet. And projects, try not to miss every knowledge point. Many friends rely on these contents to review and get offers from big companies such as BATJ. This warehouse has also helped many learners of software testing, and I hope it can help you .

Follow my WeChat official account below to get it for free! ↓ ↓ ↓ ↓ ↓

Guess you like

Origin blog.csdn.net/weixin_54696666/article/details/132744421