https://bz.apache.org/bugzilla/show_bug.cgi?id=58316
Philippe Mouawad <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO CC| |[email protected] | |om --- Comment #2 from Philippe Mouawad <[email protected]> --- Could you provide the jmeter.log file and also a simple Test Java Project that does not use your classes in JMeter plan. Currently your code does not work for me. I changed it a bit to this and it seems to work, to use it set -Djmeter.home=<path to jmeter 2.13> public static void main(String[] argv) throws Exception { File jmeterHome = new File(System.getProperty("jmeter.home")); String slash = System.getProperty("file.separator"); if (jmeterHome.exists()) { File jmeterProperties = new File(jmeterHome.getPath() + slash + "bin" + slash + "jmeter.properties"); if (jmeterProperties.exists()) { StandardJMeterEngine jm = new StandardJMeterEngine(); // jmeter.properties JMeterUtils.setJMeterHome(jmeterHome.getPath()); JMeterUtils.loadJMeterProperties(jmeterProperties.getPath()); JMeterUtils.initLogging();// you can comment this line out to see extra log messages of i.e. DEBUG level JMeterUtils.initLocale(); System.out.println("Jmeter Home : "+JMeterUtils.getJMeterHome()); System.out.println("Jmeter Bin : "+JMeterUtils.getJMeterBinDir()); String[] s= JMeterUtils.getSearchPaths(); for(String s1 : JMeterUtils.getSearchPaths()) { System.out.println("Search Path = "+s1); } HashTree testPlanTree = new HashTree(); // HTTP Sampler /* HTTPSampler httpSampler = new HTTPSampler(); httpSampler.setDomain("www.google.com"); httpSampler.setPort(80); httpSampler.setPath("/"); httpSampler.setMethod("GET"); */ JUnitSampler junitSampler = new JUnitSampler(); junitSampler.setClassname("Ratable.Service.RestAssuredTests"); junitSampler.setMethod("testFindUsingGroovyClosure"); // Loop Controller TestElement loopCtrl = new LoopController(); ((LoopController)loopCtrl).setLoops(1); ((LoopController)loopCtrl).addTestElement(junitSampler); ((LoopController)loopCtrl).setFirst(true); // Thread Group SetupThreadGroup threadGroup = new SetupThreadGroup(); threadGroup.setNumThreads(1); threadGroup.setRampUp(1); threadGroup.setSamplerController((LoopController)loopCtrl); // Test plan TestPlan testPlan = new TestPlan("MY TEST PLAN"); testPlan.setProperty(TestElement.TEST_CLASS, TestPlan.class.getName()); testPlan.setProperty(TestElement.GUI_CLASS, TestPlanGui.class.getName()); testPlan.setUserDefinedVariables((Arguments) new ArgumentsPanel().createTestElement()); testPlanTree.add( testPlan); HashTree threadGroupHashTree = testPlanTree.add(testPlan, threadGroup); HashTree ht = threadGroupHashTree.add( loopCtrl); //testPlanTree.add("threadGroup", threadGroup); ht.add( junitSampler); //log results Summariser summer = null; String summariserName = JMeterUtils.getPropDefault("summariser.name", "summary");//$NON-NLS-1$ if (summariserName.length() > 0) { summer = new Summariser(summariserName); } String logFile = "/data/jmeter/jmeters/outfile.jtl"; ResultCollector logger = new ResultCollector(summer); logger.setFilename(logFile); testPlanTree.add(testPlanTree.getArray()[0], logger); jm.configure(testPlanTree); jm.run(); System.exit(0); } } System.err.println("jmeter.home property is not set or pointing to incorrect location"); System.exit(1); } -- You are receiving this mail because: You are the assignee for the bug.
