Let you know about software development in advance (42): Performance Testing

Source: Internet
Author: User

Part 1 software R & D work summary

Performance Testing

 

Abstr]

For some intermediate modules in the communication field, the main function is to process and send received messages, which serves as a "bridge" between the two modules. Because there are many and few messages, this puts forward requirements on its performance.

This article describes the entire process of Performance Testing Based on the author's practical project experience, and briefly introduces some common problems during the performance testing process.

 

1. Preface

After coding is completed for the new requirements of the project, it is inevitable to test the code to verify the correctness of the function. Generally, it takes more time to test. Through a detailed test of the program you write, developers can find the design and coding deficiencies, and modify the program in a timely manner, reducing the increase in the cost of subsequent modifications.

Some intermediate modules are located between two important modules and act as "Bridges. It processes the received message and sends the processed message. The number of messages is large and small. When the number of messages is large, the intermediate module is required to have high performance and won't be paralyzed because of processing. Therefore, it is necessary to test the performance of the intermediate module to verify its ability to process a large number of messages.

This article describes the entire process of Performance Testing in detail, and briefly introduces some precautions during the testing process.

 

2. Build a performance test environment

2.1 System Structure

Generally, performance tests are required for systems that want to process a large number of messages. Its general system structure 1 is shown in.

Figure 1 Performance Test System Structure

As shown in figure 1, the intermediate Module C needs to interact with modules A and B. First, module A sends a message to the intermediate Module C. Module C assembles the Good News according to the protocol and sends the message to Module B. Module B returns a Response Message to the intermediate Module C after receiving the message, the intermediate Module C then assembles the response message according to the protocol and returns it to module.

It can be seen that the intermediate Module C needs to process different messages. When the message volume is large, it puts forward requirements on its processing performance.

 

2.2 compile a simulation program

As shown in figure 1, to test the performance of intermediate Module C, you need to simulate the functions of module A and Module B.

For ease of operation, you generally write a simulation program on your work PC to complete a simple performance test. If you want to conduct a large-scale performance test, you need the cooperation of dedicated testers and the test environment.

Generally, you can write a visual operation interface to simulate modules A and B, which facilitates message tracking and debugging. Figure 2 of the simulated interface.

Figure 2 simulation interface

As shown in figure 2, the entire operation interface is relatively simple, includes the start test button, exit system button, message category button, send count control box, send interval control box, and display box.

The Start test button is used to control the start of the test.

The exit system button controls the end of the test.

The message category button controls the content of the sent message. After the system is set up, if a function is selected and the start test button is clicked, module A sends the message to the intermediate Module C, and receive messages from intermediate Module C. The sent and received messages are displayed in the display box in the middle.

The send count control box is used to control the number of messages sent, which is the most important embodiment of performance testing. For a type of message, you can gradually increase the value of this item.

The send interval control box controls the message sending interval. This is to facilitate observation of the sending status of each message and can be adjusted according to the actual situation.

The display box is used to display the message execution, facilitating tracking and debugging.

In the simulation module A and Module B programs, the most important thing is to strictly assemble the sent messages according to the Protocol, not only to ensure the correctness of the field content and order, but also to ensure the correctness of the format. To ensure that the sent message is accurate, you can add a configuration file to configure the message.

 

3. Performance testing procedure

The performance testing procedure is no different from the actual testing procedure of the program. Before testing, ensure the normal operation of the system, ensure the correctness of the relevant configuration file content, and ensure the correctness of the test software.

3.1 start the simulation interface

The Interface 3 after the Simulated Program is successfully started is shown in.

Figure 3 interface after the simulation program is successfully started

 

3.2 test a single message

Select a message category and set "Number of sent messages" to 1 to view the message sending and receiving status, as shown in figure 4.

Figure 4 1 message sent successfully

You can use the display box in Figure 4 to verify that the program functions correctly.

 

3.3 conduct performance tests on intermediate Module C

One of the main purposes of writing a simulation program is to test the performance of the intermediate Module C, that is, to continuously send multiple messages to the intermediate Module C and check whether the function is normal.

For example, if you select a type of message and set "Number of sent messages" to 10000, you can see the situation of sending and receiving messages, as shown in Figure 5.

Figure 5 10000 messages sent successfully

In Figure 5, the simulation program keeps sending messages to the intermediate Module C until 10000 messages are sent. After the message is sent, you can check whether the intermediate Module C processes the message normally, that is, whether the performance test has achieved the expected purpose.

Generally, it is necessary to ensure that the intermediate Module C can withstand 100000 or more performance tests. When the performance test of a function is passed, it also tests the performance of other functions involved in the intermediate Module C to ensure its performance robustness.

 

4. FAQs about Performance Testing

Frequently Asked Questions and Answers during performance testing are as follows:

1) Why cannot a simulation program send messages?

A: In this case, it is usually a configuration problem. Before performing a performance test, make sure that the configuration files are correct, the server and client configurations are correct, and the connection port is accurate. The connection fails. This is generally caused by incorrect port numbers.

2) Why is the message sent incorrectly parsed?

A: This is generally because messages are not assembled as required by the Protocol.

3) Why does the program crash when processing a few messages with some functions?

A: there must be a problem with the C program of the intermediate module. The purpose of performance testing is to find such problems. Check against related log files to see where the program crashes. Generally, you can find the problem by checking the corresponding code.

 

5. Summary

This article mainly introduces the entire process of testing the performance of the intermediate Module C, and describes the common problems in the testing process.

The main purpose of performance testing is to ensure the quality of the Code and the quality of the product. After writing the code, developers must fully test the code to reduce the trouble caused by subsequent modifications.


 

 

 

(My microblogging: http://weibo.com/zhouzxi? Topnav = 1 & WVR = 5, No.: 245924426, welcome !)
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.