我是靠谱客的博主 野性小土豆,最近开发中收集的这篇文章主要介绍jmeter使用if控制器_JMeter - 如何在IF控制器中使用多个条件?,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Here is my code:

In If Controller -> Condition (Default Javascript) I am providing following

"${responsecode}" == "404" || "${responsecode}" == "500" && "${responseMessage}" == "Not Found"

解决方案

Yes you can, assuming your current condition SMTP Sampler will be executed:

If ${responsecode} variable is 404

OR

If ${responsecode} variable is 500 AND ${responseMessage} variable is Not Found

I doubt that you will get Not Found message given Response Code 500, most likely you will get an Internal Server Error there so maybe you should amend your condition to look like:

"${responsecode}" == "500" || ("${responsecode}" == "404" && "${responseMessage}" == "Not Found")

In case when If Controller doesn't behave as expected first of all check jmeter.log file for any JavaScript-related errors, it will give you some clue regarding what's wrong with your setup. You can also use __javaScript() function and View Results Tree listener combination to visualize the result of your If Controller condition:

See How to Use JMeter's 'IF' Controller article for more details on conditionally running samplers via If Controller.

最后

以上就是野性小土豆为你收集整理的jmeter使用if控制器_JMeter - 如何在IF控制器中使用多个条件?的全部内容,希望文章能够帮你解决jmeter使用if控制器_JMeter - 如何在IF控制器中使用多个条件?所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(44)

评论列表共有 0 条评论

立即
投稿
返回
顶部