Skip to main content

JMeter - Beginner's Tutorial

This is a basic tutorial explains how to start with JMeter and how to use for basic load testing. Also it covers a flow which is mostly used across industries.
You can get lot of clear help here. JMeter Help

JMeter supports HTTP, HTTPS, FTP, SOAP and LDAP and it can be Integrated with selenium to do extensive use. Here are the flow to start your Load Testing.


Creating Tests:
1. First, Add Proxy (Under Workbench >> Non-Test Elements). This Proxy only acts as a recorder.
So don't forget to start the proxy before recording. Also after finished recording, stop the Proxy.


2. Add Controller. (Under Workbench >> Logic Controllers >> Simple Controller). This Controller is nothing but a container(mainly used for grouping). Inside a controller you can have your requests. ie. Transactions


3. Now record your transaction and drag it under your controller.


4. Add ThreadGroup (Under TestPlan) and group the recorded requests(or controllers) under thread group. Its for grouping set of controllers to run. ThreadGroup will contain users, ramp up and etc which are used to virtualize load while running.


5. Add listeners. (Workbench >> Listeners >> Assertions >> Comparison Assertion Visualizer). Listeners are needed to RUN, otherwise you can't view the results. Listeners are like runner here. You can select any kind of listener based on requirement.
Comparison Assertion Visualizer  -- will show results pass or fail for each request.
Save Response to File  -- will save response to external html file.


Assertions:
6. Add assertions for specified request. (Ex. Response Assertion is used to verify some text is present or not).
That's all. Now script is ready. So lets start your load test now.


Running:
1. Go to your Thread Group
2. Set No.Of. Threads(Users)Ramp Up Period and Loop Count.
3. Start Run and see the results on your listener.


Data-Driven:
We can feed data from CSV file or extract data from previous response and feed that to a request.


7. We can feed data from CSV file.
     - Just keep a CSV file with only data but not with column names.(separated by any delimiter)
     - Add "Config Element >> CSV Data Set Config"
     - Set FileName and ColumnNames (CSV contains no column names, just data. So you need to mention your column names ie.Variable Names here separed by delimiter)
     - On Request, Pass value as ${VariableName} ie. Column Names specified in above step.


8. Data Correlation ie. Extract data from previous page's response and put it as data for next request or page transaction.
    - Do "Listeners >> Save Response to file" for previous request.
    - Then find the format of expression in response for the part containing our data to be extracted.
    - Then on the request, add "Post Processors >> Regular Expression Extractor" to extract the data.
    - Set Reference Name, Expression (like productID=(.*?) ) and template as $1$ (template is used to extract multiple values. Here going to extract 1 string only. If its two values, then $1$$2$)
   - Then for the next request, set this reference name as value like ${refName}

Hope this discussion will give you some idea on how to work with JMeter !!!

Comments

  1. Thank you, Shanmugavel, for good post, it is helpfull for beginners. In addition I can share a portion of JMeter Tutorials and articles:
    http://community.blazemeter.com/knowledgebase/topics/10018-jmeter-tutorials
    http://blazemeter.com/blog

    ReplyDelete
  2. Excellent Post. Also visit http://whiteboxqa.com/#performance.php

    ReplyDelete
  3. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium

    ReplyDelete

Post a Comment

Popular posts from this blog

QTP - Object Identification - Prerequesties

While starting a new project or proof of concept or after new QTP installation, we would face the issue in identifying objects as QTP built objects like WinList, WebEdit, etc.; instead everything will be identified as WinObject.

Here are some steps to ensure you did the environment setup RIGHT before start automating.
Did you enabled required Add-ins only while launchingDid you selected "Record >> Record and Run Settings" - This should be based on what type of application you are working with
Windows app - Windows >> Record and run test on any windows applications. Web app - Web >> Record and run test on any open browser.
Did you tried to launch UFT/QTP and then AUT.If its web, ensure browser zoom level set to 100%Try disabling the protected mode in IE for web.Launch UFT and AUT using RUN AS ADMINISTRATORAlso see the Object Identification Methods if you are interested.

Change IE Browser ZOOM settings

Lot of UI automation testers could have faced this problem as we could change the zoom settings while operating manually for our convenience and forgot to reset to 100%.
But our QTP and some other related tools would operate the browser perfectly if browser zoom is 100%. So wee need to change the zoom before start to run the scripts. Its better to have a code snippet in our framework to change this zoom setting right?
Here we go...

1. We can simply change the Registry values before Invoking IE
Function ChangeRegistry Dim objShell Set objShell = CreateObject("WScript.Shell")  objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Zoom\ZoomFactor", "100000", "REG_DWORD" Set objShell = Nothing EndFunction This option is very useful. But in real time, lot of customers could have restricted write access to windows registry. So we can try other options.

2. Use IE COM object and Change Settings
Function ChangeIEZoom Dim intZoomLevel, objIE  intZoo…

QTP - Common error messages

Always I am seeing  many of my friends asking for help if any error occurs while running script in QTP without googling for help. How much troubleshooting you guys are doing will directly reflect your knowledge on the tool. I agree, no one knows each and every error occurs in the software. But we can improve our knowledge by googling and doing workarounds...
Whenever the question "How much level you know QTP?" arrows me, always I am comfortable with the answer "below 10%". But after answered, my mind will have an inner thought like, What are the things I have to learn to fulfill the answer I have told because I never used lot of features in QTP.

Here I am listing out some of the errors, situations and what might be the original issue things etc. I hope this will give you some ideas to improve your debug ability and to solve your errors. Kindly correct me If I am wrong in any point.

Type mismatch:
- Mostly doing operations with different data types without doing type co…