jmeter Hi All.. I am new to JMeter.. I need to run Java program(.java or...

  • perf-test.com need your contributions to build up a strong repository of performance engineering resources.

S

Srinu Srinu

Guest
Hi All.. I am new to JMeter.. I need to run Java program(.java or .jar) with JMeter for load test. Is it possible with JMeter..!.. If it possible can any one help me how to do?
 
JMeter sends HTTP requests to a web server with multiple users and with various parameters. It is used to load test the server, usually when you start JMeter your HTTP server needs to be up already. I think you are searching for something like VisualVM (builtin to JDK), or JProfiler and YourKit (both are proprietary but have more features than VisualVM).
 
yeah it's possible, you have to import it as classpath. Use JSR233BeanShell PreProcessor like next: addClassPath("C:/JMeter/apache-jmeter-2.12/lib/ext/Calculate.jar");//path to .jar directory import calculate; //import package import java.util.Random; import java.util.Iterator; import java.util.List; import java.util.ArrayList; //debug(); calculate.Calculate cal = new calculate.Calculate();//create new instance int ret = cal.CalcSum(22,4); vars.put("SUM",Integer.toString(ret)); log.info(ret.toString()); //String retval = getClassPath(); myStuff = object(); myStuff.foo = 42; myStuff.bar = "blah"; log.info(myStuff.bar.toString()); ArrayList strList = new ArrayList(); strList = (ArrayList) cal.retList(); System.out.println("first item of list "+ strList.get(0)); log.info(strList.get(0)); for (int i=0;i < strList.size();i++) { System.out.println("item of list "+ strList.get(i)); } vars.put("ITEM1",strList.get(0)); vars.put("ITEM2",strList.get(1)); vars.put("ITEM3",strList.get(2)); String r = cal.retStr(); System.out.println("Returned class variable "+r);