As an open software developer, interface debugging is an essential skill. We often use Postman tool for interface debugging, and Postman does a very good job in interface debugging. But interface debugging is only part of the overall software development process, and there are many things Postman can’t do, or can’t do efficiently: interface documentation definitions, Mock data, interface automation testing, and so on.
Interface Management Status
I. Common solutions
- Use Swagger to manage interface documents
- Use the Postman debugging interface
- Use RAP Mock data
- Use JMeter to automate interface testing
Second, existing problems
Maintaining data consistency across different tools is difficult and inefficient. And it’s not just the workload, it’s the inconsistency of data across multiple systems that leads to inefficient collaboration, frequent failures, and developer misery.
- After Swagger has defined the document, developers need to go to Postman to define it again during interface debugging.
- The front-end Mock data development needs to RAP again to define Mock rules manually.
- Testers need to go to JMeter to define it.
- The front-end was developed according to the data derived from RAP Mock, and the back-end was developed according to the interface document defined by Swagger. They passed their respective tests and thought they could be launched immediately. However, various problems were found in the first connection: in the original development process, the interface was changed and only Swagger was modified, but RAP was not timely synchronized.
- Similarly, the tests found various inconsistencies when JMeter’s written test cases were actually run.
- Over time, the inconsistencies get worse and worse.
Apifox solution
First, how to solve these problems
1. Apifox positioning
Apifox = Postman + Swagger + Mock + JMeter
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. Apifox function
- Apifox complies with OpenApi 3.0 (original Swagger), JSON Schema specifications at the same time, provides a very easy to use visual document management function, zero learning cost, very efficient.
- Interface debugging: All Postman features, such as environment variables, pre-executed scripts, post-executed scripts, Cookie/Session global sharing, are available in Apifox and are just as efficient as Postman.
- 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 Apifox
Zero configuration
You can Mock out very human data, as described later in this article. - 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.
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, “automatic verification” data structure during debugging
When using the Apifox debugging interface, the system will automatically verify whether the returned data structure is correct according to the definition in the interface documentation. No need to go through the flesh identification, and no need to write manual assertion script detection. Very efficient!
2. 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.
3. “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.
4. “Zero configuration” Mock out very human data
Here’s how Apifox and other tools mock out data with zero configuration:
Apifox Zero configuration Mock data: ↑
Data generated by zero-configuration mocks from other 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 Apifox can efficiently generate mock data with zero configuration:
- Apifox automatically generates mock rules based on the data structure and data type in the interface definition.
- 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 string
image
thestring
Type field, automatically mock out an image address URL; Contain stringtime
thestring
Type field, automatically mock out a time string; Contain stringcity
thestring
Type field that automatically mocks out a city name. - 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.
- In addition to built-in mock rules, users can also customize a library of rules to meet various personalized requirements. Support the use of
Regular expression
,The wildcard
To match the field name custom mock rule.
5. 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.
6. Import and export
- Supports export
OpenApi (original Swagger)
,Markdown
,Html
Data format, as can be exportedOpenApi
Format data, so you can take advantage of OpenApi’s (Swagger) rich ecosystem of tools to do all sorts of interface related things. - Support for importing
OpenApi (original Swagger)
,Postman
,HAR
,RAML
,RAP2
,YApi
,Eolinker
,DOClever
,ApiPost
、Apizza
、API Blueprint
,I/O Docs
,WADL
,Google Discovery
And other data formats, convenient old project migration.
3. More Apifox screenshots
4. Apifox internal test group
Add fox brother wechat, pull you into wechat group ↑
Scan code directly to join QQ group ↑
5. Apifox official website address
For more information, please visit Apifox website: www.apifox.cn/