By Mahesh M R on Apr 12, 2016 3:02:57 AM
Software Reliability Testing is a field within software testing that tests a software's ability to function, given environmental conditions, for a particular period of time. While there are several tools available in the market for performance and reliability testing, I have focused on Jmeter for this blog.
Jmeter or The Apache JMeter™ application as it is popularly known is an open source software. It is a hundred percent pure Java application designed to load test functional behavior and measure performance.
Given below are some guidelines on using Jmeter to test the reliability of a software product:
Steps to download and install Jmeter:
Jmeter, as a simple .zip file, can be downloaded from the below mentioned URL:
Pre-requisite is to have Java 1.5 or higher version already installed in the machine.
Unzip the downloaded file in a required location, go to bin folder and double click on Jmeter.bat file.
If Jmeter UI opens up then the installation has been successful. If it does not open, then Java might not be installed/configured or the downloaded files may be corrupted.
The next step is to configure Jmeter to listen to browser. Open up the Command prompt under bin location of Jmeter and run Jmeter batch file. This will open up simple UI of Jmeter as already seen.
If you are accessing the internet via Proxy Server then this will not work when recording scripts. We need to by-pass the proxy server and to do this we need to start Jmeter by adding two parameters, -H proxy server name/IP address and -P port number. Adding these will look like the following image:
The next step is to configure the browser to `listen' to Jmeter while recording the scripts. For this blog, I will be using Firefox browser
- Open Firefox browser
- Go to options->Advanced
- Select Network tab and click on Settings
- A connection settings tab will be opened under the `select manual proxy' configuration and give HTTP proxy as localhost and port as 8080.
After having configured proxy settings, we need to have Jmeter Certificate installed on the required browser.
The Certificate will be in Jmeter bin folder, under the file name “ApacheJMeterTemporaryRootCA.crt”. Given below are steps to be followed to install the Certificate in Firefox browser
- Open Firefox browser
- Go to options->Advanced
- Select certificate tab and click on View certificates
- Under Authorities tab click on Import
- Go to bin folder of Jmeter and select the certificate under it (ApacheJMeterTemporaryRootCA.crt)
- Check “Trust this CA to identify website” option and click on Ok.
Note : If you do not find the certificate in the bin folder directory then you can generate it by running the `HTTP Recorder'. Every time you run the recorder, the certificate will be generated and there is no need to replace the certificate every time.
Recording of Script for web-based applications:
Steps to record a sample test script:
- Open up Jmeter by running Jmeter.bat
- Right click on Test Plan->Add->Threads(Users)->Thread Group
- Right Click on Thread Group->Add->Logic Controller->Recording Controller
- Right Click on WorkBench->Add->Non-Test Elements->HTTP(s) Test Script Recorder
- Right Click on HTTP(s) Test Script Recorder->Add->Listener->View Results Tree
After adding the components, Jmeter UI would look like the following image:
- Click on HTTP(s) Test Script Recorder and again click on Start. Jmeter Certificate will be generated with a pop- up informing the same. Click on `Ok' button on the pop up.
- Open up the browser, for which Jmeter proxy is configured and go to the URL which is under Test and execute your manual test script with which you want to determine performance.
- Once you are done with all your manual test, come back to Jmeter UI Click on HTTP(s) Test Script Recorder and click on Stop. This will stop recording.
- Click on the icon for recording script to view all your recorded HTTP samples, as follows. You can then rename Recording script controller
- You can view details of the page recorded under “View Results Tree Listener”. By using these values you can determine the assertions to put in your original run.
- Now Click on “Thread Group” and configure the users you want to run. Also Right click on Thread Group->Add->Listener->Summary Report and also add View Results Tree.
- Make sure to Tick check box “Errors” under View Results Tree, or else it will take up huge memory while running your scripts as it captures almost everything
- Now you can run your recorded scripts! Just click on Run/Play button on the top toolbar of Jmeter UI
Analyzing the test run result:
While the scripts are running, results/timing will be captured under “Summary Report Listener”. Summary report will look the following after your test run has been completed. You can save the report by clicking on “Save Data Table”
Below are details of each keyword:
- average : Average is the average response time for that particular http request. This response time is in milliseconds.
- aggregate_report_min : Min denotes the minimum response time taken by the http request. Time is in milliseconds.
- aggregate_report_max : Max denotes the maximum response time taken by the http request. Time is in milliseconds.
- aggregate_report_stddev : How many exceptional cases were found which were deviating from the average value of the receiving time.
- aggregate_report_error% : This denotes the error percentage in samples during run.
- aggregate_report_rate : How many requests per second does the server handle. Larger is better.
- average_bytes : average response size. Lower the average number, greater is the performance.