【问题标题】:Extracting JSON and using it in if conditionExtracting JSON and using it in if condition
【发布时间】:2022-12-01 19:55:02
【问题描述】:

I need to add a condition in my thread where my next HTTP Request will execute only if the previous response has message message that says 'You can proceed with the booking.'

first response

I tried adding regular expression extractor to get MessageInfo using the below expression.

"MessageInfo": "(.*?)"

I also tried with JSON extractor using below json path expression:

$..MessageInfo

Below is the Expression that i added in if condition:

if condition

However, my execution stops after the first response and does not move into the if condition. Any help would be appreciated.

【问题讨论】:

    标签: jmeter jmeter-plugins jmeter-5.0


    【解决方案1】:

    You need to use a Function or Variable which resolves to true in the If Controller in order to be able to run its children. You're giving a string which isn't equal to true therefore If Controller's children are never run

    Therefore you need to use your expression in i.e. __jexl3() function

    ${__jexl3("${MessageInfo}"=="You can proceed with the booking.",)}
    

    More information: 6 Tips for JMeter If Controller Usage

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-27
      • 1970-01-01
      • 2022-12-28
      • 2022-12-02
      • 2017-08-20
      • 2018-09-06
      • 2022-12-01
      • 2019-10-04
      相关资源
      最近更新 更多