The leader gives you a project, how to carry out performance testing


The general steps of the first section of the test

The performance test work is based on the system function has been completed or has become complete, it does not make much sense when the function is not complete (the later function will have an impact on the performance of the system, and it will be too early to enter the performance test. Test results are inaccurate and test resources are wasted); therefore, performance testing is based on functional testing first, and you must understand its function implementation in order to carry out performance testing.

Let's break down the instructions step by step:

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

Entrance: how to send the request, how much pressure should be exerted by the pressure party, and what method should be used to exert pressure;

System under test: How does the system respond to a single request, what is the system business process, system network element nodes, data flow, etc., whether there are overall performance requirements, what indicators need to be examined, and how to monitor;

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

OK, doesn't it feel like the functional test is not much worse? Yes, it is to analyze the function flow 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 test steps are as follows:

1) Confirm the test target

2) Analyze the business requirements of the tested system

3) Analyze the system structure of the tested system

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

5) Design test plan, test plan and test case

6) Select the test tool

7) Test 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, the smoother the subsequent test execution. The general test preparation 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 have performance bottlenecks in the system under test

5) Design test plan, test plan and test plan

Let's study it step by step:

Confirm test target

To get a task, you must first confirm the goal of the task. If you don't know the goal, the result of any effort you make may not be the result you need in the end.

Performance testing is the same, it has a goal first. Whether you want to see the current performance of the system in a random test, or rush to optimize the system, or check whether the performance of the system meets the requirements, etc., these are your goals before doing things. . Everything you do later, from analysis to plan and case design, to test execution monitoring, to the final test analysis and report, are all focused on this goal.

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

In some cases, the test task does not have clear goals or requirements, which does not mean that it has no purpose or goals. This requires us to communicate and analyze.

Communication is to reach a consensus with the project team for the purpose and requirements; to analyze, analyze the requirements, analyze the system, and finally to clarify the purpose and requirements of the project or system test task.

Analyze the business of the system under test

Once in an interview, an interviewer gave me such a question: "There is a website, only knows that its total number of visits is 3 million a day, how to test its performance?", everyone think about how to design the plan ?

------It is assumed that the interviewer wants the interviewer to answer, the application of basic test principles such as normal distribution and the twenty-eight principle.

I did not answer anything related to the normal distribution and the 28th principle; I remember that the interviewer’s answer to me seemed to be "contemptuous" with a smile; it may be that "even the basic normal distribution, the 28th principle" I don’t know, but also doing performance testing?". In fact, performance testing is not as simple as imagined. It is not just an application of a simple principle. If it is so easy, wouldn't it be possible for anyone to do it.

The basis of performance testing is that the system-based business functions are basically stable. The first task is to perform performance on the system to meet the needs of business functions. Therefore, we must analyze the business of the system. 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 tests that are separated from business functions are meaningless. Therefore, the primary task of performance testing is to analyze the business functions of the system, and analyze the performance limitations of the system business, that is, the business requirements.

So how to analyze the business requirements of the system?

(1) If there are user requirements specifications, the first task is to read, understand and analyze the user requirements specifications;

(2) If there is no user requirement specification, then it is necessary to analyze the system functions and extract the business requirements of the system. If possible, it is best if someone familiar with the project team tells it.

(3) In the end, no matter which one, the best way is to draw the system's business process or system's functional structure diagram according to your own understanding, and get the project team for confirmation. It must be confirmed and agreed with the entire project team.

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

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

Of course, when faced with a brand-new knowledge field, we may need to accumulate more experience and conduct more analysis; we may need to combine practice, run the system several times or perform tests, and continuously optimize and improve us during the test. The analysis process, analysis results, test plan, test development and even test execution and so on.

Analyzing the business of the system under test is sometimes not done overnight. It requires us to perform repeated analysis, confirmation and re-analysis and re-confirmation until the system is understood. It may even be necessary to analyze again in the final stage of test execution. And confirm, and then re-plan the test.

Analyze the structure of the system under test

The structure of the system is as important as the business of the system. Without knowing the network element structure of the system, there may be no way to monitor, there is no way to know which node the bottleneck is at, and optimization cannot be carried out.

