Friday, April 18, 2014

How to create and run FTP request script in jmeter?


Building an FTP testplan is a very easy task. You just need to know the ip, username and password of remote machine.

Steps:

1.       The first step to open jmeter, and add a thread group.
2.       Now in thread group define users or number of threads you want to run your test.
3.       Add FTP request default under thread group (Thread Group>>Add>>Config Element>>FTP request defaults), and enter the server/remote machine’s ip or domain. Port number is non-mandatory; if you will provide it jmeter will use its default port.


4.       Now add FTP request under the thread group (Thread Group>>Add>>Sampler>>FTP Request).


5.       In FTP request, you need to provide, the remote machines ip, and port number if you want.
6.       In Remote file you need to provide the complete path of the file you want to copy or where you want to write your data.
·         E.g. home/directory/file1.txt
7.       So after providing the file path, the complete accessing path of remote machine will be like Server IP/ home/directory/file1.txt or 192.168.10.12:8080://home/directory/file1.txt
8.       Now provide the local file path, from where you are transferring the file or to where you are copying or writing the data.
·         E.g. C:\Users\Marvin\Desktop\MyFile\file2.txt
9.       The file ext of remote and local file should be same, else it will not be able to write or read the data. Transferring the file means you are copying the content/data of one file to another.
10.   The get (RETR) radio button will be checked if you want to retrieve the data from remote machine.
11.   Put (STOR) radio button will be checked if you want to transfer the data to remote machine.
12.   Save file to response enables you to store your data in response, so that when you will run the test you will be able to see the exact data in your listener (view result tree).
13.   Last provide the correct username and password of your remote machine.

14.   Add a listener (view result tree or table) to your thread and run the test.

Thursday, January 17, 2013

Recording Script for Jmeter with BadBoy tool

Hi! Today we will see, how to record script For static website(those web-page which doen't have any connection to sql server) with badboy tool.

1. Badboy tool is an simple automation tool. With this tool we can record script and can export as jmeter script (.jmx).
2. First install badboy tool, download link is http://www.badboy.com.au/download. You can easily download it for thi link.
3. Install it, and start,   Now follow the tutorial.....
4. To show you, how to record script tking exampe of  simple website
link is : http://www.sarahhayes.co.uk/



5. So you see how easy is this. try it...

For any query mail: digvijaybisht29@gmail.com

Bye..  : )




Sample Interview Questions on Jmeter

Basic Questions:


Q1: What is the use of Jmeter?
Ans: Jmeter is an open source desktop application software, 100% pure Java application, which is designed to perfom load testing of web based application.

Q2: Is it mandatory to install java first, to run jmeter?
Ans: Yes, Jmeter is an java based application. So you should install java 1.5 or later version in your system.

Q3: Can we do regression testing with Jmeter?
Ans: Yes we can, after-all it is all about java-script. :)

Q4: How we can run jmeter?
Ans: By simply clicking on Jmeter.bat, or by using commnad: C:\>Jmeter

Q5: What are the options, do you see when jmtere window opens?
Ans: 1. Test Plan     2. Workbench

Q6: Which component, do we need to add, to record script?
Ans: We need to add Http proxy server, by simply right clicking on Workbench > Non-Test elements > Http proxy server.

Also need to enable proxy, with port 8080, by going to internet settings> Connections > Lan. Name will be "localhost".
Then click on start button on jmeter http proxy server window.

Q7: Can we perform load testing of database with jmeter?
Ans: Yes we can. To see the process follow: Database load testing with jmeter link. You should be aware of sql queries.

Q8: What are listeners in Jmeter?
Ans: Listeners in jmeter are used to capture the response data of load test. We can have response data (result) in , cvs, image (graph) or in html format.

Q9: Name 4-5 listeners in jmeter, which are commonly used.
Ans: 1. View result tree 2. Summary report 3. Aggregate Graph 4. Response time vs thread 5. Composite graph

Q10: What is Response time in Jmeter report?
Ans: Response time in Jmeter report, is the time taken by web server, to answer the requested query. In simple words, it is the time taken by a web server to respond the http request.

Q11: What is median in jmeter listener?
Ans:  It is a number which divides the samples into two equal halves. Half of the samples are smaller than the median, and half are larger.

