As a software developer, API debugging is an essential skill, and Postman does it very well. But API debugging is only part of the overall software development process, and there are many things That Postman can’t do, or can’t do efficiently: API documentation definitions, API mocks, API automated testing, and so on. Apifox was created to solve this problem.

Interface Management Status

I. Common solutions

  1. Manage API documentation with Swagger
  2. Use the Postman debug API
  3. Mock API data using tools such as MockJs
  4. Use JMeter to automate API testing

Second, existing problems

Maintaining data consistency across different tools is difficult and inefficient. And it’s not just the workload that’s at issue here, it’s the inconsistencies of data across multiple systems that lead to inefficient collaboration, frequent failures, and misery for developers and testers.

  1. After Swagger has defined the document, developers need to go to Postman to define it again during interface debugging.

  2. MockJs is defined again when the front-end develops Mock data, and the Mock rules need to be set manually.

  3. Testers need to go to JMeter to define it again.

  4. After the front-end was developed according to the data derived from MockJs Mock, and the back-end was developed according to the interface document defined by Swagger, both of them passed the test. I thought they could be launched immediately, but various problems were found after the docking:

    • During the development process, the interface was changed, only Swagger was modified, but MockJs was not synchronized and modified in time.
    • The backend interface data types and documents are inconsistent, making it difficult for the naked eye to detect problems.
  5. Similarly, the tests found various inconsistencies when JMeter’s written test cases were actually run.

  6. Over time, the inconsistencies get worse and worse.

Apifox solution

First, how to solve these problems

1. Apifox positioning

Apifox = Postman + Swagger + Mock + JMeter

Apifox is an integrated collaboration platform for API documentation, API debugging, API Mock and API automated testing.

It solves the data synchronization problem among multiple systems by using one set of systems and one piece of data. Once the interface documentation is defined, interface debugging, data Mock, and interface testing can be used directly without needing to be defined again. The interface documentation and interface development and debugging use the same tool, after the interface debugging can ensure that the definition of the interface documentation is completely consistent. Efficient, timely and accurate!

2. Purpose of Apifox

Save every minute of r&d team!

3. Apifox function

  1. Interface design: Apifox Interface documentOpenApi3.0 (formerly Swagger),JSON SchemaSpecification at the same time, provides a very usefulvisualizationDocument management function, zero learning cost, very efficient. It also supports online sharing of interface documents.
  2. The data model: reusable data structures that define interfacesReturn data structureandRequest parameter data structure(only JSON and XML schemas) can be referenced directly. Support model directly nested reference, direct JSON/XML intelligent import, support advanced combination modes such as oneOf and allOf.
  3. Interface debuggingApifox has all of Postman’s features, such as environment variables, pre/post scripts, Cookie/Session global sharing, and is much more efficient than Postman. Click after the interface runsSave as a use caseButton, can be generatedThe interface use cases, you can directly run the interface case without input parameters, which is very convenient. Custom scripts are 100% compatible with Postman syntax and can run javascript, Java, Python, PHP, JS, BeanShell, Go, shell, Ruby, Lua and other languages.
  4. The interface use cases: Usually an interface will have multiple case use cases, such asParameters correctlyUse cases,Parameter errorUse cases,Data is emptyUse cases,Different data statesUse cases and so on. It is very efficient to debug the interface with the interface use case.
  5. Interface data Mock: built-inMock.jsRules engine, which makes it easy to mock out data and write mock rules while defining data structures. Support for adding “expectations” that return different mock data based on request parameters. The most important is ApifoxZero configurationYou can Mock out very human data, as described later in this article.
  6. Database operation: Reads database data as interface request parameters. Support for reading database data to verify (assert) the success of an interface request.
  7. Interface automation testing: Provides interface collection tests that can be quickly created by selecting an interface (or interface use case). At present, more functions of interface automation testing are still under development, please look forward to it! The goal: To have almost all of JMeter’s features and make them better.
  8. Quick debugging: interface debugging mode similar to Postman, mainly used for temporary debuggingNo documentation requiredThe interface can be quickly debugged without defining the interface in advance.
  9. Code generation: Automatically generated by the system according to the interface and data model definitionInterface request code,Front-end business codeandBack-end business code.
  10. Team collaboration: Apifox is born for team collaboration, interface cloud real-time synchronization update, matureTeam/project/member permissionsManagement to meet the needs of various enterprises.

