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.