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
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
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
  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.

Can Ho user avatar by
Can Ho
·
Nov. 06, 18 · Tutorial
Like (1)
Save
Tweet
Share
21.18K 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.

Popular on DZone

  • Kubernetes vs Docker: Differences Explained
  • How To Check Docker Images for Vulnerabilities
  • ChatGPT Prompts for Agile Practitioners
  • Top 10 Secure Coding Practices Every Developer Should Know

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: