8 years of test engineer sharing, how do I carry out performance testing (basic articles)

General steps of the first test

The work of performance testing is based on the fact that the system functions are complete or tend to be complete, and it does not make much sense if the functions are not complete (later function improvement will affect the performance of the system, and entering the performance test too early will Inaccurate test results and waste of test resources); therefore, performance testing is first based on functional testing, and you must understand its functional implementation before performing performance testing.

Let's break it down step by step:

A system under test comes, we need to analyze it in three parts

  • Entrance: how to send the request, how much pressure should be applied by the pressurer, and what method should be used to exert pressure;

  • System under test: how the system responds to a single request, what is the system business process, system network element nodes, data flow direction, etc., whether there are overall performance requirements, which indicators need to be investigated, and how to monitor;

  • Export: What are the received data, how to obtain and compare;

OK, doesn't it feel like a functional test? Yes, it is to first analyze the functional process of a single user and the structure diagram of the data flow of the system (including the data flow in the background), and then consider a large number of user operations.

Then the general system performance testing steps are as follows:

1) Confirm the test target

2) Analyze the business requirements of the system under test

3) Analyze the system structure of the system under test

4) Analyze the performance test points of the system under test

5) Design test plan, detection plan and test case

6) Select test tool

7) Test script development

8) Test execution

9) Analysis of test results

10) Test tuning, test verification, test analysis

11) Test report

Section 2 test preparation

The more adequate the test preparation work, the smoother the later test execution will be. The general test preparation work is as follows:

1) Confirm the test target

2) Analyze the business of the system under test

3) Analyze the structure of the system under test

4) Analyze the nodes that may cause performance bottlenecks in the system under test

5) Design test plan, detection plan and test plan

Let's study it step by step:

1. Confirm the test target

To get any task, you must first confirm what the goal of the task is. If you don't know your goals, any effort you make may end up not being what you want.

The same is true for performance testing, which first has a goal. Whether you are doing a random test to see the current performance of the system, or you are running to optimize the system, or check whether the performance of the system meets the requirements, etc., these are your goals before doing anything .

Everything you do later, from analysis to scheme and case design, to test execution monitoring, to final test analysis and reporting, is all about this goal.

Therefore, the first task is to confirm the target requirements of the test, and what kind of test purpose and goals need to be achieved.

There are some test tasks without clear goals or requirements, which does not mean that they have no purpose and goal, which requires us to communicate and analyze.

Communication is to reach an agreement with the project team on the purpose of requirements; analysis, analysis of requirements, analysis of the system, and finally to clarify the purpose and requirements of the project or system testing tasks.

2. Analyze the business of the system under test

Once in an interview, an interviewer gave me such a question: "There is a website. I only know that its total visits are 3 million a day. How to test its performance?" Everyone think about how to design a plan ?

------Guess that the interviewer wants the interviewer to answer, the application of basic testing principles such as normal distribution and 28th principle.

I didn't answer anything related to the normal distribution and the 28th principle at the time; I remember that the interviewer smiled at my answer as "contemptuous"; it may be that "even the basic normal distribution, 28th principle I don’t even know, are you still doing performance testing?”.

In fact, performance testing is not as simple as imagined, and it is not enough to apply a simple principle. If it is so easy, then anyone can do it.

The basis of performance testing is that the business functions of the system tend to be basically stable. The first task is to develop the performance when the system meets the business function requirements. Therefore, we must analyze the business of the system.

No matter whether it is an ordinary website or a more professional system, it all has business function requirements. All performance tests must be based on these functions. Performance testing without business functions is meaningless.

Performance testing So the first task is to analyze the business functions of the system and analyze the performance limitations of the system business, that is, business requirements.

现在我也找了很多测试的朋友,做了一个分享技术的交流群,共享了很多我们收集的技术文档和视频教程。
如果你不想再体验自学时找不到资源,没人解答问题,坚持几天便放弃的感受
可以加入我们一起交流。而且还有很多在自动化,性能,安全,测试开发等等方面有一定建树的技术大牛
分享他们的经验,还会分享很多直播讲座和技术沙龙
可以免费学习!划重点!开源的!!!
qq群号:110685036

 

So how to analyze the business requirements of the system?

  • If there is a user requirement specification, the first task is to read, understand and analyze the user requirement specification;

  • If there is no user requirements specification, then it is necessary to analyze the system functions and extract the business requirements of the system. If possible, it is best for someone familiar with the project team to tell the story.

  • In the end, no matter which one is the best way is to draw the business process of the system or the functional structure diagram of the system according to your own understanding, and get it to the project team for confirmation. Be sure to confirm and reach a consensus with the entire project team.

Some people will say, what should we do when we are free to test and there is no project team to confirm?

Still the same, we need to start with analysis. If you don’t analyze it, you won’t know the functional data flow direction of the system, the requested data composition, the network element structure of the system, and which node the system may have a bottleneck in. How can you optimize it?

Of course, when faced with a new field of knowledge, we may need to accumulate more experience and conduct more analysis; we may need to combine practice, actually run the system or perform tests many times, and continuously optimize and improve our knowledge in the test. The analysis process, analysis results, test plan, test development and even test execution.

