jmeter

Jmeter how can I use if controller to get the value of body data


How can I make my if the controller works if the previous result on the HTTP request contains a value that I expected?

HTTP Request

I need the if works if the ${Param_S07_Teamboard} on the image is == to 3 for example

I tried the 3 options below but nothing working, its ignoring my if on the results

{"key":"tdm/assets-lastSelectedTeamboard","value":"3"} == '1'

{"key":"tdm/assets-lastSelectedTeamboard","value":"3"} == {"key":"tdm/assets-lastSelectedTeamboard","value":"3"}

"{Param_S07_Teamboard}" == "3"

image 2

image 3

image 4


Solution

    1. First of all, don't post code as images.

    2. How about just comparing your Param_S07_Teamboard JMeter Variable value to 3?

    3. I also think you need to wrap the comparison into i.e. __jexl3() function as If Controller executes its child(ren) if the expression equals or evaluates to true

      ${__jexl3(${Param_S07_Teamboard}==3,)}
      
    4. If you really need to get access to the previous HTTP Request sampler body data in the If Controller it can be done using __groovy() function like:

      ${__groovy(ctx.getPreviousSampler().getArguments().getArgument(0).getValue(),)}
      

    More information: 6 Tips for JMeter If Controller Usage