ApiFox basic usage tutorial (a brief taste, not extensive)

Overview

Official website: https://www.apifox.cn/

ApiFox integrates API documentation, API debugging, API Mock, and API automated testing functions.

Apifox = Postman + Swagger + Mock + JMeter

Create new interface

In an interface, ApiFox allows you to add the following parts:

  • Interface name, group, status, responsible person, service, label, description
  • Request method (GET, POST, PATCH, PUT, DELETE, HEAD, etc.)
  • Request path (for example /hello/world/{world_id}?offset=0&limit=25)
  • Request parameters (Query and Path)
  • Request body
  • Request header
  • Cookie
  • Auth
  • SSL settings, automatic redirection
  • Response result (return result)

Insert image description here

Request method

ApiFox supports GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH, TRACE, CONNECT, COPY, LINK, UNLINK, PURGE, LOCK, UNLOCK, MKCOL, MOVE, PROPFIND, REPORT, VIEW methods.

Request path & request parameters

Fill in the path after ip:portor in the request path . In the request path, you can add request parameters (Query Parameters) and path parameters (Path Parameters) . For example , the request parameters and path parameters will automatically appear in the request parameters section:ip:port/project_name
image-20220526201731549
/hello/world/{world_id}?offset=0&limit=25offsetlimitworld_id
Insert image description here

Request body

Insert image description here
For each field in the request body, you can set its data type , Mock regular expression , and advanced settings (as shown below, you can set default values , enumerations , value ranges, etc., and you can set rules directly by editing the source code ):

Insert image description here

Request header

Request header fields can be set for each interface

Insert image description here

response body

The field settings of the response body are similar to the request body

Insert image description here

Interface testing

For the backend, in addition to being an interface document, it is also an interface testing tool (see Postman).

Insert image description here

Automatically generate appropriate test data

We can add Params, Body, Headers and other test data in the interface test just like using Postman, but its power lies in the fact that we can automatically generate interfaces based on the Mock regularity, default values, enumeration and other information set in the previous "Request Body" Test Data !

Insert image description here

Save test case

Unlike Postman, which uses groups as the granularity, ApiFox saves test cases at the granularity of each specific interface:

Insert image description here

Mock

When the back-end interface has not yet been written, the front-end needs to use a fake data interface to perform data rendering testing on the front-end page. ApiFox provides this Mock function and can automatically generate appropriate Mock data according to the rules set above :

Insert image description here

Guess you like

Origin blog.csdn.net/m0_46261993/article/details/124991628