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 !!

Saturday, 9 November 2013

Using Regular expressions in notepad++

--Using Regular expressions  in a practical life --

Hey Guys, Today i was writing a post & come with a particular problem. The problem was , I was writing 108 names of God Surya. I wrote them one by one in every new line in notepad. Later I thought I forgot to add OM as a prefix to each name. Now what to do? I can not type  each name & add one by one.

So for that I thought to use techniques of regular expression & add them in intelligent way. So what I did was, I opened that file into Notepad++ .
Then pressed Ctrl+H to open find & replace box . At the search mode, i selected the option "Regular Expression" .

Now at "Find what" box - I typed "^"  ==>This indicates beginning of each line 
and at "Replace with box" - I typed  "OM ". Finally I clicked on Replace all. 

That's it.  In one shot, i did my whole changes.  Wow it was fantastic.

Similarly,  if you have text like

and  you wanted to make  some thing like -
test: "word1"
test: "word2"
test: "word3"

All you need to do is 
Search = ^([a-Za-z0-9]+)$
Replace= test:"\1"

This is just a very simple example of using regular expression in notepad++. You can do much better things  related to matching & replacing various types of patterns by using regular expressions.

Happy Learning.. ..!!