如何从WebDriver Sampler(JMeter)使用JMeter Property props.get props.put [英] How to use JMeter Property props.get props.put from WebDriver Sampler (JMeter)
问题描述
我从第一个线程组创建了一些功能部件并将其放入JMeter属性:
I create some features/functions from first Thread Group and put them into a JMeter Property:
props.put("FUNCTIONS", new function());
然后,我想在其他线程组的WebDriver Sampler中调用这些功能.
Then I would like to call those features/functions in WebDriver Sampler of the other Thread Groups.
通常使用(BSF,Beanshell或JSR223),只需使用:
In normal way (BSF, Beanshell or JSR223), just using:
props.get("FUNCTIONS")
但是如何在WebDriver Sampler中执行此操作?
But how to do this in WebDriver Sampler?
这里还有与vars
相关的问题:
There is the same question related to vars
here :
有人可以帮我吗?
谢谢.
推荐答案
从熟悉Beanshell的人那里听到这样的问题有点奇怪,但是您去了:
A little bit weird to hear such a question from someone who is familiar with Beanshell, however here you go:
类似的东西:
var props = org.apache.jmeter.util.JMeterUtils.getJMeterProperties()
将为您提供对JMeter属性的读/写访问权限.
will provide you read/write access to JMeter Properties.
参考文献:
- JMeterUtils.getJMeterProperties()
- Using Java From Scripts
- The WebDriver Sampler: Your Top 10 Questions Answered
这篇关于如何从WebDriver Sampler(JMeter)使用JMeter Property props.get props.put的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!