JMeter - Variable

Card Puncher Data Processing

About

Variable are used to parametrize a test plan.

Scope

JMeter variables have thread scope. This is deliberate, so that threads can act independently.

Variables

Before the test start

Variables Definition

You can define an initial set of variables within:

Jmeter Test Plan Variable

All the UDV elements in a test plan - no matter where they are - are processed at the start.

User variables per Thread

Some test plans need to use different values for different users/threads.

For example, you might want to test a sequence that requires a unique login for each user.

  • Create a text file containing the user names and passwords, separated by commas.
  • Add a CSV DataSet configuration element to the test plan under a thread group
  • Give a name to the USER and PASSWORD variables in the variable name field.
  • Set the sharing mode to “All Threads”. The CSV Data Set element will read a new line for each thread.
  • Replace the login name and password on the appropriate samplers with the appropriate name variables.

Jmeter Different User Login By Thread

Command Line

You can change the values of variable on the command-line only by using a property.

After the test start

Passing variable between thread

To pass variable between thread when the value is not known until the test starts, you may use:

  • A property: Properties are shared between all JMeter threads, so if one thread sets a property , another thread can read the updated value.
  • A File: Write variables to a file and re-read them. For example you could use the Save Responses to a file listener or perhaps a BeanShell PostProcessor in one thread, and read the file using the HTTP Sampler “file:” protocol, and extract the information using a PostProcessor or BeanShell element.
  • (and write) your own Java classes

Documentation / Reference





Discover More
Jmeter Sampler Result In A View Result Tree
JMeter - (Sampler Result | Sample | Listener (Output|Results|Data) File)

The results of a sample are showed by a listener in different ways: a tree, tables, graphs response data) All listeners write the same raw data to the output file when one is specified. ...
Jmeter Debug Sampler
JMeter - Debug (Sampler)

To test quickly a test plan component, add: your component to test a Debug Sampler and a Tree View Listener You will get information on: JMeter variable JMeter property system property...
Jmeter Classpath
JMeter - JDBC Request

Basic information on the JDBC Request. In the Test Plan Node, You can add you JDBC Driver or in the directory Jmeter_Home/lib Simple Test Plan: A Thread Group A A JmComp>#JDBC Connection...
Jmeter Save Response To A File
JMeter - Save Response to File Listener

For each sample in its scope, the “Save Response to File” listener will create a file of the response Data. where: Variable Name saves the file name of the response output filelistener result...
Card Puncher Data Processing
JMeter - Test Plan (JMX file)

A test plan describes a series of steps JMeter will execute when run. A test plan will consist of one or more: Thread Groups, Logic controllers, Sample generating controllers, pre-processor...
Card Puncher Data Processing
Jmeter - BeanShell

Beanshell script in JMeter You will see this message in the log The errors are not shown in a View Result Tree. You have to check the log instead. Example of errors in the log file:...



Share this page:
Follow us:
Task Runner