DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Dynamic File Upload Component in Salesforce LWC
  • How To Protect Node.js Form Uploads With a Deterministic Threat Detection API
  • How To Scan and Validate Image Uploads in Java
  • How To Use IBM App Connect To Build Flows

Trending

  • Understanding Java Signals
  • Microsoft Azure Synapse Analytics: Scaling Hurdles and Limitations
  • Beyond ChatGPT, AI Reasoning 2.0: Engineering AI Models With Human-Like Reasoning
  • Unlocking the Potential of Apache Iceberg: A Comprehensive Analysis

Recording File Uploads With JMeter

A hands-on tutorial of how to simulate a file upload in your Java application using JMeter.

By 
Dmitri Tikhanski user avatar
Dmitri Tikhanski
·
Jun. 21, 16 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
14.1K Views

Join the DZone community and get the full member experience.

Join For Free

if you need to simulate uploading a file to an application under test, the fastest way of creating a jmeter test plan is recording the corresponding request via the http(s) test script recorder . jmeter comes with a proxy server which captures all traffic between the browser and the application under test, and converts it into the relevant http request samplers.

the easiest way to set up jmeter for recording is by using the templates feature, by performing the following steps:

  1. from jmeter’s main menu, choose file -> templates -> recording
  2. click the “create” button
  3. configure your browser to use the jmeter proxy providing:
  • the hostname or the ip address of the machine where jmeter is running as the proxy host
  • 8888 as the proxy port

now let’s try to record the file upload. i’ll use the readme file which lives in the root of the jmeter installation for this exercise.

so we’re getting the following error:

java.io.filenotfoundexception: readme (the system cannot find the file specified)

let’s take a look at the recorded request in the test plan:

as you can see from the image above, jmeter correctly resolved the file name which is readme , but didn’t capture the full path to the file. this is a result of browser behavior, as some browsers don’t send the full path of the file which is being uploaded. that is why jmeter wasn’t able to locate the file and send it along with the request.

the solution is to copy the file to jmeter’s “bin” folder . this way jmeter will pick up the file using the relative path, and therefore cause the recording to be successful.

the same applies to the recorded scenario replay. here you have 2 options:

  1. provide the full path to any file which you want to upload
  2. use the relative path (just filename), but in this case the file has to be in jmeter’s “bin” folder


remember that if jmeter’s proxy doesn’t work for you for some reason, there are the following alternative options of recording a jmeter test:

  • using the blazemeter chrome extension - this way you don’t need to worry about proxy configuration, ssl certificates, copying files to jmeter’s “bin” folder, etc.
  • using the blazemeter recorder - your personal cloud proxy which has “smart” jmx mode of exporting captured requests - automatic correlation of dynamic parameters so you won’t have to develop and debug regular expressions in order to make your test work.
Upload

Published at DZone with permission of Dmitri Tikhanski, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Dynamic File Upload Component in Salesforce LWC
  • How To Protect Node.js Form Uploads With a Deterministic Threat Detection API
  • How To Scan and Validate Image Uploads in Java
  • How To Use IBM App Connect To Build Flows

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!