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

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

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

Related

  • Datafaker: An Alternative to Using Production Data
  • Solid Testing Strategies for Salesforce Releases
  • Apex Testing: Tips for Writing Robust Salesforce Test Methods
  • Mastering Redirects With Cloudflare Bulk Redirects

Trending

  • Event-Driven Microservices: How Kafka and RabbitMQ Power Scalable Systems
  • Distributed Consensus: Paxos vs. Raft and Modern Implementations
  • After 9 Years, Microsoft Fulfills This Windows Feature Request
  • Introduction to Retrieval Augmented Generation (RAG)
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Testing, Tools, and Frameworks
  4. How to Work With CSV Files in JMeter

How to Work With CSV Files in JMeter

These tips will help you effectively work with CSV files in JMeter when running performance testing.

By 
Can Ho user avatar
Can Ho
·
Updated Nov. 06, 18 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
22.9K Views

Join the DZone community and get the full member experience.

Join For Free

One of the most common challenges in every test project is the test data management. Data is typically spread across multiple databases in today’s business world and it’s hard to manage its complexity. Working with clean data is crucial when it comes to performance testing however realistic and reliable data is hard to create.

Before you start performance testing, you should consider how to maintain the data. Performance tests are very challenging since you simulate thousands of users on your application. It requires you to consume so much data in a short period of time. It’s very hard to revert the data to its old state when you need it. So you need to come up with a good strategy to handle the data successfully.

One other thing to consider in a performance test project is the caching mechanism. When you run a test with the same data, there’s a good chance that the app will start to cache the response. So your request won’t reach the server. For this reason, we can conclude that you need a variety of data.

JMeter lets you deal with data by using CSV files. Here are some tips about CSV usages;

#1 — Try to Use the Data as Dynamic as Possible

Browsing a website, filtering data in a website are good examples. Your data is on a website or an application, you just need to use this data by using your CSS or JQuery Extractors as told in this article (https://loadium.com/using-css-selectors-in-jmeter-scripts/) and randomize your actions. If you have a pagination, determine how many pages you have and try to navigate the last ones. You will definitely bypass the caching mechanism.

#2 — Be Very Careful About Your Iteration and Data Structure

Assume you have a very strict flow as below and you add a CSV Data Set Config to it. JMeter will only run the first line of the CSV file even if you have thousands of iteration in your Thread Group.

jmeter_thread_group

Why? Because JMeter opens the file every time a new iteration starts. That’s why only the first line will be used in your test. So you need to loop through the file as below. Therefore, during the test runs, JMeter opens the file and iterates through the data. Request of consuming the data will execute different parameters.

jmeter

#3 — CSV Configuration

Your CSV Config has three configurations in it.

Recycle on EOF: In case it’s set to true when JMeter reaches the end of the file, it will go to the beginning and iterate the CSV file.

Stop Thread on EOF: Thread will stop its execution when JMeter reaches the end of the file. In case you have 20 iterations in a loop and 10 lines of data, JMeter will stop the execution at 10th request. So it will override the iteration number.

Sharing Mode: According to the configuration, you decide whether or not to allow other Thread Groups to use the CSV file.

jmeter_true_or_false


All these tips will be handy for your test execution. Happy performance testing!

CSV Test data

Published at DZone with permission of Can Ho, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Datafaker: An Alternative to Using Production Data
  • Solid Testing Strategies for Salesforce Releases
  • Apex Testing: Tips for Writing Robust Salesforce Test Methods
  • Mastering Redirects With Cloudflare Bulk Redirects

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!