Overall test under Web
With the increasing popularity of the Internet, there is now more and more large applications of B / S structures, how to test these applications become increasingly urgent issues. There are many testers to believe how I have testing my B / S. Due to the busy work, the problem proposed to everyone is a headache medicine head pain doctor foot, and there is no overall overview of the testing process of the Web. I hope that through this article can let everyone know how large web applications are tested.
The functional test under B / S is relatively simple, and the key is how to perform performance test. At present, most testers think that as long as I run some test tools, my product can be achieved, it is OK. In order to prove that the test is no value, the key is to discover the defects, positioning problems, and solve the problem of product performance. Question, this is the test to do.
First, we analyze how Web tests from two aspects. From technology implementation, general B / S structures, whether .net or J2EE is a multi-layer framework, a interface layer, a business logic layer, and a data layer. From the process of testing, the first is to find problems, analyze problems, positioning problems, and then solve the problem by developers. So how to test the structure of B / S?
How to find problems is what I need to introduce, you need some information before doing a web test, such as product function manual, performance demand instructions, not necessarily perfect, but must have, clear test goals, this is basic common sense, but I often see that I have already started to measure, but I don't know what the performance indicators you have to achieve. Here I briefly tell the performance indicators of the test:
l General metrics (referring to the web application server, the database server required test item):
* Processortime: Refers to the server CPU usage, and the service is approaching saturation when the average is only 70%;
* Memory Available MByte: The number of memory is available. If the memory is found when the memory is changed, it should be noted that if it is a memory leak;
* PhysicsDisk Time: Physical disk read and write time;
l Web server indicator:
* AVG RPS: Average average response per second = total request time / second;
* AVG TIME TO LAST BYTE PER TERSTION: The average number of iterations of the business corner per second, some people will confuse the two;
* Successful rounds: successful request;
* Failed rounds: failed request;
* Successful Hits: Successful click;
* Failed Hits: Clicked Clicks;
* Hits Per Second: Click on the number per second;
* Successful Hits Per Second: Clicked Clicks per second;
* Failed Hits Per Second: The number of clicks fails per second;
* Attempted Connections: Try the number of links;
l Database server indicator:
* User 0 Connections: User connection number, that is, the number of connections for the database;
* Number of deadlocks: Database dead lock;
* Butter Cache Hit: The hit of database cache;
The above indicators are only some universal indicators, and the role of brick introduction, you must also make the corresponding adjustments for different applications, such as the program use .NET technology, you must add some targeted test indicators. For more details on these indicators, you can refer to the help of the Systemmonitor under Windows and the help of LoadRunner, ACT. For findings, the settings of the indicators are very important, it will help you qualify some errors. For qualitative pressure test I don't do too much analysis, there are many tools, and the popular main has loadrunner, ACT, WAS, Webload, and all tools have its range of use, where I think LoadRunner is most comprehensive, it provides a variety of Support for the agreement, the complex pressure test can be competent, WAS and ACT are better for Microsoft's technical support, where WAS supports distributed chart, ACT is better than .NET integration, support viewState (.NET The test of the control cache supports, when I used, other test tools did not support, should now be supported, huh, huh. At this stage, you have to change the test target of your constant follow-up factor. Because the system is too large, we have to divide a number of subsystems, and the performance goals of each subsystem must be clear, mainly concurrent indicator set a threshold. At the same time, it is set to analyze some of the system-related test parameters, application servers, and database servers, and analyze the subsystems that do not meet the thresholds with some general parameters. For example, it does not have your requirements, proof the subsystem performance is problem, or the database user is too high, the program does not release the user connection, etc. This we have to test the subsystem. Due to the B / S structure, the request is more affected by the performance, so we have two parts in the subsystem test, one, non-program part, ie pictures, etc. Wait; Second, the application itself. Through the separation of transactions or functions, these two pieces can be implemented separately, and the specific practices refer to the manual of each tool, I will not explain it here. The setting requirements for the test parameters of the subsystem are higher. It helps you have an accurate positioning problem behind, such as an increase in the abnormality, deadlock, network traffic, etc., and you have to pay attention to adding test parameters. The collection is relatively large, so it is generally not more than 10, and the overall performance test indicator just introduced is not much, which will be small. Finally, at this stage, it is to be explained that the amount of data of the database will greatly affect performance, so according to the previous performance requirements instructions, the corresponding data volume is simulated, so that there is a higher trusted degree.
What is mentioned above is the discovery of the problem. Here is the cause of the problem. This step is relatively high. It is generally completed by testers and programmers. Of course, if you have quite development experience, then do this test, More rare. Below we talk about how to accurately position problems, there may be many possibilities, which may have a few more kinds, one, the performance does not meet the target; Second, the performance reaches the goal, but there are some other problems, such as abnormal, death Lock, the cache hits are too low, the network traffic is large; the problem of server stability, such as memory leaks .... To discover these questions, there is a comparative performance analysis and optimization tool for use. For example, Microsoft's .NET has its own tools, there are similar tools for Borland's Java development tools, but I personally Think better tools are ROSE's Purify and Quantify, mainly to support .NET and Java, C support, and analyze the effect special professional, let's take a look at Rational Purify, Rational Purify automatically finds Visual C / C Unreasonably related to memory in Java code, make sure the quality and reliability of the entire application. Find traditional memory access errors in a typical Visual C / C program, as well as in Java, C # codes related to garbage memory collection; Rational Quantity is a performance analyst for function level, using it you can The time, percentage and number of times of function calls are obtained in the graphical interface, and the time of the sub-function, allowing you to locate the performance bottleneck.
Let us say performance optimization and abnormal processing, performance optimization has a principle, that is, the maximum time proportion is optimized, the effect is most obvious, such as a function of its execution time is 30 seconds, if you optimize one hundred times The execution time is 0.3 seconds, which is increased by 29.7 seconds, and if its execution time is 0.3 seconds, it is 0.003 seconds after optimization, the actual improvement is 0.297 seconds, and the effect is not obvious, and the procedures who have written the program know, The cost of performance optimization is greater. In the process of performance optimization, generally a prior database, the post program, because the database is optimized does not require modification, and the risk of modification is small. But how can it be determined to be a database problem, this requires a skill, when using Quantity, you will finally find out that the database query function will be relatively large, such as what, sqlcmd.executenoQuery, etc. Database execution functions , Then you need to analyze the database, huh, huh. The analysis principle of the database is the first index, the post-stored procedure, the optimization of the final table structure view, the optimization of the index is the simplest and most effective way, if reasonable use will bring unexpected effect. Here I want to give you a simple introduction to my favorite, SQLProfile, SQL query analyzer, precise, sqlprofile is a SQL statement tracker, track the SQL statement and stored procedure used by the program process, combined with the query analyzer pair SQL Analysis, you can make a good judgment on the optimization of the index, but the index is not universal. In the table, the index is more, the index will cause the performance of these operations, so it is necessary to have a certain experience. At the same time, it is also the best to optimize SQL using frequency of users. At this time, I need Precise, which can observe the execution of a longer SQL statement. After the database optimized potential, if you still don't meet performance requirements or there is a problem, you should optimize from the program. This is what programmers do, the tester is going to do, that is, tell them, which function is executed Excessive performance decline, such as too many abnormalities, excessive loop, or too much DCOM call, but persuading programmers is also a matter of income, you have to do this at this stage There are several years of programming experience, and let the programmer feel that you can improve your performance, this is a very difficult thing. Memory analysis, generally a long-term analysis process, must be made in a long time, the first time, the analysis of memory leaks is better in the unit test, not to wait until finally Question, Of course, the problem has to face it. Generally, this kind of problem is to expose in the server for a long time. Once the problem is found, the positioning problem is required, the principle of analysis is independently run independently, find the minimum problem The system set, or by means of memory analysis tool, the initial positioning problem, then use PURIFY to run time-run analysis, usually C memory issues are more, Java and .NET are relatively small, generally caused by GC. C memory error is more common, mainly common:
1, Array Bounds Read (ABR): Array Boundary Read
2, Array Bounds Write (abw): Array Bounded
3, Beyond Stack Read (BSR): Closing Diendal Reading
4, Free Memory Read (FMR): Free memory reading
5, Invalid Pointer Read (IPR): Illegal pointer reading 6, Null Pointer Read (NPR): Empty pointer reading
7, Uninitialized Memory Read (UMR): Unintegrated memory read
8, Memory Leak: Memory Leakage
Note: You can see the help information of Purify if you need more information.
By the way, why do I want to do this when the unit test is better, because the unit test is a single function, then the combined unit test case does memory analysis will be faster, and due to the earlier discovery, The late risks will be reduced, and of course, if the combined code covers the tool purecoverage, it is more perfect, huh, huh.
Completion of this article, it is already in the morning, and it is also an answer to the request of the B / S structure test and no one from the b / s structure test. Here to express a apology, because the work is relatively busy, it is inevitable to everyone I have to hurt, please forgive me. The readers of this article have aware of the test tool, I hope to enter the penetration of colleagues, I hope that my article will help you, and I also use this article to express some friends and colleagues who have helped me.
Note: This article is just a whole description of the test process of B / S app. It is only a matter of probably introducing a tool for a certain stage. You can also use your more familiar tools to achieve the same goal.