About File Transfer Protocol
File Transfer Protocol is a widely used standard network protocol for FIle sharing between a client and server in the same network. FTP Server functions with a TCP/IP network. All the client connections are established by switching ON an FTP server.
We are using FileZilla which is a free open source FTP and FTPS server for file sharing.
You can download the FileZilla Client from this link. It is straightforward to configure FileZilla to use a certain FTP server. Let’s see how to test FTP upload and download using Apache JMeter and FileZilla.
(A) Adding FTP Request Sampler
Add Thread Group
Go to Jmeter and add a Thread Group to your Test Plan. Right, Click on Test Plan and Click Add>Threads(Users)>Thread Group.
Add FTP Request Sampler
Add an FTP Request Sampler. Right-click on the created Thread group and click Add>Sampler>FTP Request.
Configure FTP Request
In the opened window, you can use your FTP server username and password. But I am using a publicly available FTP server for this demonstration. You can find the username and password form this link. Find the server called “ftp.swfwmd.state.fl.us” and “anonymous” as username and an email address as the password. Give your server name for the “Server Name or IP” section and fill “Username” and “Password” with your user name and password for the server.
We have to select “get(RETR)” as we first try to download a file from the server.
(B) Create and Run FTP GET Request
Select Remote File
We have to give the file location address to the “Remote File” section. To get the file location, I used FileZilla. Open FileZilla and fill “Host,” “username,” and “password” with your server address, username, and password provided.
Now you would be able to see the server file locations under the “Remote site” section. I have selected the “README.txt” file in the server to download.
Obtain Remote File URL
Select the file’s address that you want to download by Right click >Copy URL(s) to clipboard.
Update GET Request
Paste it on the Remote File section in JMeter and remove the server address as it has mentioned in the Server name section. Then copy the destination location on your local computer from FileZilla and paste it on the Local File section in JMeter. Give a file name to save your file. I have given the title as ABC.txt.
Add Listeners for Capturing Result
Add a “View Results Tree” listener and “View Results in Table” listener to view your test results.
Run FTP Request and Verify Results
Now click “Start” to run your project and observe the results in listeners. If you have successfully run the components, you can see the results below.
You can also refresh the FileZilla window and check whether the created file appears in the specified directory.
(C) Create and Run FTP POST Request
For running FTP POST via JMeter, you would essentially run the same above steps except changing some parameters and commands in your request which would be different from GET request.
Create FTP Request Sampler
Create an FTP Request Sampler and fill it with the same details as in the previous sampler. Hence you can follow the above steps from 1 To 3 to create FTP Sampler in JMeter and then follow the below steps to configure a POST request instead of GET request.
Alternatively, you can use your existing FTP Post Plan which you prepared using the above steps, and just convert it into a POST test plan by making changes in itself. Both the options are easy peasy!
Update POST Request for Local
I have selected the downloaded file ABC.txt to upload. So the “Local File” location is unchanged. Select a compatible directory in the FTP server to store your data using FileZilla. I have selected a directory in the “/pub/incoming” folder. Verify your results as in the previous section.
Select FTP PUT Command
We have to change the get(RETR) to put(STOR) for posting a file.
Also you can use binary mode over ASCII mode by clicking “Use binary Mode”. You can also view a preview of your file by clicking “Save File in Response?”.
Run FTP Request and Verify Results
Response Data section shows the response data, and it is a better way to check the accuracy of your downloaded file.
We can test the performance of our FTP Servers as in the above instructions. JMeter is one of the best applications for it.