문제

I have the following Setup:

| Thread Group
| -- BeanShell PreProcessor
| -- Loop Controller

In The BeanShell PreProcessor I have:

vars.put("myDynamicNumber", someDynamicallyGeneratedNumber+"");

In The Loop Controller I have:

Loop Count: ${myDynamicNumber}

I was under the impression this would work. Instead the Loop Controller cannot find the variable. Am I doing something incorrectly?

도움이 되었습니까?

해결책

You need to use Beanshell Sampler, not Beanshell Pre-Processor.

I don't know why does JMeter allow putting Beanshell Pre-Processor at the same level as loop controller, it should go as a child of i.e. HTTP Request.

I'd also suggest to slightly change your code to be:

vars.put("myDynamicNumber", String.valueOf(someDynamicallyGeneratedNumber));

Which is more correct from Beanshell perspective.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top