Q12: What is throughput in jmeter listener?
Ans: Throughput is relation between time and data.It shows the relation between http request and unit time. Means how many requests are processed in how much time.

Throughput = Number of requests / Time(second or millisecond)

Q13: Which Jmeter elements are used for Parameterization?
Ans: 1. User parameter 2. CSV Data Set config

Q14: Which controllers are used as an conditional controllers in jmeter?
Ans: If controller and While controller

Q15: What is heap size in jmeter?
Ans: Jmeter is work in java, and heap size is related to java. Java heap is the heap size allocated to JVM applications which takes care of the new objects being created. If the objects being created exceed the heap size, it will throw an error of java.lang.out.of.memory.
Java's default heap size limit in Jmeter is 256 MB.

Q16: Is it possible that, if we increase the heap size in Jmeter, then application(jmeter) might not work?
Ans: Yes, it is possible. Because heap size depends upon the empty space of your machine in c drive as well as your RAM. If the RAM is 1 Gb and you increased the heap 2048, it may not work.



Jmeter heap error or java.lang.outofmemory error..

In previous posts, i wrote about, how we can remove the heap error or java.lang.outofmemory error in Jmeter. Recently when i was performing performance testing of a web based application, even after doing all settings to remove heap error, i got this error. I was wondered, why this error occurred again, when i was done with necessary changes to the properties files in jmeter.

I checked the script again, but no solution was there. Then i rechecked the properties file, and there i came across to know that we do need to change the properties in jmeter report.bat file too. Because if the heap size in report remain same means less, it will cause problem when we will run test for large number of users.
So do the changes in Jmeter-report.bat file.





As you can see the image, it is after updating the properties.

Also if you dont want to see this king of error, run jmeter in non-gui mode.

My next post will be on the same.

Monday, July 16, 2012

Jmeter result:

To learn about jmeter results(Summary Report, View Result Tree  ETC.) follow:
           http://jmeterresults.blogspot.in

Wednesday, July 11, 2012

Uncaught exception java.lang.outofmemoryerror:

Most of you will be familiar with this error. I am not going with other java problems. I am only concerning with jmeter related problem, and when i was running load test for a web-app with 1500 virtual users, jmeter gave this error. "uncaught exception java.lang.outofmemoryerror:".













In the previous post "http://www.blogger.com/blogger.g?blogID=8863051106567046425#editor/target=post;postID=8667267162068998059"  i talked about heap error and how to solve that problem. But now when when all the setting were correct as well as heap size too i found a new error in jmeter.
This error causes because stack size. Stack size depends upon your cookies and cache in jmeter.
I will just tell you how we can solve that problem.








As you can see in the above image, the set heap size section. When you will open this by editing jmeter.bat file, you will not see the "-Xss64k" section  there.
So to remove the "uncaught exception java.lang.outofmemoryerror: " error just add this section to your jmeter.bat file. Also you can increase the size of stack till 100k as per your system and jmeter behavior

I hope this post will help you threw this..

Monday, May 28, 2012

Jmeter Heap Error!

Hi All!  
        
While using Jmeter, it is not always like you record script, provide number of threads, add listeners and run the script. I am saying this because so many time when we try run our test, we face some error not all the time but some time when we increase the number of threads. This is usually caused by including memory intensive listeners in your stress test. Listeners like "View Tree Results" are useful for debugging your test, but they are too memory intensive to remain in your test when you ramp up the number of simulated users and iterations. The best listeners to use for a long-term, high-load test are Aggregate Listener, Graph Listener, and Spline Listener.
Here is the image of that particular section where you will find the area where you can make changes to reduce the heap error.
To go to this area, Go to the" Jmeter" folder where you have copied that. Then explore this folder and open "jmeter.bat" with notepad, and find the area mentioned in the image:










Now as you can see in the above image, the heap size, new heap size. Now one important thing, is if you want to test your web application with more that 500 users and your system configuration is only 512 MB Ram or your have 1000 users or more that that and you have 2 GB m/c so it is going to little bit tough for you to run your load test.
Because if a m/c with 2GB ram can generate 1000 user max. Rest your application will get choked because of m/c's slowness. 
Heap size is depends upon your system configuration. So if you have 2GB m/c then increase your heap size to 1024-1024m or 512-1024m, according have much free space you have in your m/c.

You can make changes directly from the area mentioned in the image.

