本文整理汇总了Java中org.apache.jmeter.testelement.TestPlan.setFunctionalMode方法的典型用法代码示例。如果您正苦于以下问题:Java TestPlan.setFunctionalMode方法的具体用法?Java TestPlan.setFunctionalMode怎么用?Java TestPlan.setFunctionalMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jmeter.testelement.TestPlan
的用法示例。
在下文中一共展示了TestPlan.setFunctionalMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTestPlan
import org.apache.jmeter.testelement.TestPlan; //导入方法依赖的package包/类
public TestPlan getTestPlan() {
TestPlan testPlan = new TestPlan();
testPlan.setProperty(TestElement.TEST_CLASS, TestPlan.class.getName());
testPlan.setProperty(TestElement.GUI_CLASS, TestPlanGui.class.getName());
testPlan.setProperty(TestElement.ENABLED, true);
testPlan.setFunctionalMode(false);
testPlan.setSerialized(true);
Arguments arguments = new Arguments();
arguments.setProperty(TestElement.GUI_CLASS, "org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel");
arguments.setProperty(TestElement.TEST_CLASS, "org.apache.jmeter.config.Arguments");
arguments.setName("User Defined Variables");
arguments.setProperty(TestElement.ENABLED, true);
testPlan.setUserDefinedVariables(arguments);
testPlan.setTestPlanClasspath("");
return testPlan;
}
示例2: addSubTree
import org.apache.jmeter.testelement.TestPlan; //导入方法依赖的package包/类
/**
* Adds the sub tree at the given node. Returns a boolean indicating whether
* the added sub tree was a full test plan.
*/
public HashTree addSubTree(HashTree subTree, JMeterTreeNode current) throws IllegalUserActionException {
Iterator<Object> iter = subTree.list().iterator();
while (iter.hasNext()) {
TestElement item = (TestElement) iter.next();
if (item instanceof TestPlan) {
TestPlan tp = (TestPlan) item;
current = (JMeterTreeNode) ((JMeterTreeNode) getRoot()).getChildAt(0);
final TestPlan userObject = (TestPlan) current.getUserObject();
userObject.addTestElement(item);
userObject.setName(item.getName());
userObject.setFunctionalMode(tp.isFunctionalMode());
userObject.setSerialized(tp.isSerialized());
addSubTree(subTree.getTree(item), current);
} else if (item instanceof WorkBench) {
current = (JMeterTreeNode) ((JMeterTreeNode) getRoot()).getChildAt(1);
final TestElement testElement = ((TestElement) current.getUserObject());
testElement.addTestElement(item);
testElement.setName(item.getName());
addSubTree(subTree.getTree(item), current);
} else {
addSubTree(subTree.getTree(item), addComponent(item, current));
}
}
return getCurrentSubTree(current);
}
示例3: modifyTestElement
import org.apache.jmeter.testelement.TestPlan; //导入方法依赖的package包/类
@Override
public void modifyTestElement(TestElement plan) {
super.configureTestElement(plan);
if (plan instanceof TestPlan) {
TestPlan tp = (TestPlan) plan;
tp.setFunctionalMode(functionalMode.isSelected());
tp.setTearDownOnShutdown(tearDownOnShutdown.isSelected());
tp.setSerialized(serializedMode.isSelected());
tp.setUserDefinedVariables((Arguments) argsPanel.createTestElement());
tp.setTestPlanClasspathArray(browseJar.getFiles());
}
}
示例4: main
import org.apache.jmeter.testelement.TestPlan; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
JMeterUtils.setJMeterHome("src/test/resources/");
JMeterUtils.loadJMeterProperties("src/test/resources/jmeter.properties");
JMeterUtils.setProperty("saveservice_properties", "saveservice.properties");
JMeterUtils.setProperty("search_paths", "ApacheJMeter_functions-2.9.jar");
JMeterUtils.setLocale(Locale.JAPAN);
JMeterEngine engine = new StandardJMeterEngine();
HashTree config = new ListedHashTree();
TestPlan testPlan = new TestPlan("websocket test");
testPlan.setFunctionalMode(false);
testPlan.setSerialized(false);
testPlan.setProperty(new BooleanProperty(TestElement.ENABLED, true));
testPlan.setUserDefinedVariables(new Arguments());
ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setNumThreads(300);
threadGroup.setRampUp(20);
threadGroup.setDelay(0);
threadGroup.setDuration(0);
threadGroup.setProperty(new StringProperty(ThreadGroup.ON_SAMPLE_ERROR, "continue"));
threadGroup.setScheduler(false);
threadGroup.setName("Group1");
threadGroup.setProperty(new BooleanProperty(TestElement.ENABLED, true));
LoopController controller = new LoopController();
controller.setLoops(10);
controller.setContinueForever(false);
controller.setProperty(new BooleanProperty(TestElement.ENABLED, true));
threadGroup.setProperty(new TestElementProperty(ThreadGroup.MAIN_CONTROLLER, controller));
CSVDataSet csvDataSet = new CSVDataSet();
csvDataSet.setProperty(new StringProperty("filename", "src/test/resources/users.csv"));
csvDataSet.setProperty(new StringProperty("variableNames", "USER_NAME"));
csvDataSet.setProperty(new StringProperty("delimiter", ","));
csvDataSet.setProperty(new StringProperty("shareMode", "shareMode.all"));
csvDataSet.setProperty("quoted", false);
csvDataSet.setProperty("recycle", true);
csvDataSet.setProperty("stopThread", false);
WebSocketSampler sampler = new WebSocketSampler();
sampler.setName("WebSocket Test");
sampler.setProperty(new BooleanProperty(TestElement.ENABLED, true));
sampler.addNonEncodedArgument("name", "${USER_NAME}", "=");
sampler.setContentEncoding("UTF-8");
sampler.setProtocol("ws");
sampler.setDomain("localhost");
sampler.setPort(9090);
sampler.setPath("/", "UTF-8");
sampler.setSendMessage("${__RandomString(50,ABCDEFGHIJKLMNOPQRSTUVWXYZ)}");
sampler.setRecvMessage("\"name\":\"${USER_NAME}\"");
OnceOnlyController onceOnlyController = new OnceOnlyController();
Summariser summariser = new Summariser();
HashTree tpConfig = config.add(testPlan);
HashTree tgConfig = tpConfig.add(threadGroup);
HashTree oocConfig = tgConfig.add(onceOnlyController);
oocConfig.add(csvDataSet);
UniformRandomTimer randomTimer = new UniformRandomTimer();
randomTimer.setRange(3000);
HashTree samplerConfig = tgConfig.add(sampler);
samplerConfig.add(summariser);
tgConfig.add(randomTimer);
engine.configure(config);
engine.runTest();
}