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 Video Library
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
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

Migrate, Modernize and Build Java Web Apps on Azure: This live workshop will cover methods to enhance Java application development workflow.

Modern Digital Website Security: Prepare to face any form of malicious web activity and enable your sites to optimally serve your customers.

Kubernetes in the Enterprise: The latest expert insights on scaling, serverless, Kubernetes-powered AI, cluster security, FinOps, and more.

A Guide to Continuous Integration and Deployment: Learn the fundamentals and understand the use of CI/CD in your apps.

Related

  • JMeter Tutorials: Test Better, Build Better
  • Understanding the Power of Coefficient of Variation in Software Performance Testing
  • Python Variables Declaration
  • Red-Black Trees in C#: A Guide to Efficient Self-Balancing Binary Search Trees

Trending

  • Building Your Own AI Chatbot With React and ChatGPT API
  • Architecture Method: C4 Model
  • The Future of Java: Virtual Threads in JDK 21 and Their Impact
  • Unlocking the Power of Streaming: Effortlessly Upload Gigabytes to AWS S3 With Node.js
  1. DZone
  2. Data Engineering
  3. Data
  4. Here’s What to Do to Combine Multiple JMeter Variables

Here’s What to Do to Combine Multiple JMeter Variables

This quick tip will walk you through building a JMeter Variable from two or more other variables.

Dmitri Tikhanski user avatar by
Dmitri Tikhanski
·
Jun. 10, 16 · Tutorial
Like (2)
Save
Tweet
Share
12.1K Views

Join the DZone community and get the full member experience.

Join For Free

Periodically when implementing advanced JMeter test scenarios, you may need to build a JMeter Variable from two or more other variables. This short post will look at how to do just that.

These test scenarios might originate from a Counter Test Element or Function, the __threadNum()function, a regular expression resulting in multiple matches or perhaps a different need.

Let’s imagine the following situation:

There are 2 JMeter Variables:

  1. myVar_1 with the value of foo
  2. myVar_2 with the value of bar

There is also a Counter test element with the reference name of counter.

The objective is to have a dynamic combined variable which consists of:

  • Prefix: myVar_
  • Postfix: ${counter} variable value that is dynamic

The solution is using the __V() function which can be used to evaluate composite variables.

The syntax is:

${__V(PREFIX${POSTFIX})}

In the case above, the resulting composite variable reference would be:

${__V(myVar_${counter})}

See how to do this in the image below.

Combining JMeter Variables


One More Hint

If you build a data-driven test and have parameters in a file that you’re reading by using the__StringFromFile() or __FileToString() functions, and the file has JMeter Variables which need to be substituted with the corresponding values in runtime - you need to use the __eval() function so that the variable value could be resolved.

use the __eval() function in JMeter

Looking for More Info on JMeter Functions?

For more information on the above and other useful JMeter Functions check out the following articles:

  • Using JMeter Functions - Part I
  • Using JMeter Functions - Part II
  • How to Use JMeter Functions - Part III

Related Refcard:

Apache JMeter

Testing Apache JMeter Build (game engine) Element POST (HTTP) Syntax (programming languages) Data Types

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

Opinions expressed by DZone contributors are their own.

Related

  • JMeter Tutorials: Test Better, Build Better
  • Understanding the Power of Coefficient of Variation in Software Performance Testing
  • Python Variables Declaration
  • Red-Black Trees in C#: A Guide to Efficient Self-Balancing Binary Search Trees

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
  • 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: