JMeter“如果控制器"带参数? [英] JMeter "if controller" with parameters?

查看:16
本文介绍了JMeter“如果控制器"带参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读 JMeter 文档 并发现了这个信息框关于如果控制器":

I was reading the JMeter documentation and came across this info box about "If Controllers":

当条件被解释为 Javascript 时,没有变量可用于脚本.如果您需要访问此类变量,请选择将条件解释为变量表达式?"并使用 __javaScript() 函数调用.然后您可以在脚本中使用对象vars"、log"、ctx"等.

No variables are made available to the script when the condition is interpreted as Javascript. If you need access to such variables, then select "Interpret Condition as Variable Expression?" and use a __javaScript() function call. You can then use the objects "vars", "log", "ctx" etc. in the script.

我不太了解这个.这是否意味着如果我想访问用户定义的参数",那么我只能通过编写一些 JavaScript 来访问它?此框后面的示例然后引用${COUNT}"

I don't quite follow this. Does this mean if I want access to a "User Defined Parameter" then I can access it only by writing some JavaScript? The example that follows this box then refers to "${COUNT}"

有人可以用一两个例子来阐明 If 控制器的用法吗?

Could someone clarify the usage of the If Controller, maybe with an example or two?

推荐答案

你可以简单地使用类似

${my_variable}=='1'

有时 JMeter 文档可能会令人困惑:)

Sometimes JMeter documentation can be confusing :)

2017 年 9 月 27 日

此处的答案有效,但当线程数超过 40 时,会对性能产生非常糟糕的影响.

有关正确且表现最佳的答案,请参见下文:

See below for correct and most performing answer:

见:

这篇关于JMeter“如果控制器"带参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