How to improve test efficiency? Summary of ideas and recommendations of multiple tools!

Written in front: In the daily development process, some people do front-end development, and some are responsible for back-end development. The main function of the interface is to connect the front and back. However, the speed of front-end and back-end development may be different, especially when the back-end is developed, but the front-end is not yet developed. Do we need to do interface testing at this time? In our daily work, we mainly test the functional sections. If you want to really understand the interface test, then this article may be able to help you.

1. Why do we do interface testing?

First, let's take a look at the testing pyramid (interface testing is in the middle part, unit testing at the bottom, and interface testing at the top).

From the perspective of the size of the three, unit testing and interface testing are the key points, while interface testing is really too few. You can understand this area as code coverage or the workload of testing. Domestic companies are paying more and more attention to interface testing. In the previous few years, many testing resources were put on interface testing. Looking at the trend, it should gradually be put on interface testing function, performance, automation and stability testing.

2. What is an interface test?

There are too many articles on this, so I won't go into details, just find it in Baidu or forums.

3. Classification of interfaces

Before starting interface testing, it is necessary to understand the classification of interfaces. The classification here is mainly the classification of HTTP request methods. The following are our most common four methods of GET/POST/PUT/DELETE. The most commonly used interfaces in work are GET and POST methods.

4. Design interface test cases

Next, let's talk about the preparations for interface testing. Some students are curious, what is the process of interface testing? Isn't it just holding the interface document and using the interface test tool to test. If there are only three or five interfaces, you can do a temporary interface test. But if there are hundreds of interfaces, or if a new project is doing interface testing for the first time, then it is still necessary to follow the testing process.

1) Interface test process

The interface test is the same as the function test, and the process roughly follows the V model. Please see the figure below.

Generally speaking, for each stage on the left side of interface testing, each company may have a different focus. For example, some companies do not have requirements discussion and requirements review. But no matter what, the use case design is indispensable, and it is the key and the stage that takes time. Only by covering a comprehensive interface test case can we have a better test interface coverage and find more interface bugs.

2) Why write interface test cases

Everyone has written functional test cases. Many people have not written interface test cases. Before writing, let's discuss why we need to write interface use cases. ①Clarify your thinking and avoid missed tests ②Improve test efficiency ③Follow up the test progress ④Tell your leaders to have done ⑤Follow up the above five points of repetitive work, combined with your own test experience, it should be said that it is well understood. Use cases have ideas to avoid missing test points. Following the test cases, on the one hand, it can avoid random tests that are not purposeful tests and improve the test efficiency; on the other hand, it is a lot of convenience for leaders to check your work and colleagues to ask about your progress, and it can also improve docking efficiency. .

3) Interface use case design

When we design interface use cases, we can mainly consider these four aspects: function, logical business, exception, and security. ①Function: whether the function is normal; whether the function is implemented according to the interface document; ②Logic business: whether it depends on the business; ③Exception: parameter abnormality and data abnormality; parameter abnormality: keyword parameter, parameter is empty, more, less parameter, wrong parameter; Abnormal data: keyword data, data is empty, length is inconsistent, and wrong data; ④Security test case design: cookie: data can be obtained only if there is a cookie, if there is no cookie, there is still information returned, indicating that there is a problem. , Delete the header to see if the data can be returned. Unique identification code: App mobile phone identification code, generally unique. Note: The safety test mainly checks from the above three points. The third is the unique identification code, which mainly refers to the identification code of the mobile phone on the app. It is rarely used unless very strict interface tests, such as bank app login, require fingerprints, and the fingerprint source mobile phone generally has a mobile phone identification code Judgment process.

5. Tools for interface testing

Currently, there are many tools on the market that support interface testing. Using tools for interface testing can provide testing efficiency. For example, if you join to allow you to complete 100 interface test tasks a day, do you think you can complete overtime. If there are tools, not all tools can support you to accomplish this task. Let's pick a few tools and briefly introduce them.

1)fiddler

First of all, this is an HTTP protocol debugging proxy tool. To put it bluntly, it is a tool for capturing http packets. This tool can be used for both web testing and mobile testing. Since it is the http protocol, this tool can also support interface testing. In a later article, we will specifically introduce the fiddler tool.

2)postman

This is a plug-in developed by Google engineers, which can be installed on the Chrome browser. It supports different interface test requests, and can manage test suites and automated operations. The weakness is that the automated assertion function is not powerful. Cannot perform continuous integration testing with jenkins and code management library. However, it is definitely a good semi-manual and semi-automated testing tool.

3)wireshak

This is a packet capture tool on a computer that supports capturing various packets, TCP, UDP, and HTTP are all supported. If you do low-level network data testing, you generally need to use it. As an interface test, this software is a bit unfriendly. Because refreshing data is too fast, it is difficult to locate the interface corresponding to each operation. Therefore, we will not introduce this tool too much.

4) soupUI

This is an open source free, enterprise version of the software. In foreign interface testing, it is used very much. This tool can support interface automation testing and interface performance testing, as well as continuous integration testing with jenkins. Just get to know it. You can download a free version of the community and try it out as a demo.

5) Java code for interface testing

Code is omnipotent, and note-taking tools are also developed by code. Why use code for automated interface testing? Because some tools have limited functions, many companies need some specific functions, and the tools do not support them, so they have to use code for development. Generally, Java is used for automated testing, mainly using the httpclient.jar package, and then using unit testing tools such as junit or testng to develop test cases, and then create a job on jenkins for continuous integration testing.

6) Python code for interface testing

Like Java, Python uses a very good and powerful third-party library requests, which can easily create interface automation use cases. The unit test framework under python generally adopts unittest. To generate test reports, generally choose HTMLTestRunner.py. Similarly, you can do continuous integration testing with jenkins.

7)LoadRunner

Don't think that LR can only do performance testing, loadrunner can also do interface automation and interface pressure testing. It's just that many of us don't use LR functions to develop interface test cases.

8)JMeter

Like loadrunner, JMeter is famous for performance testing. Generally, JMeter is also used for interface performance testing. For example, java+Jmeter+ant+jenkins do interface performance monitoring test. You can check how JMeter does interface testing online. Written at the end: The above mentioned so many tools, which basically cover interface function testing, interface automation testing, and interface performance testing. Let me mention here that there is a comprehensive Saas test tool in China. It does not need to be deployed and the interface is relatively simple. It is called Eolinker. I will post the address below. Try it yourself. Use address: www.eolinker.com

Guess you like

Origin blog.csdn.net/qq_40857096/article/details/111926480