Role of Load Testing in Performance Testing approach & its best practices
Before taking up the issue of Load Testing in Performance Testing approach let us firstly try to understand as to why we should do the Performance Testing?
Performance testing is usually carried out to discover different bottlenecks or risks associated with the system. The type of risks can have varying impact on the business in terms of added expenses, loss of opportunity, project delays and even the reputation of the organization may be at stake.
The performance testing is a part of software testing that helps us in benchmarking & establishing baselines for carrying out testing in future as well as guiding the stakeholders in understanding the actual quality level of the product under test.
How do we categorize Performance Tests?
Performance tests generally fall under three categories like:
1) Performance Testing
2) Load Testing
3) Stress Testing
Each of the above categories of tests carry particular objective as briefly described
1) Performance testing: This being the superset of all remaining categories is primarily meant for validating the speed of the system, its stability and scalability. Here main focus remains on achieving desired throughput, response times & optimum utilization of resource to meet the target performance objectives of the application or product.
2) Load testing: This category of performance testing is meant for validating the performance related characteristics of the application while it gets loaded to the anticipated volume of loads during the actual production.
3) Stress testing: This category of performance testing is meant for validating the performance characteristics of the application, while it encounters stressful conditions, beyond anticipation during the actual operations. Here focus remains on identifying conditions wherein the application shall ultimately fail plus understanding the mode of failure & pointers for predicting these failures.
What is load Testing? And why do we do it?
All multi-user applications are subjected to simultaneous or concurrent access at some point of time. Hence prior to exposing our new application to simultaneous access by several users under a live scenario, it is ideal to simulate the multi-user conditions & test the application in the lab, before actual deployment.
This is what we call load testing.
What are the positive attributes of Load Testing?
Load testing is absolutely indispensable for multi-user systems due to the following:
1) Need of fewer Infrastructures: It is not feasible to organize several users who can be asked to use the application simultaneously. Even if is done somehow, it is not feasible to retain so many users in place during the test, which may be repeated time & again. That is why we simulate hundreds or thousands of users in the lab for load testing & achieve the same objective. Results of every iteration of load test will be different when the number of users happen to change.
2) Reliability of tests: Simulated load tests enable us to execute the same operation with absolute precision every time it is run. Hence tests are more reliable due to reduced human error.
3) Repeatability of tests: Simulated load tests enable us to execute the same operation repeatedly for much higher duration / may be for many days.
4) Reusability of Tests: Tests once designed, can be reused for testing various versions of the application, even if some of its features like user interface etc. happen to change.
5) Easy Programmability: Complex tests can be easily programmed to discover any surprising information.
What are the steps involved in Load Testing process?
b) Creation of test scripts
c) Creation of scenarios
d) Execution & monitoring of scenarios
e) Analysis of results
Planning is the most important activity of any Load Testing effort, hence activities involved in it are as under:
1) Listing out the transactions, which are used most frequently by the users.
2) Listing out the number of users.
3) Listing out the likely number of concurrent or simultaneous users. As an approximation we can consider a ratio of 10:1or 5:1 for number of logged-in users versus number of concurrent users.
5) Listing out the configuration and size of production platform.
6) Listing out the data which will be used during testing.
7) Listing out various combinations of all test scenarios under real-time usage conditions.
8) Listing out the duration of execution of the load test.
9) Listing out the type of information exchanged between clients and the server.
10) Listing out the type of information required by various persons like database administrators, network administrators, server administrators and all others concerned personnel.
11) Listing out the configurations of software for the database server, application server and web server etc.
Best practices or guidelines for Load Testing
1) We should plan the load test only when the functional stability of our application gets established.
2) We should ensure that the number of users must not be directly proportional to the response time.
3) We should try to execute the stress test for short duration only.
4) We should try to have large amount of unique data in the data pool as far as possible.
5) We should not load the load creating client machines at capacities in excess of 80% of CPU & memory.
6) We should try to avoid creation of detailed logs in the tool to conserve the disk IO in various client machines.
7) We should parameterize the script so that we can access the application with various configurable URLs. This will help us in reusing the script when the application gets moved form one box to the other.
8) We should try to use rendezvous points for synchronizing the requests before form submission actions in our script as & when needed. This will help us in getting concurrent hits at the time of submission of form.
9) We should try to avoid downloading of image files if possible. Reason being, during real time situation, the image files do not get downloaded each time.
10) Keep a log of consistency of response time over elapsed period & the same should be compared with various test runs.
11) We should ensure submission of all successful requests & ensure that the log files are matching. We should ensure that all requests that are triggering the operations in database, be recorded in the database.
12) We should ensure minimum size of queues at any particular time during the test.
13) In case of problem, priority of our suspicion must be on the database & business logic layer as compared to the web server.
Following check list always remains helpful while Load Testing:
|1)||Whether we have a hardware having configuration quite close to the one being used during production?
If not � Identify the variance of our test hardware from the production.
|2)||Check whether our tool is able to handle the recording of requests according to the protocols used in the application and should be able to again replay it.|
|3)||Check whether functionally of the application is established prior to the load testing?|
|4)||Explore the availability of numbers on the user counts from the customer, based upon the previous records if any?|
|5)||Check whether our data pool has unique data?|
|6)||Check whether the trace logging is enabled for web servers and database servers?|
|7)||Check whether the requests are evenly distributed among various boxes? Whether any load balancing system is available?|
|8)||Check whether our tool is having a facility to simulate different line speeds?|
|9)||Check whether our tool is having a facility to simulate different versions of browser?|
|10)||Check whether our tool is having a facility to log the messages selectively?|
|11)||Check whether our tool is having a facility to export our data in Microsoft Excel file format?|
|12)||Check whether our tool is having a facility to synchronize various concurrent requests automatically?|
|13)||Check whether we are monitoring the queue size during the test runs, wherever queues are being used in the application?|
|14)||Check whether our tests require runs with & without any proxy servers?|
|15)||Check whether our tests require runs with & without any firewalls?|
How Load Testing differs from Functional Testing?
Some of the points of variance among Load Testing & Functional Testing are:
1) Results of functional tests are largely well defined provided proper steps are followed in testing & all preconditions are adhered to; whereas results of load tests remain quite unpredictable.
2) Results of functional tests vary within a narrow range of around 5% when configuration is changed, whereas results of load tests can have drastic changes in such a case.
3) Frequency of execution of functional tests can be very high may be everyday; whereas load tests are conducted occasionally.
4) Results of load tests are dependent upon volume of database and these results vary according to changes in the number of users.