How to write a JMeter test for Java Request -
i need load testing on in memory databases.
i want use jmeter , under impression need write class implements javasamplerclient.
i have no idea start. jmeter website has offer helps me little. first time doing , have been lost days!
so maybe can explaining basics of how class should set out? packages might need import? because whenever try tell implement javasamplerclient error.
also maybe brief summary on how works? method run many times specified in jmeter? or happening here?
to use java request in jmeter must create java class inhertit javasamler client. that,you myst dowlsoad 2 jar files , add them classpath if working eclipse. 2 jar files apachejmeter_core.jar , apachejmeter_java.jar class that:
import org.apache.jmeter.config.arguments; import org.apache.jmeter.protocol.java.sampler.abstractjavasamplerclient; import org.apache.jmeter.protocol.java.sampler.javasamplercontext; import org.apache.jmeter.samplers.sampleresult; public class javarequest extends abstractjavasamplerclient { @override public void setuptest(javasamplercontext context){ // todo auto-generated method stub super.setuptest(context); } @override public arguments getdefaultparameters() { // todo auto-generated method stub } @override public sampleresult runtest(javasamplercontext arg0) { // todo auto-generated method stub sampleresult result = new sampleresult(); boolean success = true; result.samplestart(); // write test code here. // result.sampleend(); result.setsuccessful(success); return result; } @override public void teardowntest(javasamplercontext context){ // todo auto-generated method stub driver.quit(); string verificationerrorstring = verificationerrors.tostring(); if (!"".equals(verificationerrorstring)) { fail(verificationerrorstring); system.out.println(verificationerrorstring); } super.teardowntest(context); } }
for more information can visit link http://www.javacodegeeks.com/2012/05/apache-jmeter-load-test-whatever-you.html/comment-page-1/#comment-8288 , page how use csv data set junit request test in jmeter
Comments
Post a Comment