PreProcessor and PostProcessor in JMeter

A processor is used to modify the Samplers in its scope.

There are two types of processors :

  • Pre-processor : Pre-processor executes some action before making a Sampler Request.
  • Post-processor: Post-processor executes some action after making a Sampler Request.
The following Example demonstrates the Pre-Processor and Post-Processor.
  • Open the JMeter and then add Thread Group to the Test Plan.
  • Next, add HTTP sampler request to the Thread Group and enter the in the Server IP address.
  • Next, add View Result Tree sampler to the thread group.
  • Now save and run the Test Plan, after the execution, the request has been executed.
  • Now, what I wanted to do is, I want to perform some other actions before executing the current request. So for that, I need to add User Parameters to the Thread Group.
  • Now entering one parameter and specify the name of that parameter as below(To enter the parameter, click on Add Variable)
  • The Calendar Parameter will execute before the HTTP Request, so I am using this parameter in the HTTP request.
  • Mention the /${param} in the HTTP request as below.
  • Save and run the Test Plan, After the execution, open any HTTP request in the View Result Tree, you can see that the HTTP request uses the variable which we mentioned in the User Parameters.
  • Next, we need to have a Post Processor.
  • Here I am adding Result status Action Handler post-processor to the thread group.
  • Whatever the actions which we select in the Result Status Action Handler, Post Processor will be executed after the execution of the HTTP request.
  • If any user Parameter goes wrong, then the post-processor will stop execution if we select the stop test now.
  • Select the Number of Users as 5, ramp-up period as 1, and loop count as 5.
  • And then enter the wrong parameter in the User Parameters as /calendar123
  • Now save and run the Test Plan.
  • We have given the wrong parameter, so the First request itself will fail so the execution will be stopped.
  • In this way, you can select any actions in the post-processor and execute the pre-processor and post-processor.

Assertions in JMeter

How to Test FTP Upload and Download

To Demonstrate an FTP upload and Download we need an FTP website where we should have access. I have a sample FTP website where everybody can have access.

Once you navigate to that website, you will find the below page: ftp-test-website-jmeter

  • On the above page, we have a username and password, by using these details we can connect to the FTP website.
  • We can connect to the FTP site either by using a WinSCP client or Filezilla.
  • I am connecting using WinSCP.
  • Before that download and Install WinSCP in your system.
  • After the successful installation of WinSCP, you will find the login page as below.
  • Click on the file Protocol and select FTP.
  • Next, enter the Hostname which is present in the dlptest website, and enter the given username and password.
  • Click on the Login button.
  • Once you click on the Login button, WinSCP will connect to the FTP.
  • Here you can drag and drop files from Local system to FTP or From FTP to Local System.
  • Let us go to the JMeter and we need to enter some connection details.
  • Next, you need to enter all the connection details on the FTP page as shown below. Enter the Server name as
  • Next, go to the WinSCP and create a new file by clicking on the New.
  • After creating a new .txt file, enter some texts inside the text file as shown below.
  • After creating a file, go to the remote file location and refresh WinSCP, you will find the Text.txt file as below.
  • Next, go to the JMeter and enter the file name in the Remote File and then enter the Local file location followed by a newly created file name in the JMeter, and enter the Username and Password of the FTP account.
  • These are the details which we have to give in the JMeter, Save the test plan.
  • Next, add View Result Tree listener to the Thread Group.
  • Save and Run the Thread Group, after successful execution the test.txt file has been downloaded to our local system.
  • The Test.txt file has been downloaded in the given location.

Challenges I have faced in this while Downloading the File from WinSCP to Local System is:

  • Sometimes the local drive does not support them to access remote file locations, in that case, change the local system location.

Uploading File to FTP Server with JMeter

  • Delete the Test.txt file which is present inside the remote location.

  • Go to the JMeter and select the put(STOR) in the FTP request and then save and run the thread group.
  • After the successful execution, the Test.txt file will be uploaded into the remote location.

Save File Response With FTP in JMeter

  • In the same way, you can save the file in the Response by selecting the Save file Response option in the FTP Request inside the JMeter.
  • Delete the test.txt File in the Local system and then select the Get option in the FTP request in the JMeter.
  • Now save and run the Thread Group. After execution, the Test.txt file has been downloaded into the Local systems and then the same file has been saved inside the Response.
0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions