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

Popular posts from this blog

Some good Resources / Blogs / Sites for Selenium Users

Here I have listed out some good blogs and sites by extensive selenium automation users. Hope these will help you a lot. http://automationtricks.blogspot.com  - by NirajKumar http://www.theautomatedtester.co.uk/ http://testerinyou.blogspot.com   - by Naga/Mathu http://seleniumready.blogspot.com  - by Farheen Khan http://seleniumdeal.blogspot.com/  - Amit Vibhuti http://seleniumexamples.com/blog Sauce Labs and BrowserMob are companies doing cloud and extensive selenium automation services, products, etc http://saucelabs.com/blog http://blog.browsermob.com http://testingbot.com/ Cedric Beust -  creator of the TestNG Java testing framework. http://beust.com/weblog/ http://blog.reallysimplethoughts.com/  - by Samit Badle, Created many Selenium IDE Plug-Ins Available Colud Testing: 1. SauceLabs 2. Soasta 3. BrowserMob 4. CloudTesting.com  etc. Selenium Testing Products: 1. Twist by ThoughtWorks 2.  TestMaker by...

UFT - Take full page screenshot by scrolling the page

'######################################################################################## 'This is navigate through the full page and taking individual screenshot of visible area '######################################################################################## Function TakeScreenshot Dim intScrolls, intScroll, strScrollPos Set pgApp = Browser ( " " ) .Page ( " " ) intScrolls = Round ( pgApp . RunScript ( " document.documentElement.scrollHeight / (screen.height) " ) , 2 ) If intScrolls < 1 Then intScrolls = - 1 pgApp . RunScript " window.scrollTo(0, 0); " Wait 1 Browser ( " " ) .CaptureBitmap " C:\screenshot0.png " , True For intScroll = 0 To intScrolls If Environment . Value ( " Browser " ) = " CHROME " Then strScrollPos = " scrollY " Else strScrollPos = " document.documentElement.scrollTop " End If If p...

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 End   Function This option is very useful. But in real time, lot of customers could have restricted write access to windows registry. So we can try othe...