And one most important thing, do not put max load at first instance. First check the behavior of your m/c with less number of users.

Enjoy your load test with Jmeter.   :) 

Tuesday, March 20, 2012

GUI changes in Jmeter

How does a software works? Is very important. But for the first time user, look and feel of that software is very important. Yes I am talking about GUI.
So many load testing tool like QTP, Load runner, web load etc. are mostly used because of its easy user interface and GUI. However these are paid tools. Now coming to the point, Jmeter the open source load testing tool has released its latest version (2.6).  I think you are still confused if I am talking about GUI then why Jmeter... It is because in the latest version of Jmeter GUI has been changed. Now when you will run Jmeter, you will get this kind of toolbar in your Jmeter window.
  

Jmeter look and feel: Change the look of you Jmeter window as you want from the given options.


Jmeter also have provided the search option. After recording the script, you can easily search the tree content or sampler by typing in search window.

…………     

Tuesday, February 14, 2012

Jmeter tutorial videos

As discussed in earlier post the jmeter is a load testing tool. Now here are some videos related to jmeter.
These videos consists:-
  1. Identifying key scenarios  
  2. recording script
  3. parameterization
  4. data correlation
  5. understanding report 
Click here for jmeter tutorials video

Friday, July 1, 2011

How to monitor server,s system performance while running Jmeter

This is the big question , when you are putting load on webserver from your computer or using distributed load testing, what is behaviour of server's computer..Server's computer behaviour means at the time of load what is cpu performane, network performance, i/o. So we need to monitor thise things also. But as i have practiced i was not be able to do distributed load testing and also monitoring the cpu performane of server's computer. For that what you can do?I will tell you waht i have tried. I open two jmeter windows. In one window i did distributed load testing, and in another i used the same script but with single thread (user), and check on forever, and added the server performance monitor listners. What it will do? It will run one user in loop till you will not stop the test and also provide you the server's computer performance. Because one user will create that much diffreence according to me.
First i will tell you have to add plugins in jmeter for listners.
For that you have to download  jmeter plugin.jar for the jmeter version you are using. Now extract jmeter plugin and copy jmeter plugin.jar file to c:/jmeter/lib/ext. And from the extracted file you will also get the server agent folder. Copy the server agent folder to the web server's computer and past it in c: drive. Explore server agent folder at server's end and start start agent.bat file.

















Now you should know the server's computer ip. Like we have the server ip is 192.168.45.89.

Now from your computer start jmeter and add-:


After clicking server performance monitor you will see the window like:-

















In this window you will be able to see add row,copy row and delete row.And clickig on add row the window will be like:-
















Here below Host/Ip where local host is written you have to type the ip of server's computer.And the port will be by default set to 4444 till no changes done at the server end.
Also you will be able to see cpu,memory,swap,disksI/O,NetworksI/O.From here you can select single object at a time.If you want to see all the details at the same time,so you can add server performance monitor from thread group-add-listners,and then can select another object.
Remember first you have to record or open the test then add the listners.
Now when you will start the test you will be able to see the server's performance selecting server performance monitor.
I think this blog may helpful to you for this senario..
Thank you

HOW TO DO DISTRIBUTED LOAD TESTING

Distributed load is referred with putting load on server by using another machine. In this you will send the request from your own computer which is called "Master" computer,to other computers which are called "slave" computer to web-server  With this you will be able to put max load on web-server with the different CPU usage.
The prerequisite for this:
  • You should turned off the firewalls of your computer.
  • All the clients should be the same Sub-net.
  • Make sure jmeter can access the server.
  • Make sure you use the same version of Jmeter on all the systems.
How to configure-In this in the master computer in which you are running Jmeter,first go to the C:/ drive where the jmeter folder is-Then explore the jmeter folder,go to jmeter properties/configure file,and edit it.
You will see the line after scrolling down remote Host-127.0.0.1
















Just add the ip of slave computer threw which you want to put the load on web-server.
Like I the ip’s are-192.168.34.78,192.168.34.89 etc..
But make sure that the IP should be of same domain.After adding the ip this line will look like-:















 


