Close

April 28, 2013

Generate Traffic using Access Log Sampler in Jmeter

In this blog post, we will see about how to generate traffic using Access Log Sampler in Jmeter. It is not possible for every performance test engineer to generate traffic for all requests which is similar to production server. Access Log samplers in Jmeter helps test engineers to generate traffic exactly as in production.

Access Logs which resides in production web servers has all the information such as HTTP requests, images, CSS, javascripts, detailed session information etc. To enable your web server to collect access logs, you need to configure for extended log format. Please refer below links which explains to configure your web server.

Now we will see how to generate traffic using Access Log Sampler in Jmeter and how to collect all the requests using Xenu’s Link Sleuth tool.

First we will see how to collect all the requests from your website using Xenu’s Link Sleuth tool. Link Sleuth helps users to find broken links by verifying links, images, CSS, Javascript, applets etc.

Download Xenu’s Link Sleuth

Steps to find broken links and export the log

  • Install Link Sleuth from above link and launch Xenu.
  • Click on File > Check URL
  • Enter the website that you want to find broken links as shown below

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”Generate Traffic using Access Log Sampler in Jmeter ” alt=”Generate Traffic using Access Log Sampler in Jmeter – Xenu – QAInsights” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/04/Generate-Traffic-using-Access-Log-Sampler-in-Jmeter-Xenu-New-URL-QAInsights.png[/auto_thumb]

  • Click on OK
  • Xenu will track all the links in the URL you specified. Once Xenu completed its tracking, you could all the requests in GREEN color as shown below. In the status bar you could check the status of the URLs tracked.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”Generate Traffic using Access Log Sampler in Jmeter – Xenu Link Track result” alt=”Generate Traffic using Access Log Sampler in Jmeter – Xenu Link Track result – QAInsights” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/04/Generate-Traffic-using-Access-Log-Sampler-in-Jmeter-Xenu-Link-Track-result-QAInsights.png[/auto_thumb]

  • Now go to File > Export Page mode to TAB separated file… to export the result as extended log format. It will look like as shown below, if you open using Notepad++

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”Generate Traffic using Access Log Sampler in Jmeter” alt=”Generate Traffic using Access Log Sampler in Jmeter – QAInsights” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/04/Generate-Traffic-using-Access-Log-Sampler-in-Jmeter-All-the-requests-in-Notepad-QAInsights.png[/auto_thumb]

  • Remove the first line i.e. “OriginPage LinkToPage LinkToPageStatus LinkToPageTitle OriginPageDate OriginPageTitle” in the text file.
  • Now press Ctrl + H, to replace all HTTP requests format to GET format. Enter “http://<your website.com>” in Find what text box and enter “GET “ (please include double quotes and the space as well) and click on Replace All.
  • Now your log file will look as shown below.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”Generate Traffic using Access Log Sampler in Jmeter – All the requests in GET form” alt=”Generate Traffic using Access Log Sampler in Jmeter – All the requests in GET form – QAInsights” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/04/Generate-Traffic-using-Access-Log-Sampler-in-Jmeter-All-the-requests-in-GET-format-in-Notepad-QAInsights.png[/auto_thumb]

Now we will see how to use access log sampler in Jmeter to generate traffic as similar to the production log.

  • Launch Apache Jmeter, right click on Test Plan > Add > Threads (Users) > Thread Group
  • Right click on Thread Group > Add > Logic Controller > Loop Controller to add Loop controller and check Loop Forever check box
  • Right click on Loop Controller > Add > Sampler > Access Log Sampler to add Access Log sampler
  • Right click on Thread Group > Add > Listener > View Results Tree to add listeners to monitor the execution.
  • Click on Access Log Sampler and enter following details.
    • Server i.e. your website name
    • Parse Images
    • Parser
    • Filter
    • Log file location

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”Generate Traffic using Access Log Sampler in Jmeter – Jmeter Access Log Sample” alt=”Generate Traffic using Access Log Sampler in Jmeter – Jmeter Access Log Sample – QAInsights” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/04/Generate-Traffic-using-Access-Log-Sampler-in-Jmeter-Jmeter-Access-Log-Sampler-Settings-QAInsights.png[/auto_thumb]

  • Click on Run and monitor the execution using Listener as shown below.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”Generate Traffic using Access Log Sampler in Jmeter -Aggregate Report ” alt=”Generate Traffic using Access Log Sampler in Jmeter -Aggregate Report – QAInsights” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/04/Generate-Traffic-using-Access-Log-Sampler-in-Jmeter-Aggregate-Report-QAInsights.png[/auto_thumb]

PS: Click on stop to halt your execution.

Thanks for visiting QAInsights! Check out our new portal Testifications.com to get updates on Software Testing related certifications. We’re always posting interesting articles on QAInsights. I request you to subscribe so you don’t miss out anything.

Searching for QA Jobs Openings, check it at www.QAJobOpenings.com

Want to start a blog like this, please visit SpidyDomain to buy cheap web hosting and register domain.

Subscribe to our QAInsights YouTube Channel. Subscribe our free weekly newsletter or Google feeds

About NaveenKumar Namachivayam

Hi there! is a passionate and experienced Performance Test Analyst based in Chicago, USA with skill sets in Manual Testing, Test Automation, Performance Testing, and Test Estimation. He loves to learn and experiment new trends and models in Software Testing. Please stop by at his personal blogs: Excel Blog, DealsBrook, NaveenKumarN.in, and Affiliate Insights blog and Software Testing Memes.

Leave a Reply

Your email address will not be published. Required fields are marked *