jmeter 计数器,Jmeter计数器功能值将显示在Benashell Post Processor或采样器中

该博客介绍了如何在JMeter的BeanShell处理器中利用__V()和__counter()函数来获取并显示变量和计数器的值。通过示例代码展示了如何将计数器的值保存到变量中,并在日志中打印出来,这对于在测试过程中跟踪和调试非常有用。
摘要由CSDN通过智能技术生成

And I would like to evaluate i.e.

${productId_1}

${productId_2}

It should be as simple as:

${__V(productId${counter})}

Same approach applies to __counter() function:

${__V(productId_${__counter(,)})}

How can I display the value in Beanshell processor/sample instead of the thread name

解决方案

This is how one can display or use the counter function value or counter in conjunction with variable

I am using this inside the Beanshell sample under the for each controller

Product = vars.get("Product_" + ${__counter(,)});

//save counter value into variable

counter = ${__counter(,)};

log.info("Counter ="+counter);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值