laitimes

Apifox, the interface test weapon, why become a new rich and handsome?

author:CoCo's software testing stack
Apifox, the interface test weapon, why become a new rich and handsome?
Apifox, the interface test weapon, why become a new rich and handsome?

Click on the avatar above to follow me, push it on time every morning at 09:00, and give away technical books from time to time every month.

This article is 4231 words and takes about 11 minutes to read

Hi, hello everyone. API debugging is an essential skill, and Postman does a great job of that. But API debugging is only part of it, there are many things Postman can not complete, or can not be done efficiently, such as: API document definition, API Mock, API automation testing, etc., Apifox is to solve this problem and born, today to introduce you to Apifox, the new rich and handsome.

One

The current state of interface management

Common solutions

1. Manage API documentation using Swagger;

2. Use Postman to debug the API;

3. Use MockJs and other tools to mock API data;

4. Use JMeter for API automation testing.

existential problems

Maintaining data consistency between different tools is difficult and inefficient. And it's not just a matter of workload, it's not just a matter of workload, the bigger problem is that the data is inconsistent between multiple systems, resulting in inefficient collaboration, frequent problems, and pain for development and testers.

1. After the developer defines the documentation in Swagger, the interface needs to be defined again in Postman when debugging.

2. When developing Mock data on the front end, you need to define MockJs again, and you also need to manually set The Mock rules.

3. The tester needs to go to JMeter and define it again.

4. The front end is developed according to the data from MockJs Mock, the back end is developed according to the interface document defined by Swagger, each of them has tried to pass, I thought I could go online immediately, and the result was a docking that found various problems: during the development process, the interface was changed, only Swagger was modified, but the MockJs was not modified synchronously in time; The interface data types and documentation developed by the backend are inconsistent, and it is difficult to find problems with the naked eye.

5. Similarly, testing test cases written in JMeter will find inconsistencies when they are actually running.

Two

Apifox was born

Apifox introduction

(1) Apifox positioning

APIFOX = Postman + Swagger + Mock + JMeter, Apifox is an all-in-one collaboration platform for API documentation, API debugging, API Mock, and API automation testing. Solve the data synchronization problem between multiple systems through one system and one piece of data. As long as the interface document is defined, interface debugging, data mock, and interface testing can be used directly without re-definition; Interface documentation and interface development and debugging use the same tool, and the interface document definition can be guaranteed to be completely consistent after the interface debugging is complete.

(2) Apifox basic functions

1. Interface design: Apifox interface documentation follows openApi3.0 (former swagger), JSON Schema specification at the same time, provides a very easy to use visual document management function, zero learning cost, very efficient. And support online sharing of interface documents.

2. Data model: Reusable data structure, which can be directly referenced when the definition interface returns the data structure and request parameter data structure (JSON and XML schemas only). Supports direct nested references to models, direct JSON/XML intelligent import, and supports advanced combination patterns such as oneOf and allOf.

3. Interface debugging: Postman has functions, such as environment variables, pre/post scripts, cookie/Session global sharing and other functions, Apifox has, and is more efficient and easy to use than Postman. After the interface is run, click the Save as Use Case button to generate an interface use case, and then you can directly run the interface use case 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, and other language code.

4. Interface use cases: Usually an interface will have a variety of situation use cases, such as parameter correct use cases, parameter error use cases, data empty use cases, different data state use cases, and so on. Data correctness is automatically verified when running an interface use case, and debugging an interface with an interface use case is very efficient.

5. Interface data Mock: Built-in Mock .js rule engine, which is very convenient for mocking out various data, and can write mock rules while defining data structures. Support for adding "expectations" to return different mock data based on request parameters. The most important thing is that Apifox zero configuration can mock out very user-friendly data, which is described later in this article.

6. Database operation: Support reading database data and using it as an interface request parameter. Supports reading database data to verify (assert) whether an interface request is successful.

7. Interface automation test: Provide interface set test, you can quickly create a test set by selecting an interface (or interface use case). At present, more functions of interface automation testing are still in development, so stay tuned! The goal is that JMeter has basically all the functions and needs to be better used.

8. Quick debugging: Similar to Postman's interface debugging mode, the main purpose is to temporarily debug some interfaces that do not need documentation, and you can quickly debug without defining the interface in advance.

9. Code generation: According to the definition of interface and data data model, the system automatically generates interface request code, front-end business code and back-end business code.

10. Team collaboration: Apifox is born for team collaboration, the interface cloud real-time synchronous update, mature team/project/member permission management, to meet the needs of various types of enterprises.

Apifox, the interface test weapon, why become a new rich and handsome?

(3) Apifox more features

If you think Apifox only does data to improve the efficiency of the R&D team. In addition, Apifox has also made a lot of innovations to improve work efficiency.

1. Interface supports "use case management"

