jMeter Tutorial - FTP Test Plan

In this chapter we will see how to test a FTP site using JMeter. Let us create a Test Plan to test the FTP site. 

Rename Test Plan

Start the JMeter window by clicking on /home/deepak/apache-jmeter-2.9/bin/jmeter.sh. Click on the Test Plan node. Rename this Test Plan node as TestFTPSite. 


Add Thread Group

Add one Thread Group, which is placeholder for all other elements like Samplers, Controllers, Listeners. Right click on TestFTPSite(our Test Plan) > Add > Threads(Users) > Thread Group. Thread Group will get added under the Test Plan (TestFTPSite) node.

Next let us modify the default properties of the Thread Group to suit our testing. Following properties are changed:

Name: FTPusers

Number of Threads (Users): 4

Ramp-Up Period: leave the the default value of 0 seconds.

Loop Count:1





Add Sampler- FTP Request


Now that we have defined our users, it is time to define the tasks that they will be performing. We will add FTP Request elements. We will add two FTP request elements, one which will retrieve a file and one which will put a file on the ftp site. Begin by selecting the FTPusers element. Click your right mouse button to get the Add menu, and then select Add > Sampler > FTP Request. Then, select the FTP Request element in the tree and edit the following properties as in the image below:



The following details are entered in the this element:

Name: FTP Request Get

Server Name or IP: 184.168.74.29

Remote File: /home/deepak/sample_ftp.txt

Local File:sample_ftp.txt

Select get(RETR)

Username:deepak

Password:system123

Now add another FTP request as above and edit the properties as in the image below:



The following details are entered in the this element:

Name: FTP Request Put

Server Name or IP: 184.168.74.29

Remote File: /home/deepak/examplefile.txt

Local File: /home/deepak/work/examplefile.txt

Select put(STOR)

Username:deepak

Password:system123 


Add Listener

The final element you need to add to your Test Plan is a Listener. This element is responsible for storing all of the results of your FTP requests in a file and presenting a visual model of the data.

Select the FTPusers element and add a View Results Tree listener (Add > Listener > View Results Tree).





Run the Test Plan

Now save the above test plan as ftpsite_test.jmx. Execute this test plan using Run > Start option. 


View Output

The following output can be seen in the listener.









You can see that four requests are made for each FTP request. We see that the test is successful. The retrieved file for GET request is stored in the bin folder. In our case it would be /home/deepak/apache-jmeter-2.9/bin/. For PUT request the file is uploaded at the path /home/deepak/.