Hi, Could someone please help take a look, or provide any pointers/clues for this non-GUI remote testing issue? Appreciate the help!
Thanks, Alex > On Dec 2, 2018, at 4:57 PM, Alex Shao <[email protected]> wrote: > > Hi, > > I’m using Jmeter 4.0 and trying to use the remote testing feature, with the > remote slave being ready (using same 4.0 version as master; firewall turned > off; ./bin/jmeter-server started). > > When master driver program triggers the test, I can see the slave console > showing starts and finishes the test, however master driver program just > hangs there. Not sure what is causing this, could someone give me any pointer? > > My JAVA driver code: > > ClientJMeterEngine jmeter = new ClientJMeterEngine(REMOTE_HOST_ADDR); > > HashTree testPlanTree = new HashTree(); > > Map<String, Integer> testClassMap = getAllTestClasses(); > //logic to form the core test plan tree > addLoadTestToTestPlan(testPlanTree, testClassMap, SAMPLE_SLEEP_TIME); > > SaveService.saveTree(testPlanTree, new FileOutputStream(TEST_PLAN)); > > Summariser summer = null; > String summariserName = JMeterUtils.getPropDefault("summariser.name", > "summary"); > if (summariserName.length() > 0) { > summer = new Summariser(summariserName); > } > > // Store execution results into a .jtl file > ResultCollector logger = new ResultCollector(summer); > logger.setFilename(REPORT_FILE); > testPlanTree.add(testPlanTree.getArray()[0], logger); > > // Run Test Plan > jmeter.configure(testPlanTree); > jmeter.runTest(); > > The trivial test class which implements JavaSamplerClient doesn’t really do > much in the runTest() logic (no logic in setup/tearDown): > public SampleResult runTest(JavaSamplerContext context) { > SampleResult result = new SampleResult(); > result.sampleStart(); > > try { > result.sampleEnd(); > result.setSuccessful(true); > result.setResponseMessage("test success from host: " + > InetAddress.getLocalHost().getHostName()); > } catch (Exception ex) {} > > return result; > } > > The test plan imx file generated is as follows: > > <?xml version="1.0" encoding="UTF-8"?> > <jmeterTestPlan version="1.2" properties="4.0" jmeter="4.0 r1823414"> > <org.apache.jorphan.collections.HashTree> > <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Java Load > Test Plan"> > <elementProp name="TestPlan.user_defined_variables" > elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" > testname="User Defined Variables" enabled="true"> > <collectionProp name="Arguments.arguments"/> > </elementProp> > </TestPlan> > <org.apache.jorphan.collections.HashTree> > <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" > testname="Thread Group"> > <intProp name="ThreadGroup.num_threads">2</intProp> > <intProp name="ThreadGroup.ramp_time">2</intProp> > <elementProp name="ThreadGroup.main_controller" > elementType="LoopController" guiclass="LoopControlPanel" > testclass="LoopController"> > <boolProp name="LoopController.continue_forever">false</boolProp> > <intProp name="LoopController.loops">1</intProp> > </elementProp> > </ThreadGroup> > <org.apache.jorphan.collections.HashTree> > <JavaSampler guiclass="JavaTestSamplerGui" testclass="JavaSampler" > testname="Jmeter_LoadTest_DummyTest"> > <elementProp name="arguments" elementType="Arguments"> > <collectionProp name="Arguments.arguments"> > <elementProp name="SleepTime" elementType="Argument"> > <stringProp name="Argument.name">SleepTime</stringProp> > <stringProp name="Argument.value">1000</stringProp> > </elementProp> > </collectionProp> > </elementProp> > <stringProp name="classname">DummyTest</stringProp> > </JavaSampler> > <org.apache.jorphan.collections.HashTree/> > </org.apache.jorphan.collections.HashTree> > </org.apache.jorphan.collections.HashTree> > </org.apache.jorphan.collections.HashTree> > </jmeterTestPlan> > > > Appreciate any help! > > Thanks, > Alex > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