Usually an interface will have multiple use cases, such as correct use cases Parameter error use cases Data is empty Use Cases Different data state use cases. When defining the interface, define the use cases of these different states, and run directly when the interface is debugged, which is very efficient.

2. "Data Model" definition and reference

The data model can be defined independently, the interface can be defined directly to refer to the data model, and the data models can also be referenced to each other. The same data structure, only need to be defined once can be used in multiple places; When modifying, you only need to modify one place, and update multiple places in real time to avoid inconsistencies.

3. "Automatically verify" the data structure during debugging

When using Apifox debugging interfaces, the system will automatically verify whether the returned data structure is correct according to the definition in the interface document, without the need to identify with the naked eye, nor do you need to manually write the assertion script to detect, which is very efficient!

Apifox, the interface test weapon, why become a new rich and handsome?

Apifox automatically validates data structures

4. "Visualization" setting assertion

To set the assertion:

Apifox, the interface test weapon, why become a new rich and handsome?

Apifox sets the assertion

After running, review the assertion results:

Apifox, the interface test weapon, why become a new rich and handsome?

5. "Visualize" settings extract variables

Apifox, the interface test weapon, why become a new rich and handsome?

6. Support database operation

Apifox, the interface test weapon, why become a new rich and handsome?

7, "zero configuration" mock out of very user-friendly data

First, put a graph to compare the data effect of Apifox and other similar tools from the zero configuration mock:

Apifox, the interface test weapon, why become a new rich and handsome?

Apifox Mock data results compared to similar tools

It can be seen that the data from the Apifox zero configuration mock is very close to the real situation, and the front-end developer can use it directly without having to manually write mock rules.

How does Apifox produce very user-friendly mock data with high efficiency and zero configuration?

  • 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 base that intelligently optimizes automatically generated mock rules based on field names and field data types. For example, the name contains the string image of the string, automatically mock out a picture address URL; Contains a string time string type field, automatically mocking out a time string; A string type field containing the string city, automatically mocking out a city name.
  • Apifox automatically identifies fields such as pictures, avatars, usernames, mobile phone numbers, URLs, dates, times, timestamps, mailboxes, provinces, cities, addresses, IP, etc. according to built-in rules, thus mocking out very user-friendly data.
  • In addition to built-in mock rules, users can also customize the rule base to meet various personalized needs. Supports the use of regular expressions and wildcards to match custom mock rules for field names.

8. Generate online interface documents

Apifox projects can "share" API documents online, and the shared API documents can be set up to be public or require password access, making it easy to collaborate with external teams.

Experience address: https://www.apifox.cn/apidoc/shared-8304af11-c8dc-4419-9530-555ca8eb843a/api-10693596

Apifox, the interface test weapon, why become a new rich and handsome?

9. The code is automatically generated

Business code (e.g., Model, Controller, unit test code, etc.) and interface request code for various languages/frameworks (e.g. TypeScript, Java, Go, Swift, ObjectiveC, Kotlin, Dart, C++, C#, Rust, etc.) are automatically generated based on the interface model definition. Apifox currently supports automatic code generation for 130 languages and frameworks. What's more, you can customize code templates to generate code that conforms to your team's architectural specifications to meet a variety of personalized needs.

10. Import and export

Support for exporting OpenApi (Swagger), Markdown, Html and other data formats, because you can export OpenApi format data, so you can use OpenApi (Swagger) rich ecological tools to complete various interface-related things. Supports the import of OpenApi (Swagger), Postman, HAR, RAML, RAP2, YApi, Eolinker, NEI, DOClever, ApiPost, Apizza, ShowDoc, API Blueprint, I/O Docs, WADL, Google Discovery and other data formats to facilitate the migration of old projects.

Three

brief summary

Overall, Apifox can become a new rich and handsome, not only high value, powerful, but also for the interface development, debugging, testing to provide a better efficiency solution, according to the Apifox development team follow-up planning, follow-up will be added interface performance testing capabilities support (similar to JMeter), support for offline team multi-person collaboration and other features.

More practical features, partners can explore on their own, the next article will officially understand Apifox this rich handsome, stay tuned. If you find it useful, click a good look or circle of friends to forward and share.

More series of articles

Stay tuned

I am CoCo, major in computer science and technology, deep drift factory Internet migrant worker (female), coordinates Shenzhen. 5 years of work experience, 3 years of continuous output of technical literature. ITester software test stack (ID: ITestingA) master, Boss directly hired Haowen community contracted authors, Tencent cloud community quality creators. Focus on software testing technology and treasure dry goods sharing, update original technical articles on time every week, and give away technical books every month, may we meet in higher places. Like to remember the star me ⭐, get the latest push every week, third-party reprint please indicate the source.

Apifox, the interface test weapon, why become a new rich and handsome?
Apifox, the interface test weapon, why become a new rich and handsome?

Want to get more of the latest dry content

Come to the stars and pinned to follow me

True Love Four-In-a-Row, BiuBiuBiu~