Apifox does more than just get through the data

It would be a mistake to think that Apifox only does data access to improve the efficiency of the r&d team. Apifox has also made a number of innovations to improve developer productivity.

1. Interface support “Use case Management”

Usually an interface will have multiple case use cases, such as correct use case parameters error use case data null use case different data state use case. Use cases of these different states are defined when defining the interface, and run directly when debugging the interface, which is very efficient.

2. “Data Model” definition and reference

Data models can be defined independently, directly referenced in interface definitions, and referred to each other. The same data structure, only need to define once can be used in multiple places; You only need to modify one place and update multiple places in real time to avoid inconsistency.

3, “automatic verification” data structure during debugging

When using the Apifox debugging interface, the system automatically verifies whether the returned data structure is correct according to the definition in the interface documentation. There is no need to visually identify the data structure, and no need to write the assertion script manually. Very efficient!

Apifox automatically validates data structures

4. “Visualize” setting assertions

Set the assertion:

Apifox sets assertions

After running, see the result of the assertion:

5. “Visualize” setting extraction variables

6, support database operations

7. “Zero configuration” Mock out very human data

Here’s how Apifox and other tools mock out data with zero configuration:

Apifox Mock data results compared to similar tools

As you can see, the Apifox zero-configuration Mock is very close to the real data, and front-end development can use it directly without having to write Mock rules manually.

How does Apifox do thatHigh efficiency,Zero configurationGenerate very user-friendly mock data

  1. Apifox automatically generates mock rules based on the data structure and data type in the interface definition.
  2. Apifox has a built-in smart Mock rule library that intelligently optimizes automatically generated mock rules based on field names and field data types. For example, the name contains a stringimagethestringType field, automatically mock out an image address URL; Contain stringtimethestringType field, automatically mock out a time string; Contain stringcitythestringType field that automatically mocks out a city name.
  3. Apifox can automatically recognize fields such as picture, profile picture, username, mobile phone number, URL, date, time, timestamp, email, province, city, address, IP and so on according to built-in rules to Mock out very human data.
  4. In addition to built-in mock rules, users can also customize a library of rules to meet various personalized requirements. Support the use ofRegular expression,The wildcardTo match the field name custom mock rule.

8. Generate online interface documentation

Apifox projects can “share” API documents online, which can be set to public or password-accessible, making it easy to collaborate with external teams.

Experience address: Interface document online sharing – Apifox

9. Automatic code generation

According to the interface model definition, Automatically generate business code (Model, Controller, unit test code, etc.) and interface request code in various languages/frameworks (TypeScript, Java, Go, Swift, ObjectiveC, Kotlin, Dart, C++, C#, Rust, etc.). Apifox supports automatic code generation for 130 languages and frameworks.

More importantly, you can customize code templates to generate code that conforms to your team’s architectural specifications for a variety of individual needs.

10. Import and export

  1. Supports exportOpenApi (Swagger),Markdown,HtmlData format, as can be exportedOpenApiFormat data, so you can take advantage of OpenApi’s (Swagger) rich ecosystem of tools to do all sorts of interface related things.
  2. Support for importingOpenApi (Swagger),Postman,apiDoc,HAR,RAML,RAP2,YApi,Eolinker,NEI,DOClever,ApiPost 、Apizza 、ShowDoc,API Blueprint,I/O Docs,WADL,Google DiscoveryAnd other data formats, convenient old project migration.
  3. supportAutomatic timingThe importOpenApi (Swagger),apiDoc,ApifoxFormat data.

Iii. Follow-up function planning

  1. Release Apifox WEB version, which supports using Apifox on the browser side.
  2. Interface performance testing support (similar to JMeter).
  3. Support plug-in market, you can develop your own plug-ins.
  4. Open the Apifox API, allowing developers to invoke Apifox functionality through the API.
  5. Supports more interface protocols, such asGraphQL,gRPC,websocketAnd so on.
  6. Offline use is supported. The project can be synchronized online (for teamwork) or stored locally (for offline use on a single machine).

4. More Apifox screenshots

Interface debugging

Custom mock rules

Intelligent mock

Interface automation

Import the project

Project export

Multiple themes are optional