1
votes

I am new to JMeter and it maybe a stupid question but I still find it hard to understand the concept here.

I have a simple test.

  1. Thread Group with a Single thread with loop count of 2
  2. PreProcessor that place two variables on the vars map
  3. A loop that execute a request twice based on the PreProcessor parameters

I expected that the preprocessor will initialize the parameter and it will use the same values twice in the request.

It looks like it’s executing the PreProcessor once pair call.

When I switch the PreProcessor with similar User Defined Variables it reuses the same value on every call.

Can anyone explain the logic here?

enter image description here I am using JMeter 2.11

2

2 Answers

1
votes

A PreProcessor is executed each time the HTTP Request is executed so if you have a total of 2 iterations, you should see log twice, you have it 4 times so maybe number of iteration is different than what your write or you have 2 threads.

When you use User Defined Variables, the value is computed once and then reused. Value will be different per thread.

1
votes

After reading the documentations and with #UBIK LOAD PACK help I used User Variables and it worked enter image description hereUser Variables - are specific to individual threads.

Pre-Processor is attached to a Sampler element (e.g. http request in our case), then it will execute just prior to that sampler element running So 4 request for different parameters because it runs before every request

User Defined Variables - It is processed at the start of a test, no matter where it is placed. For simplicity, it is suggested that the element is placed only at the start of a Thread Group. This is why I get the same value all the time