Analyzing the business of the system under test is sometimes not done overnight. We need to conduct repeated analysis, confirmation, reanalysis, and reconfirmation until the system is understood, and you may even need to analyze it again in the final stage of test execution. and confirm, then reschedule the test.

3. Analyze the structure of the system under test

The structure of the system is as important as the business of the system. If you do not know the network element structure of the system, you may not be able to monitor it, and you will not be able to know which node the bottleneck is, and you will not be able to optimize it.

The best way to analyze the system structure is for the project team to provide the system deployment and composition diagram ; if the project team cannot provide or does not have a project team, then it is necessary to use packet capture tools such as TCPDUMP to analyze the data flow.

Use of TCPDUMP:

tcpdump tcp -i eth1 -t -s 0 -c 100 and dst port ! 22 and src net 192.168.1.0/24 -w ./target.cap

  • tcp: ip icmp arp rarp and tcp, udp, icmp and other options should be placed in the position of the first parameter to filter the type of datagram

  • -i eth1 : Only capture packets passing through interface eth1

  • -t : do not display timestamp

  • -s 0 : The default capture length is 68 bytes when capturing packets. After adding -S 0, the complete data packet can be captured

  • -c 100 : only capture 100 packets

  • dst port ! 22 : Do not capture packets with destination port 22

  • src net 192.168.1.0/24 : The source network address of the packet is 192.168.1.0/24

  • -w ./target.cap : Save it as a cap file, which is convenient to analyze with ethereal (ie wireshark)

Analyze where the flow is going from the first node, and determine the node of the second layer;

Then analyze the nodes of the third layer from each node of the second layer, analyze layer by layer, and improve all institutional layers and nodes of the data flow of the system;

Then figure out the application or process queue deployed by each node;

Test and monitor the application program or process queue of each node;

Finally, it can be concluded which applications or process queues need to be optimized.

In addition to understanding the node composition of the system, you also need to understand the communication protocol and data format between each node. You need to understand these in the following test tool selection, test data preparation, and test script development.

The basis of all this is to analyze and understand all the nodes of the system, that is, to analyze and understand the structure of the system.

4. Analyze the possible performance bottlenecks of the system

Analyzing the business requirements of the system and the structural composition of the system, while predicting the possible performance bottlenecks of the system, is one of the goals of the analysis; after obtaining the predicted performance bottlenecks, we need to pay more attention to these nodes when monitoring later.

Of course, there are some common nodes that may be system bottlenecks that we need to pay attention to:

  • Log in. Generally, system login requires multiple verifications, and data interaction may be frequent;

  • There will be a certain amount of concurrent demand at this time when placing an order, grabbing an order, and grabbing a red envelope;

  • Big data query, statistics and report analysis will put pressure on the system;

  • Videos, animations, etc. will put pressure on the network;

  • System function nodes with relatively concentrated messages will put pressure on the system;

  • Some special business requirements will put pressure on the system;

Common bottlenecks:

  • The bottleneck of the database is generally caused by the process blocking caused by the high disk IOPS

  • Too many system processes generally consume system memory space

  • For message queue and cache service, you need to examine disk IOPS after enabling persistence, and you need to examine memory usage if persistence is not enabled

  • Frequent pipeline opening and destruction will lead to high CPU usage

  • Some programs cannot take advantage of multiple CPUs structurally

In the process of analyzing the business and system structure, we need to consider whether this business point or structure point will have a large amount of data access, whether there will be pressure, and whether our design will cause a performance bottleneck.

5. Scheme and case design

The formation of the test plan and the final test plan document is actually a summary of all the analysis work above.

The process of writing your test plan is a summary of the process of clarifying the purpose of the test, analyzing business requirements, system structure, and evaluating test methods, test arrangements, and test risks. And these all come from your analysis before test execution, and sometimes you may need to make some analysis and adjustments during the test process.

A test scenario encompasses these aspects that you analyze and organize.

A good test plan includes:

Test purpose, content (may include business performance, reliability, stability, etc.), business requirement goals, system business composition, system node composition, test method flow, indicator requirements and nodes to be monitored, etc.

Test cases, in fact, generally need to be included in the test plan; test cases, in fact, are ordinary business operation processes, use test tools or other test methods to simulate large data volume business operations, and monitor each node of the system, Get monitoring data.

The comparison between the expected monitoring data and the actual monitoring data, meeting the requirements is the expected requirement, and the actual comparison result is the test result.

If the article is helpful to you, remember to like, bookmark, and add attention. I will share some dry goods from time to time...

END Supporting Learning Resources Sharing

Finally:  In order to give back to the die-hard fans, I have compiled a complete software testing video learning tutorial for you. If you need it, you can get it for free 【保证100%免费】

Software Testing Interview Documentation

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.

è¿éæå¥å¾çæè¿°

How to obtain the full set of information:

è¿éæå¥å¾çæè¿°

Guess you like

Origin blog.csdn.net/IT_LanTian/article/details/131248820