The best way to analyze the structure of the system is for the project team to provide system deployment and composition diagrams; if the project team cannot provide or does not have a project team, then you need 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

(1) tcp: ip icmp arp rarp and options such as tcp, udp, icmp, etc. must be placed in the position of the first parameter to filter the type of datagram

(2)-i eth1: Only capture packets passing through interface eth1

(3)-t: Do not display the timestamp

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

(5)-c 100: Only grab 100 packets

(6)dst port! 22: Do not capture data packets whose destination port is 22

(7)src net 192.168.1.0/24: The source network address of the packet is 192.168.1.0/24

(8)-w ./target.cap: Save it as a cap file for easy analysis with ethereal (ie wireshark)

Analyze where the flow is 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 the institutional levels and nodes of the system's data flow;

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

Test and monitor the application 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 later in the selection of test tools, 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 the structure of the system clearly.

Analyze the possible performance bottlenecks of the system

Analyzing the business requirements of the system and the structure of the system, and predicting the possible performance bottlenecks of the system, this is a goal in the analysis; after getting the predicted performance bottleneck, we need to pay more attention to these nodes when monitoring.

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

(1) Login. Generally, system login requires multiple verifications, and data interaction may be frequent;

(2) When placing orders, grabbing orders and grabbing red envelopes, there will be a certain amount of concurrent demand at this time;

(3) The query, statistics and report analysis of big data will put pressure on the system;

(4) Video, animation, etc. will put pressure on the network;

(5) System function nodes with relatively concentrated messages will put pressure on the system;

(6) Some special business requirements will put pressure on the system;

Common bottlenecks:

(1) The bottleneck of the database is generally due to high disk IOPS causing process blockage

(2) Excessive number of system processes generally consumes system memory space

(3) Message queuing and caching services. After enabling persistence, disk IOPS needs to be examined, and when persistence is not enabled, memory usage needs to be examined

(4) Frequent pipeline opening and destruction will cause high CPU usage

(5) Some program structures cannot use multiple CPUs

and many more! ! !

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, will it cause pressure, and whether our design will produce a performance bottleneck.

Scheme and case design

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

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

The test plan contains all the aspects that you analyze and organize.

A good test plan contains the content: test objectives, content (may include business performance, reliability, stability, etc.), business requirements objectives, system business composition, system node composition, test method flow, and indicator requirements to be monitored And nodes and so on.

Test cases, in fact, generally need to be included in the test plan; test cases are actually ordinary business operation processes. Test tools or other test methods are used to simulate business operations with large amounts of data and monitor each node of the system. Obtain monitoring data. Comparing the expected monitoring data and actual monitoring data, meeting the requirements is the expected requirement, and the actual comparison result is the test result.


Finally: send a wave of software test data!

In the technology industry, you must improve your technical skills and enrich your practical experience in automation projects. This will be very helpful for your career planning in the next few years and the depth of your test technology mastery.

In the interview season of the Golden 9th and the Silver 10th, the season of job-hopping, organizing interview questions has become my habit for many years! The following is my collection and sorting in recent years, the whole is organized around [software testing], the main content includes: python automation test exclusive video, Python automation details, a full set of interview questions and other knowledge content.

May you and I meet and you will find something! If you want to exchange experience in software testing, interface testing, automated testing, and interviews. Follow WeChat public account:[Sad Spicy Strips]Receive a 216-page software test engineer interview book for free. And the corresponding video learning tutorials are free to share! Communication learning skirt:902061117

If the article is helpful to you, please reach out to make a fortune and give me a like. Thank you for your support. Your likes are my motivation for continuous updating.

Recommend good articles:

Packaged as a test engineer with 1 year of work experience, my advice before the interview is as follows

What exactly should I learn in automated testing?

Why not consider Tencent for job-hopping? Let’s talk about the past between me and the goose factory

Which is more advanced, automated testing or manual testing?

Novice must see: How to write a qualified test case?

Python login interface test problem record and solution (dry goods)

Guess you like

Origin blog.csdn.net/weixin_50829653/article/details/114179831