Friday, 22 November 2013

Jmeter for performance Testing

Running Soap services in Jmeter for performance testing:

Apache JMeter is an Apache project that can be used as a load testing tool for analyzing and measuring the performance of a variety of services, with a focus on web applications. 

Apache JMeter may be used to test performance both on static and dynamic resources (Files, Web dynamic languages - PHP, Java, ASP.NET, etc. -, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types. You can use it to make a graphical analysis of performance or to test your server/script/object behavior under heavy concurrent load.

Apache JMeter features include:
Ability to load and performance test many different server/protocol types:
Database via JDBC
Message-oriented middleware (MOM) via JMS
Mail - SMTP(S), POP3(S) and IMAP(S)
Native commands or shell scripts

Adding thread user in test plan 
Add >>Thread >> Thread group

>> Give thread group names
>> Number of threads [How many instances of the service file you wanted to run for performance testing]
>> Ramp up time [This is the time need to initialize all the threads in system]
>>Right click on thread group >>Add >>Sampler >>Soap XML/RPC request
>>Give name to the service in [name] box .
>>Give full url of the service for ex- [http://localhost:8181/testService]
>>Copy wsdl file content into [soap/xml-RPC Data] field

>>Save it.  [You are done]. 

>>Add a listener to view the performance of your service or program. There are varieties of listener. These 2 are good for analyzing the soap services performance. 
1) View Result tree 
2) Aggregate report 

You can add various types of result as : 
>>Right click on your newly added soap/ xml-rpc request >> add >> listener

Run the project and view the result in listener.

Returning the the node value of xml service as a variable:
you can return the xml node value into a Jmeter variable & use it at other different places by various types of postProcessors. 
For returning simple node value into a variable you can use regular expression extractor as below.
>>Right click on Soap-xml/rpc request 
>>Add >>Post Processor >> Regular expression extractor
>>Give Reference name [this will act as your variable] for ex - myVar
>>In regular expression box type <nodeName>(.*?) </nodeName>
(.*?) is a regular expression which will return any value in between <nodeName> tag.
>> In template add $1$
>>Save it.
>>Now you can use myVar at any other place as ${myVar}

Happy Learning 
Cheers !!

No comments:

Post a Comment