As a software development practitioner, API debugging is an essential skill, and Postman does an excellent job in this regard. However, in the entire software development process, API debugging is only part of it. There are many things that Postman cannot complete or cannot complete efficiently, such as: API document definition, API Mock, API automated testing, etc. Apifox was born to solve this problem.
1. Use Swagger to manage API documents
2. Postman debug API using tools such as MockJs
3. Mock API data usage
4. JMeter for API automated testing
It is very difficult to maintain data consistency between different tools Difficult and inefficient. And here is not just a problem of workload, the bigger problem is the inconsistency of data between multiple systems, resulting in inefficient collaboration, frequent problems, and miserable development and testers.
After developers define the document in Swagger, they need to go to Postman to define it again when debugging the interface. When developing Mock data on the front end, you need to define it again in MockJs, and you also need to manually set Mock rules. Testers need to go to JMeter and define it again. The front-end was developed based on the data from MockJs Mock, and the back-end was developed based on the interface document defined by Swagger. Both of them passed the test. I thought it could go online immediately. As a result, various problems were discovered during the connection: the interface was changed during the development process. Swagger was modified, but MockJs was not modified simultaneously in time. The interface data types and documents developed by the back-end are inconsistent, making it difficult to detect problems with the naked eye. Similarly, test cases written in JMeter will also find various inconsistencies when they are actually run. As time goes by, various inconsistencies will become more and more serious.
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.
Solve the problem of data synchronization between multiple systems through one system and one data. As long as the interface document is defined, interface debugging, data mocking, and interface testing can be used directly without defining it again. The same tool is used for interface document and interface development and debugging. After interface debugging is completed, it can be guaranteed to be completely consistent with the interface document definition. Efficient, timely and accurate!
2. Apifox’s purpose
Save every minute of the R&D team!
3. Apifox function
Interface design: The Apifox interface document follows the OpenApi 3.0 (formerly Swagger) and JSON Schema specifications, while also providing a very easy-to-use visual document management function with zero learning cost and very efficient. And supports sharing interface documents online. Data model: A reusable data structure that can be directly referenced when defining the interface return data structure and request parameter data structure (only JSON and XML modes). Supports direct nested reference of models, direct JSON/XML intelligent import, and supports advanced combination modes such as oneOf and allOf. Interface debugging: Apifox has functions that Postman has, such as environment variables, pre/post scripts, Cookie/Session global sharing, etc., and is more efficient and easier to use than Postman. After running the interface, click the Save as Use Case button to generate the interface use case. You can run the interface use case directly without entering parameters, which is very convenient. Custom scripts are 100% compatible with Postman syntax and support running javascript, java, python, php, js, BeanShell, go, shell, ruby, lua and other language codes. Interface use cases: Usually an interface will have multiple use cases, such as correct parameter use cases, wrong parameter use cases, empty data use cases, different data status use cases, etc. When running the interface use case, the data correctness will be automatically verified. It is very efficient to use the interface use case to debug the interface. Interface data Mock: The built-in Mock.js rule engine is very convenient for mocking out various data, and you can write mock rules while defining the data structure. Supports adding "expectations" to return different mock data based on request parameters. The most important thing is that Apifox can mock out very user-friendly data with zero configuration, which will be introduced later in this article. Database operation: Supports reading database data and using it as interface request parameters. Supports reading database data to verify (assert) whether the interface request is successful. Interface automated testing: Provides interface collection testing, and you can quickly create a test set by selecting an interface (or interface use case). Currently, more functions for interface automation testing are still under development, so stay tuned! The goal is: JMeter will basically have all the functions and be more usable. Quick debugging: An interface debugging method similar to Postman. Its main purpose is to temporarily debug some interfaces that do not require documentation. It can be quickly debugged without defining the interface in advance. Code generation: Based on the definition of the interface and data model, the system automatically generates the interface request code, front-end business code and back-end business code. Team collaboration: Apifox was born for team collaboration. The interface is updated synchronously in the cloud in real time, and mature team/project/member rights management meets the needs of all types of enterprises.
If you think that Apifox only does data integration to improve the efficiency of the R&D team, you are wrong. Apifox has also made many innovations to improve developer efficiency.
1. The interface supports "use case management"
Usually an interface will have multiple use cases, such as correct use case parameters, incorrect use case data, empty use cases, different data status use cases . Define these use cases for different states when defining the interface, and run them directly when debugging the interface, which is very efficient.
2. "Data model" definition and reference
The data model can be defined independently, the data model can be directly referenced when the interface is defined, and the data models can also reference each other. . The same data structure only needs to be defined once and used in multiple places; when modifying, you only need to modify one place, and multiple places will be updated in real time to avoid inconsistencies.
3. "Automatic verification" data structure during debugging
When using the Apifox debugging interface, the system will automatically verify the returned data according to the definition in the interface document. There is no need to visually identify whether the data structure is correct or to manually write assertion scripts to check. It is very efficient!
Apifox automatically verifies the data structure
4. "Visual" setting assertion
Set assertion:
Apifox sets assertions
After running, view the assertion results:
5. "Visual" settings to extract variables
6. Support database operations
7. "Zero configuration" Mock produces very user-friendly data
First put a picture to compare the data effect of zero-configuration mock between Apifox and other similar tools:
Apifox Mock data result compared with similar tools
Yes It can be seen that the data generated by Apifox's zero-configuration Mock is very close to the real situation. Front-end development can use it directly without having to manually write mock rules.
How does Apifox achieve high efficiency and zero configuration to generate very user-friendly mock data
Apifox automatically generates mock rules based on the data structure and data type in the interface definition. Apifox has a built-in intelligent mock rule library that intelligently optimizes automatically generated mock rules based on field names and field data types. For example: a string type field whose name contains the string image will automatically mock out an image address URL; a string type field containing the string time will automatically mock out a time string; a string type field containing the string city will automatically mock out a City name. Based on built-in rules, Apifox can automatically identify fields such as pictures, avatars, usernames, mobile phone numbers, website addresses, dates, times, timestamps, email addresses, provinces, cities, addresses, IPs, etc., thereby mocking out very user-friendly data. In addition to the built-in mock rules, users can also customize the rule library to meet various personalized needs. Supports the use of regular expressions and wildcards to match field names with custom mock rules.
8. Generate online interface documents
The Apifox project can "share" API documents online. The shared API documents can be set to public or require password access, which is very convenient. Collaborate with external teams.
Experience address: https://www.apifox.cn/apidoc/shared-ce387612-cfdb-478a-b604-b96d1dbc511b/http/5041285
9. Automatic code generation
According to the interface model definition, various languages/frameworks (such as TypeScript, Java, Go, Swift, ObjectiveC, Kotlin, Dart, C, C#, Rust, etc.) business code (such as Model, Controller, unit test code, etc.) and interface request code. Apifox currently supports automatic code generation for 130 languages and frameworks.
More importantly: you can use customized code templates to generate code that conforms to your team's architectural specifications to meet various personalized needs.
10. Import and Export
Supports exporting OpenApi (Swagger), Markdown, Html and other data formats. Because OpenApi format data can be exported, you can use OpenApi ( Swagger) has rich ecological tools to complete various interface-related things. Supports importing OpenApi (Swagger), Postman, apiDoc, HAR, RAML, RAP2, YApi, Eolinker, NEI, DOClever, ApiPost, Apizza, ShowDoc, API Blueprint, I/O Docs, WADL, Google Discovery and other data formats to facilitate old projects migrate. Supports scheduled automatic import of OpenApi (Swagger), apiDoc, and Apifox format data.
Release the WEB version of Apifox to support the use of Apifox on the browser side. Interface performance testing support (similar to JMeter). Supports the plug-in market, you can develop your own plug-ins. Open the Apifox API, allowing developers to call Apifox functions through the API. Supports more interface protocols, such as GraphQL, gRPC, websocket, etc. Supports offline use. Projects can be synchronized online (for team collaboration) or only stored locally (for offline use on a single machine).
Interface debugging
##Custom mock rules Intelligent mockInterface automation
Project importProject export
Multiple themes optional 5. Apifox download addressIntroduces so many practical functions of Apifox, it is a real benefit to use it! The software is completely free and can be called the conscience of China. Friends who are interested and need it can directly copy the link below, paste it into the browser and open it to download, or click to read the original text directly! Official website address: