2

I have this structure:

enter image description here

In my Response Assertion I defined as JMeter variable this Col2

I can get the result of my query inside the listener or inside the body of my email defined in the SMTP Sampler, this way

${Col2_1} 

but I cannot use its value as condition of my IF CONTROLLER

I tried this way with no luck:

${__jexl3(${Col2_1} > 10)} 

I think I need to define a JRS233 Assertion or a Beanshell but I dont know how to pass it from response assertion to this JRS233 or Beanshell.

How can I achieve it?

Thanks

eeadev
  • 3,662
  • 8
  • 47
  • 100

1 Answers1

3

You basically have 2 options:

  1. (not recommended) untick Interpret Condition as Variable Expression
  2. (recommended) switch to __groovy() function and amend your If Controller's condition to look like:

    ${__groovy((vars.get('Col2_1') as int) > 10 ,)}
    

vars is a shorthand for JMeterVariables class, remaining code should be self-explanatory, if it isn't - check out Apache Groovy - Why and How You Should Use It guide.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • why is 1. not recommended? – eeadev Mar 26 '18 at 15:56
  • 1
    Cause [If Controller says so](https://github.com/apache/jmeter/blob/trunk/src/core/org/apache/jmeter/resources/messages.properties#L451). http://jmeter.apache.org/images/screenshots/if_controller_javascript.png. See [6 Tips for JMeter If Controller Usage](https://www.blazemeter.com/blog/six-tips-for-jmeter-if-controller-usage) guide for more detailed explanation if needed – Dmitri T Mar 26 '18 at 16:12