10yei
10yei

Reputation: 161

If Controller used with PreProcessor

In a Simple Controller I put a JDBC PreProcessor and an If Controller for the purpose of the If Controller should use the PreProcessor's result. Because of the precedence of the elements, the controller interprets before the PreProcessor and can not evaluate the excepted value.

How can I force that the PreProcessor goes before the Controller?

In other words how can I run or skip a sample depending of dynamic precondition?

Thanks!

Upvotes: 4

Views: 2335

Answers (1)

10yei
10yei

Reputation: 161

I found out the reason and the solution. The PreProcessors belong to Samplers. But (this was not described) they are evaluating only DIRECTLY BEFORE the Sampler. After the evaluation other Samplers and Controllers can use the results of the PreProcessors.

In my case I used first the PreProcessor, next the Conroller with a child Sampler. In this situation the PreProcessor was not evaluated at the proper time, because there was no Sampler before the Controller:

1. PreProcessor
2. Controller (can't use the PreProcessor's result)
  2.1. Sampler

Solution

If any Sampler precedes the Controller, the PreProcessor will be evaluated before the Controller. One Sampler (e.g. Test Action, Debug Sampler, or any "Do-nothing" Sampler) must be between the PreProcessor and the Controller. In this case the running order is what expected:

1. PreProcessor
2. Sampler (can use the PreProcessor's result)
3. Controller (can use the PreProcessor's result)

Upvotes: 8

Related Questions