JMeter is a popular open source load testing tool that is written in the Java programming language. Besides other things, JMeter can be used to load test web applications. It is very simple to deploy JMeter on a Windows computer. JMeter is full of features to build, configure and run a realistic web test. It can also be used to perform functional testing on a web application. With this introduction, let us see how we can quickly build and execute a web test in Apache JMeter.
If you are new to performance testing or JMeter, please see my video, JMeter Load Testing Beginner tutorial. I have explained performance testing in the first 40 minutes. In the next 40 minutes, I have demonstrated the important basic JMeter features.
Also, you can see a complete JMeter load test explained in my video, Learn JMeter Load Testing in 18 minutes.
If you are new to performance testing or JMeter, please see my video, JMeter Load Testing Beginner tutorial. I have explained performance testing in the first 40 minutes. In the next 40 minutes, I have demonstrated the important basic JMeter features.
Also, you can see a complete JMeter load test explained in my video, Learn JMeter Load Testing in 18 minutes.
The latest release of JMeter can be downloaded here. At this time, the latest version is 2.9. JMeter requires Java 6 or later (meaning that the client computer needs to have Java version 1.6.x or later). You can check the java version on your computer by running the command, java -version in the command prompt window. If it tells you the correct Java version, you can proceed to set the JAVA_HOME environment variable under Control Panel> System > Advanced System Settings > Environment Variables > User variables. The JMeter binary comes as a zip file that you need to extract in a folder in your computer. Under this folder, there will be a folder called bin. You can launch JMeter by executing jmeter.bat file in the bin folder.
Building the web test plan
We will now build a simple web test. This test will involve navigating to the Software Testing Space blog and then my profile page. Add a Thread Group by right-clicking on the Test Plan node and then clicking Add > Threads(Users) > Thread Group. Leave every value as default.
Now, add a HTTP Request by right-clicking Thread Group and clicking Add > Sampler > HTTP Request. Change the Name value to HomePage. Put the Server Name or IP value to inderpsingh.blogspot.com/ Then scroll to the bottom and check Retrieve All Embedded Resources from HTML files. Add another HTTP Request. Change the Name value to ProfilePage. Put the Server Name or IP value to blogger.com. Put the Path value as profile/05923580987480854491.
Running the web test plan
Before running the web test, you need to arrange to get the results. For this, add a listener. A simple listener is View Results in Table. Add it by right-clicking on Thread Group and then clicking Add > Listener > View Results in Table. Now click the green Start button or in the menu, click Run > Start. If you have not saved your web test plan, you can do so now. You should see the results. Results containing green icons indicate success, those containing orange/ red icons indicate warnings or errors. If your results contain green icons, it means that you successfully ran the web test plan with 1 thread (meaning an independent virtual user) running each HTTP Request once.
Now, run the same web test plan with 2 users running 3 iterations of 2 HTTP requests. Important: Please note that this blog is not a web site to be stressed. This is only an example. Therefore, please be reasonable and use very small numbers. Change the Thread Group values. Put Number of Threads (Users) as 2. Put Loop Count as 3.
Click on View Results in Table. Then click the Clear button in the toolbar to clear the previous results. Run the web test plan by clicking the Start button. When the test plan is running, you should see 2/2 in the upper right corner. This means that 2 threads/ users out of a total of 2 are active. Once the requests are sent and responses received, you should get the new results.
As you can see, it is quite easy to build and run simple web tests in JMeter. I hope that this post was able to raise your interest in using JMeter. You can see a more complex and complete JMeter load test plan in my video, JMeter Load Testing.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.