Java Code Examples for org.apache.jmeter.threads.ThreadGroup#setProperty()
The following examples show how to use
org.apache.jmeter.threads.ThreadGroup#setProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmxThreadGroup.java From postman2jmx with MIT License | 6 votes |
public static ThreadGroup newInstance(LoopController loopController) { ThreadGroup threadGroup = new ThreadGroup(); threadGroup.setProperty(TestElement.TEST_CLASS, ThreadGroup.class.getName()); threadGroup.setProperty(TestElement.GUI_CLASS, ThreadGroupGui.class.getName()); threadGroup.setName("Http URL/API Test"); threadGroup.setEnabled(true); threadGroup.setSamplerController(loopController); threadGroup.setNumThreads(1); threadGroup.setRampUp(1); threadGroup.setScheduler(false); threadGroup.setDuration(0); threadGroup.setDelay(0); threadGroup.setComment(""); threadGroup.setProperty(ThreadGroup.ON_SAMPLE_ERROR, "continue"); return threadGroup; }
Example 2
Source File: JmeterTestPlanTask.java From ambari-metrics with Apache License 2.0 | 5 votes |
private ThreadGroup createThreadGroup(String name, int numThreads, int rampUp, LoopController loopController) { ThreadGroup threadGroup = new ThreadGroup(); threadGroup.setName(name); threadGroup.setNumThreads(numThreads); threadGroup.setRampUp(rampUp); threadGroup.setSamplerController(loopController); threadGroup.setProperty(TestElement.TEST_CLASS, ThreadGroup.class.getName()); return threadGroup; }
Example 3
Source File: WebSocketSamplerTest.java From jmeter-websocket with Apache License 2.0 | 4 votes |
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(); }