How to do interface automation? From tools to frameworks, a full article...


foreword

What does interface automation mainly do

Principles -> Business Logic -> Tools -> Automation Scripts and Frameworks

1. Connectivity
Every time each interface is called, there will be a responsecode, assertEqual(r.status_code, 200), to check whether the interface is connected.

When the interface returns abnormally, it can be expressed by the response status code other than 200, or the code field in the response body json.
Not only understand how to make an interface request, but also know what kind of interface response is the expected value.
2. Correctness
3. Tools

The required tools are generally divided into two categories:
one is request sending and receiving tools, such as postman and jmeter. Of course, jmeter can be used as a simple automation or performance testing tool.

The second is the packet capture tool, which is mainly for auxiliary verification.
As the saying goes, "grab the bag first when in doubt", the golden rule, don't guess blindly, seeing is believing. Tools such as chrome developer tool F12, fiddler, wireshark, tcpdump, etc. If you have tests involving UI at the same time, chrome developer tools are very important and can help you distinguish front-end bugs from back-end bugs.

What is interface testing?

Definition: A test that tests the interfaces between system components. It is mainly used to detect the interaction points between external systems and internal subsystems, focusing on the inspection of data exchange, transmission and control management processes, and mutual logical dependencies between systems, etc.;

Purpose: to test the correctness and stability of the interface;

Principle: Simulate the process that the client sends a request message to the server, the server processes the corresponding message after receiving the request message and returns a response to the client, and the client receives the response;

Focus: Check the data exchange, transfer and control management process, including the number of processing;
core: continuous integration is the core of interface testing;

Advantages: Bring efficient defect monitoring and quality supervision capabilities to highly complex platforms. The more complex the platform, the larger the system, the more obvious the effect of interface testing (improving test efficiency, improving user experience, and reducing R&D costs);

Key points of use case design: Usually, the two outermost interfaces are mainly tested: data entry system interface (calling the parameters of the external system for use by the system) and data outflow system interface (verifying whether the data processed by the system is normal);

PS: When designing use cases, it is also necessary to pay attention to what functions external interfaces provide to external users who use these interfaces, and what functions external users really need;

What skills are needed to do interface testing?

The skills required for interface testing are basically the following:
business flow: understand the business logic interaction between the system and internal components;
data flow: understand the I/O of the interface (input/output: input and output);
protocol: Including http protocol, TCP/IP protocol family
Tools: Tools can assist us to complete the work better and more efficiently.

Commonly used interface testing tools include: jmeter, loadrunner, soapui, postman, Apifox, etc.;

Database knowledge: Whether it is to obtain knowledge from the database, or to confirm the landing of the data, or what operations the interface performs on the data, it needs to be confirmed, so database knowledge (in fact, adding, deleting, modifying, and checking) is very necessary;

Supplement: Several necessary points of the interface document: completeness, consistency, fault tolerance;

Interface automated testing

1. How to carry out?
First, debug a single interface to ensure the correctness and smoothness of a single interface (similar to the benchmark test in performance testing); second
, clarify the data flow and business flow;
finally, string together N interface test scripts and execute them;

The most important point is, don’t think too much and make it too complicated. Do the most basic and simple things first, and you will be more than half successful. As for scalable third-party interfaces, https, scheduled tasks, automatic test reports, automatic emails, etc. and other functions, which are continuously accumulated and optimized,

It’s enough to act. If you think too much, it’s better to act. Let the interface automation test be implemented, which is the first thing we need to consider!

2. What you need to know before starting

How many pages does the current test object contain?
How many interfaces are involved in each page?
In which step are they called?
What fields does each interface contain?
Which table in the database does each field correspond to?
What do the fields in each table mean?
What kind of operation does each interface have on the table?

Interface automation testing framework

automation framework

What is a framework? You can understand it as a complete ring, or as a complete set of environments and platforms for interface test scripts to run, whatever you want;

Generally, an automated testing framework includes the following points:

Data pool: that is, the storage management of test data, generally integrated into a data package, including:

log (log file), report (test report file, generally in xml format), case-data (test data of a single interface, generally in json format), server-data (data in serial connection of interface services, which can be managed by excel)

Script management center: the unified management, storage, and scheduling center of interface test scripts. Commonly used tools include maven, ant, etc., or you can use the functions provided by the unit test framework in the programming language and choose the one that suits you;

Running platform: Generally, these test scripts are run with the help of tools. The tools can use the above-mentioned ones (jemter, loadrunner, soapui, etc.). Similarly, it is important to choose the right one;

Continuous integration tool: the most common one is Jenkins, its function is to monitor the call execution of external programs, schedule or trigger scheduling tasks, test script execution and other functions;

Communication services: dubbo, spring_boot, thrift and other RPC, REST synchronous calling services;

Test result statistics management center: such as testlink, the purpose is to automatically update and upload test results, better statistical test results for later optimization;

The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled

1. From entry to mastery of Python programming

Please add a picture description

2. Interface automation project actual combat

Please add a picture description

3. Actual Combat of Web Automation Project

Please add a picture description

4. Actual Combat of App Automation Project

Please add a picture description

5. Resume of first-tier manufacturers

Please add a picture description

6. Test and develop DevOps system

Please add a picture description

7. Commonly used automated testing tools

Please add a picture description

Eight, JMeter performance test

Please add a picture description

9. Summary (little surprise at the end)

Dreams burn the soul, struggle dispels the darkness, and success belongs to the brave; persistent pursuit, transcending difficulties, brilliance is forged by hard work. Believe in your own strength, keep struggling, write the splendid chapter of life with sweat and wisdom, and bloom your own light and glory.

Burn passion, go forward bravely, struggle is the voyage of dreams; firm belief, go beyond the limit, and draw a brilliant chapter in the struggle. Believe in your own abilities, keep pursuing, and use sweat and wisdom to create your own radiance and shine the light of life.

With passion in mind, without fear of hardships, struggle is the compass for sailing dreams; with unswerving determination, beyond the limit, and write a brilliant life in the struggle. Believe in your talents and pursue great careers.

Guess you like

Origin blog.csdn.net/csdnchengxi/article/details/132043689
Recommended