Junit Jmeter无法保留线程组2所需的线程组1的变量值
我有一个关于Jmeter的场景。Junit Jmeter无法保留线程组2所需的线程组1的变量值,junit,jmeter,Junit,Jmeter,我有一个关于Jmeter的场景。 我已将Junits注入Jmeter。 Junit看起来像: public class class1 extends class2{ @org.junit.Test public void method1(){ String s; method2(); s = props.getProperty("some_Property_name"); } ------second Cla
我已将Junits注入Jmeter。
Junit看起来像:
public class class1 extends class2{
@org.junit.Test
public void method1(){
String s;
method2();
s = props.getProperty("some_Property_name");
}
------second Class -------
public class class2 {
public Properties props = new Properties();
method2(){
// props get loaded here and stores some values
}
}
我创建了=>类名为-class1、testMethod=method2的线程组1。这将加载道具。
第二:
=>使用props值的classname=class1和testMethod=method1的线程组2 当运行Jmeter时,当运行线程组2时,props为null。
有人能帮我解决这个问题吗?找到了上面Q的解决方案。我们需要在class2中将道具声明为静态,这样它只维护一个道具副本。找到了上面Q的解决方案。我们需要在class2中将道具声明为静态,这样它只维护一个道具副本。