After editing the line press ctrl+s.This is what should be done in Master computer.
Now go to slave computers and on that –
Go to jmeter/bin directory and execute jmeter-server.bat (jmeter-
server). On windows, you should see a dos window appear with “jre\[version]
\bin\rmiregistry.exe”. If this doesn't happen, it means either the environment settings are
not right, or there are multiple JRE installed on the system.
1. Open jmeter-server.bat in a notepad or edit-plus.
2. Follow till line-44 and find “:setCP”
3. Edit “START rmiregistry” to the full path. Example: “START
C:\jre\bin\rmiregistry.exe”
















When you are putting the distributed load, you should execute the jmeter-server.bat file first.
Now when you will start Jmeter from master computer,on the run tab you will see the option remote start-















So as you can in the above figure in the remote start option you will be able to see all the ip’s. From here you can select the ip from which computer you want to put the load on web-server. Or u can click on Remote Start All to put load threw all the slave systems on web-server.
After configuring this you can record the test or open the save tests.

This will may helpful to you.for more information refer this link- http://jakarta.apache.org/jmeter/usermanual/remote-test.html

Tuesday, June 28, 2011

Jmeter tutorial


                                             How to install Jmeter

 Prerequisites-To use JMeter on your machine you should have latest Java Runtime Environment (JRE) installed on your machine and set the environment variables properly to work.

Installing JAVA:

1.       Download the latest Jar file.
2.       To install java in your computer follow given steps:

·         Install java in your computer.
·         Go to the installed folder, E.g. C:\Program Files\Java, and check that lib and bin folder’s are present or not.
·         If no then install java again, or if yes then proceed further.
·         Press “windows+R”, and type sysdm.cpl, then press enter.
·         After pressing enter:

·         The above window will appear, click advance>Environment Variable.
·         In system variable variable section, scroll down to search PATH, and then in Path click on Edit.
·         Now go to the folder where java is installed, and expand it till bin folder, for E.g..,
·         Now after clicking on edit button for Path, go to end in text box and after putting semi-column  paste the copied path of java bin in Path variable.

·         Now go to the user variable section and  click on New button. Now create a new variable with the name JAVA_HOME, and in the value paste the of you java. E.g C:\Program Files\Java. Then save it.
·    Again create a new variable with CLASSPATH, and in the value paste the path of your java library  For E.g. C:\Program Files\Java\lib., and save it.
·         Now your java is installed successfully.

Installing JMeter

1.       Download Jmeter from Here. Download “apache-jmeter-2.9.zipmd5pgp” file from Binaries.
2.       To configure Jmeter in your computer follow the given steps::
·         Extract the downloaded Jmeter folder, and copy it to the desired drive. For example I put the Jmeter file in C drive.
·         Now press windows+R, and go to system variable as done while installing java.
·         In user variable, create variable with the name JMETER_HOME, and in the value paste the path of Jmeter installed folder. For E.g. C:\Jmeter.
·         Jmeter is configured successfully.

Running JMeter
1)      Open JMeter root folder i.e. C:\jmeter
2)      Open bin directory inside jmeter folder
3)      Double click on “jmeter.bat” file.
4)      JMeter will be launched.

The window should be open like this with a command prompt window-

In this window you will be able to see the tabs-  1  : Test plan, 2 : WorkBench
As Jmeter is a usefull tool for load testing,so the first and important this is to record the script.
Script is whatever actions you have performed in website.
Now to record the script for testing,first of all right click on workbench and add http proxy server.
After selecting http proxyserver the window will be like:

Now  we will go to the test plan and right click on it and add thread group like:-

After selecting thread group:-

 [In this window number of thread users=no of users
Ramp-up period(in seconds):delay b/w every user
Loop count:how many time you want to repeat the test]
(Note:-By default the values will be as in the window)
Now to record the test first of all open the internet explorer,go to the tools then internet options,go to connection tab,click on lan settings.check the proxy server and give the Address:-localhost,port no-8080.click on ok and again click on ok.
Now got to the jmeter window and select http proxyserver,and click on start.
Open the website in internet explorer of which you want to test load.I am assuming the website is http://www.google.com/.  And performing some search actions.
Now move back to the jmeter window and select http proxyserver and click on stop. Then clich on thread group:-


Below thread group all are the http requests or we can say it as the recorded script.
Now here is the thing which is very important is that if you will put the load on web server from your own computer and the numbers of users are more than 1000 or 500.That time it might be possible that your computer or jmeter will hang.
To solve this problem we can use Destributed load method in Jmeter-