SlideShare ist ein Scribd-Unternehmen logo
1 von 7
Downloaden Sie, um offline zu lesen
TARUN ARORA

            Website




 Tarun Arora is a Microsoft Certified professional developer for Enterprise Applications. He has extensively travelled around the
 world gaining experience learning and working in culturally diverse teams. Tarun has over 5 years of experience developing
 'Energy Trading & Risk Management' solutions for leading Trading & Banking Enterprises. His passion for technology has earned
 him the Microsoft Community Contributor and Microsoft MVP Award.


 MY RECENT POSTS

 How to undelete files in TFS

 Quartz.Net Windows Service Configure Logging

 Quartz.Net Writing your first Hello World Job

 Install Quartz.Net as a windows service and Test installation

 Webmatrix The Site has Stopped Fix


 MY OTHER POSTS

 TFS API Change WorkItem CreatedDate And ChangedDate To Historic Dates

 New features in TFS Demo Setup 1.0.0.2

 TFS API Add Favorites programmatically

 IntelliTrace collector error Some or all identity references could not be translated

 Get your TFS 2012 task board demo ready in under 1 minute

 Set up a TFS Server/Service demo environment in less than 1 minute now!

 Geeks with Blogs acquired by Watson Technology Group

 Pizza and IntelliTrace at NextGenUG on 16 and 23 October 2012

 VS2012 Launch Event – Combating Bugs And Poor Performance In Production

 VS2012 Coded UI Test closes browser by default
 TEST




  Tarun Arora
  Visual Studio ALM MVP


<< Visual Studio Load Testing using Windows Azure | Home | Where did I write that code ? >>

Using IIS Logs for Performance Testing with Visual Studio
                                                                                                                                              share:               Comment



In this blog post I’ll show you how you can play back the IIS Logs in Visual Studio to automatically generate the web performance tests. You can also download
the sample solution I am demo-ing in the blog post.

Introduction
Performance testing is as important for new websites as it is for evolving websites. If you already have your website running in production you could mine the
                                              information available in IIS logs to analyse the dense zones (most used pages) and performance test those
                                              pages rather than wasting time testing & tuning the least used pages in your application.

                                                          What are IIS Logs
                                                          To help with server use and analysis, IIS is integrated with several types of log files. These log file formats
                                                          provide information on a range of websites and specific statistics, including Internet Protocol (IP) addresses,
                                                          user information and site visits as well as dates, times and queries. If you are using IIS 7 and above you will
                                                          find the log files in the following directory C:InterpubLogs
Walkthrough

1. Download and Install Log Parser from the Microsoft download Centre. You should see the LogParser.dll in the install folder, the default install location is
C:Program Files (x86)Log Parser 2.2. LogParser.dll gives us a library to query the iis log files programmatically. By the way if you haven’t used Log Parser in
the past, it is a is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key
data sources on the Windows operating system such as the Event Log, the Registry, the file system, and Active Directory. More details…
2. Create a new test project in Visual Studio. Let’s call it IISLogsToWebPerfTestDemo.




3. Delete the UnitTest1.cs class that gets created by default. Right click the solution and add a project of type class library, name it,
IISLogsToWebPerfTestEngine. Delete the default class Program.cs that gets created with the project.




4. Under the IISLogsToWebPerfTestEngine project add a reference to




   Microsoft.VisualStudio.QualityTools.WebTestFramework – c:Program Files (x86)Microsoft Visual Studio
   10.0Common7IDEPublicAssembliesMicrosoft.VisualStudio.QualityTools.WebTestFramework.dll
   LogParser also called MSUtil - c:userstaroradocumentsvisual studio
   2010ProjectsIisLogsToWebPerfTestIisLogsToWebPerfTestEngineobjDebugInterop.MSUtil.dll
5. Right click IISLogsToWebPerfTestEngine project and add a new classes – IISLogReader.cs
The IISLogReader class queries the iis logs using the log parser.

 uigSse;
 sn ytm
 uigSse.olcin.eei;
 sn ytmCletosGnrc
 uigSse.et
 sn ytmTx;
 uigMUi;
 sn Stl
 uigLgur =MUi.oQeylsCas
 sn oQey   StlLgurCasls;
 uigISoIptomt=MUi.OIS3IptotxCasls;
 sn ILgnuFra  StlCMIWCnuCnetlsCas
 uigLgeode =MUi.Lgeode;
 sn oRcrSt  StlIoRcrst
uigMcootVsaSui.etol.eTsig
 sn irsf.iultdoTsTosWbetn;
 uigSse.igotc;
 sn ytmDansis


 nmsaeIsosoePrTsEgn
 aepc iLgTWbefetnie
 {
     / B mkn ueo lgpre i i psil t qeyteislguigslc qeis
      / y aig s f o asr t s osbe o ur h i o sn eet ure


     pbi casISoRae
      ulc ls ILgedr
     {
          piaesrn _iLgah
           rvt tig isoPt;


          pbi ISoRae(tigisoPt)
           ulc ILgedrsrn iLgah
          {
              _iLgah=isoPt;
               isoPt iLgah
          }


          pbi InmrbeWbeteus>Gteuss)
           ulc Eueal<eTsRqet eRqet(
          {
              Lgur lgur =nwLgur(;
               oQey oQey e oQey)
              ISoIptomtisnuFra =nwISoIptomt)
               ILgnuFra iIptomt  e ILgnuFra(;


              / cretyteeclmsgv u sfin ifraint cntuttewbts rqet
               / urnl hs oun ie s ufet nomto o osrc h e et euss


              srn qey=@SLC si,spr,c-ehd c-r-tm c-r-ur FO "+_iLgah
               tig ur  "EET -p -ot smto, suise, suiqey RM  isoPt;


              Lgeode rcrSt=lgur.xct(ur,isnuFra)
               oRcrSt eode  oQeyEeueqey iIptomt;


              / Apyabto tasomto
               / pl  i f rnfrain
              wie(rcrStaEd)
               hl !eode.tn()
              {
                  IoRcr rcr =rcrStgteod)
                  Lgeod eod   eode.eRcr(;
                  i (eodgtauE(c-ehd)TSrn( = "E"
                   f rcr.eVlex"smto".otig) = GT)
                  {
                      srn sre =rcr.eVlex"-p)TSrn(;
                       tig evr  eodgtauE(si".otig)
                      srn pt =rcr.eVlex"suise".otig)
                       tig ah  eodgtauE(c-r-tm)TSrn(;
                      srn qeytig=rcr.eVlex"suiqey)TSrn(;
                       tig ursrn  eodgtauE(c-r-ur".otig)


                      SrnBidrulule =nwSrnBidr)
                       tigule rBidr  e tigule(;
                      ulule.ped"tp/";
                       rBidrApn(ht:/)
                      ulule.pedsre)
                       rBidrApn(evr;
                      ulule.pedpt)
                       rBidrApn(ah;
                      i (Srn.sulrmt(ursrn)
                       f !tigINlOEpyqeytig)
                      {
                           ulule.ped"";
                           rBidrApn(?)
                           ulule.pedqeytig;
                           rBidrApn(ursrn)
                      }


                      / Yucudmk sbtttosb itouigprmtrzdwbtss
                       / o ol ae usiuin y nrdcn aaeeie e et.
                      Wbeteus rqet=nwWbeteus(rBidrTSrn()
                       eTsRqet eus  e eTsRqetulule.otig);
                      DbgWieierqetUlihurSrn)
                       eu.rtLn(eus.rWtQeytig;
                      yedrtr rqet
                       il eun eus;
                  }


                  rcrStmvNx(;
                  eode.oeet)
              }


              CnoeWieie"Ta' i!Coigterae";
               osl.rtLn( hts t lsn h edr)
              rcrStcoe)
               eode.ls(;
          }
     }
 }




6. Connect the dots by adding the project reference ‘IisLogsToWebPerfTestEngine’ to ‘IisLogsToWebPerfTest’. Right click the ‘IisLogsToWebPerfTest’ project
and add a new class ‘WebTest1Coded.cs’
The WebTest1Coded.cs inherits from the WebTest class. By overriding the GetRequestMethod we can inject the log files to the IISLogReader class which uses
Log parser to query the log file and extract the web requests to generate the web test request which is yielded back for play back when the test is run.

 nmsaeIsosoePrTs
 aepc iLgTWbefet
 {
     uigSse;
      sn ytm
     uigSse.olcin.eei;
      sn ytmCletosGnrc
     uigSse.et
      sn ytmTx;
     uigMcootVsaSui.etol.eTsig
      sn irsf.iultdoTsTosWbetn;
     uigMcootVsaSui.etol.eTsigRls
      sn irsf.iultdoTsTosWbetn.ue;
     uigIsosoePrTsEgn;
      sn iLgTWbefetnie


     / Ti casi acddwbpromnets ipeetto,ta sml pse
      / hs ls s  oe e efrac et mlmnain ht ipy ass
     / tept o teislg t teIsoRae caswihde tehay
      / h ah f h i os o h iLgedr ls hc os h ev
     / lfigo raigtecnet o telgfl adcnetn te t tss
      / itn f edn h otns f h o ie n ovrig hm o et.


     / Yucudhv mlil sc cassta ihrtfo Wbetadipeet
      / o ol ae utpe uh lse ht nei rm eTs n mlmn
     / GteusEueao Mto adps dfen lgflsfrdfeettss
      / eRqetnmrtr ehd n as ifrt o ie o ifrn et.
     pbi casWbetCdd:Wbet
      ulc ls eTs1oe  eTs
     {
          pbi WbetCdd)
           ulc eTs1oe(
          {
              ti.rAtetct =tu;
               hsPeuhniae  re
          }


          pbi oerd InmrtrWbeteus>GteusEueao(
           ulc vrie Eueao<eTsRqet eRqetnmrtr)
          {
              / sbttt tehglgtdpt wt tept o teislgfl
               / usiue h ihihe ah ih h ah f h i o ie
              ISoRae rae =nwISoRae(":DmiLg.o";
               ILgedr edr  e ILgedr@Ceoiso1lg)
              frah(eTsRqetrqeti rae.eRqet()
               oec Wbeteus eus n edrGteuss)
              {
                  yedrtr rqet
                  il eun eus;
              }
          }
     }
 }




7. Its time to fire the test off and see the iis log playback as a web performance test. From the Test menu choose Test View Window you should be able to see
the WebTest1Coded test show up. Highlight the test and press Run selection (you can also debug the test in case you face any failures during test execution).
8. Optionally you can create a Load Test by keeping ‘WebTest1Coded’ as the base test.

Conclusion
                You have just helped your testing team, you now have become the coolest developer in your organization! Jokes apart, log parser and web
                performance test together allow you to save a lot of time by not having to worry about what to test or even worrying about how to record the
                test. If you haven’t already, download the solution from here. You can take this to the next level by using LogParser to extract the log files as
                part of an end of day batch to a database. See the usage trends by user this solution over a longer term and have your tests consume the web
                requests now stored in the database to generate the web performance tests. If you like the post, don’t forget to share … Keep RocKiNg!
Print | posted on Wednesday, July 04, 2012 6:58 PM


Comments on this post: Using IIS Logs for Performance Testing with Visual Studio
# re: Using IIS Logs for Performance Testing with Visual Studio

       One important thing you are missing here is that if you are using VS2010 the
       WebTestFramework.dll is only installed with VS2010 Ultimate, not Pro or Premium. This will save
       anyone the effort that is interested but doesn't have ultimate. You could copy the binaries from an
       ultimate machine but that would only allow you to complie the project but not run it.
       Left by Kevin Scharnhorst on Jul 05, 2012 10:40 PM



# re: Using IIS Logs for Performance Testing with Visual Studio

       Yes that is correct Kevin. Web Performance Testing and Load testing is only supported out of
       Visual Studio Ultimate.
       Left by Tarun Arora on Jul 05, 2012 11:04 PM



# re: Using IIS Logs for Performance Testing with Visual Studio

       Frankly, I love your blog. I met by chance. But now I am every day and I think I watched everything!
       Thank you very much anyway
       good luck
       Left by tirage tarot gratuitement on Jul 12, 2012 3:00 PM




       Your comment:

       Title:

        re: Using IIS Logs for Performance Testing with Visual Studio


       Name:




       Email: (never displayed)
(will show your gravatar)


       Website:




       Comment: Allowed tags: blockquote, a, strong, em, p, u, strike, super, sub, code




                Enter the code shown above

                                                                  Post Comment



                                                                                                              Copyright © Tarun Arora | Pow ered by: GeeksWithBlogs.net | Join free


POPULAR POSTS ON GEEKS WITH BLOGS

Fixing the "Microsoft Bus Driver" error message when installing a RealTek sound card

CISCO VPN Client Software on Windows Vista

Visual Studio 2008 Debugging Tricks – Multi-Threaded Debugging

Changing your hosts file in Vista

MsMpEng.exe is the nugget draining my CPU...

Windows 7 Desktop Gadgets

HOWTO: Print to a USB Printer from DOS in Windows XP

How to make a transparent background/selection on an image using GIMP

How to set the windows path in Windows 7

Loading pages in IFRAME dynamically from codebehind - ASP.NET




RELATED POSTS ON GEEKS WITH BLOGS

VS2010 crashes when opening a vsp generated using VS 2012

Fix for Failed to load results from the load test results store

Presenting to KolkataGeeks Harnessing the cloud for Performance Testing

Visual Studio Load Testing using Windows Azure

PPT Leveraging Azure for Performance Testing

Part 3–Load Testing In the Cloud Automating Test Rig Deployment

Part 2–Load Testing In The Cloud
Part 1 - Load Testing In The Cloud

Load and Web Performance Testing using Visual Studio Ultimate 2010-Part 3

Load and Web Performance Testing using Visual Studio Ultimate 2010-Part 2


POST CATEGORIES
    TfsDeployer
    TFS2010
    vNext
    Visual Studio Next
    Power Tools
    TFS API
    TFS SDK
    TFS Utilties
    Personal
    TfsAzure
    TfsService
    TfsPreview
    Tfs2012
    TfsTAP
    MTM
    Branching & Merging
    SDET
    Web Performance Testing
    Load Testing
    Load Testing
    TFS Troubleshooting
    Azure
    TestingTours
    HostedTfs
    IE Migration
    ALMing in Hinglish
    Quartz.Net
    TBM
    ALMRangers
    ALM
    TfsDemoSetup
    WebMatrix


ARCHIVES
    November, 2012 (5)
    October, 2012 (9)
    September, 2012 (6)
    August, 2012 (5)
    July, 2012 (6)
    June, 2012 (2)
    May, 2012 (2)
    April, 2012 (4)
    March, 2012 (3)
    January, 2012 (4)
    December, 2011 (5)
    November, 2011 (7)
    October, 2011 (6)
    September, 2011 (7)
    August, 2011 (3)
    July, 2011 (7)
    June, 2011 (6)
    May, 2011 (3)
    April, 2011 (1)

Weitere ähnliche Inhalte

Empfohlen

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Empfohlen (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Using iis logs for performance testing with visual studio

  • 1. TARUN ARORA Website Tarun Arora is a Microsoft Certified professional developer for Enterprise Applications. He has extensively travelled around the world gaining experience learning and working in culturally diverse teams. Tarun has over 5 years of experience developing 'Energy Trading & Risk Management' solutions for leading Trading & Banking Enterprises. His passion for technology has earned him the Microsoft Community Contributor and Microsoft MVP Award. MY RECENT POSTS How to undelete files in TFS Quartz.Net Windows Service Configure Logging Quartz.Net Writing your first Hello World Job Install Quartz.Net as a windows service and Test installation Webmatrix The Site has Stopped Fix MY OTHER POSTS TFS API Change WorkItem CreatedDate And ChangedDate To Historic Dates New features in TFS Demo Setup 1.0.0.2 TFS API Add Favorites programmatically IntelliTrace collector error Some or all identity references could not be translated Get your TFS 2012 task board demo ready in under 1 minute Set up a TFS Server/Service demo environment in less than 1 minute now! Geeks with Blogs acquired by Watson Technology Group Pizza and IntelliTrace at NextGenUG on 16 and 23 October 2012 VS2012 Launch Event – Combating Bugs And Poor Performance In Production VS2012 Coded UI Test closes browser by default TEST Tarun Arora Visual Studio ALM MVP << Visual Studio Load Testing using Windows Azure | Home | Where did I write that code ? >> Using IIS Logs for Performance Testing with Visual Studio share: Comment In this blog post I’ll show you how you can play back the IIS Logs in Visual Studio to automatically generate the web performance tests. You can also download the sample solution I am demo-ing in the blog post. Introduction Performance testing is as important for new websites as it is for evolving websites. If you already have your website running in production you could mine the information available in IIS logs to analyse the dense zones (most used pages) and performance test those pages rather than wasting time testing & tuning the least used pages in your application. What are IIS Logs To help with server use and analysis, IIS is integrated with several types of log files. These log file formats provide information on a range of websites and specific statistics, including Internet Protocol (IP) addresses, user information and site visits as well as dates, times and queries. If you are using IIS 7 and above you will find the log files in the following directory C:InterpubLogs
  • 2. Walkthrough 1. Download and Install Log Parser from the Microsoft download Centre. You should see the LogParser.dll in the install folder, the default install location is C:Program Files (x86)Log Parser 2.2. LogParser.dll gives us a library to query the iis log files programmatically. By the way if you haven’t used Log Parser in the past, it is a is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows operating system such as the Event Log, the Registry, the file system, and Active Directory. More details… 2. Create a new test project in Visual Studio. Let’s call it IISLogsToWebPerfTestDemo. 3. Delete the UnitTest1.cs class that gets created by default. Right click the solution and add a project of type class library, name it, IISLogsToWebPerfTestEngine. Delete the default class Program.cs that gets created with the project. 4. Under the IISLogsToWebPerfTestEngine project add a reference to Microsoft.VisualStudio.QualityTools.WebTestFramework – c:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEPublicAssembliesMicrosoft.VisualStudio.QualityTools.WebTestFramework.dll LogParser also called MSUtil - c:userstaroradocumentsvisual studio 2010ProjectsIisLogsToWebPerfTestIisLogsToWebPerfTestEngineobjDebugInterop.MSUtil.dll 5. Right click IISLogsToWebPerfTestEngine project and add a new classes – IISLogReader.cs The IISLogReader class queries the iis logs using the log parser. uigSse; sn ytm uigSse.olcin.eei; sn ytmCletosGnrc uigSse.et sn ytmTx; uigMUi; sn Stl uigLgur =MUi.oQeylsCas sn oQey StlLgurCasls; uigISoIptomt=MUi.OIS3IptotxCasls; sn ILgnuFra StlCMIWCnuCnetlsCas uigLgeode =MUi.Lgeode; sn oRcrSt StlIoRcrst
  • 3. uigMcootVsaSui.etol.eTsig sn irsf.iultdoTsTosWbetn; uigSse.igotc; sn ytmDansis nmsaeIsosoePrTsEgn aepc iLgTWbefetnie { / B mkn ueo lgpre i i psil t qeyteislguigslc qeis / y aig s f o asr t s osbe o ur h i o sn eet ure pbi casISoRae ulc ls ILgedr { piaesrn _iLgah rvt tig isoPt; pbi ISoRae(tigisoPt) ulc ILgedrsrn iLgah { _iLgah=isoPt; isoPt iLgah } pbi InmrbeWbeteus>Gteuss) ulc Eueal<eTsRqet eRqet( { Lgur lgur =nwLgur(; oQey oQey e oQey) ISoIptomtisnuFra =nwISoIptomt) ILgnuFra iIptomt e ILgnuFra(; / cretyteeclmsgv u sfin ifraint cntuttewbts rqet / urnl hs oun ie s ufet nomto o osrc h e et euss srn qey=@SLC si,spr,c-ehd c-r-tm c-r-ur FO "+_iLgah tig ur "EET -p -ot smto, suise, suiqey RM isoPt; Lgeode rcrSt=lgur.xct(ur,isnuFra) oRcrSt eode oQeyEeueqey iIptomt; / Apyabto tasomto / pl i f rnfrain wie(rcrStaEd) hl !eode.tn() { IoRcr rcr =rcrStgteod) Lgeod eod eode.eRcr(; i (eodgtauE(c-ehd)TSrn( = "E" f rcr.eVlex"smto".otig) = GT) { srn sre =rcr.eVlex"-p)TSrn(; tig evr eodgtauE(si".otig) srn pt =rcr.eVlex"suise".otig) tig ah eodgtauE(c-r-tm)TSrn(; srn qeytig=rcr.eVlex"suiqey)TSrn(; tig ursrn eodgtauE(c-r-ur".otig) SrnBidrulule =nwSrnBidr) tigule rBidr e tigule(; ulule.ped"tp/"; rBidrApn(ht:/) ulule.pedsre) rBidrApn(evr; ulule.pedpt) rBidrApn(ah; i (Srn.sulrmt(ursrn) f !tigINlOEpyqeytig) { ulule.ped""; rBidrApn(?) ulule.pedqeytig; rBidrApn(ursrn) } / Yucudmk sbtttosb itouigprmtrzdwbtss / o ol ae usiuin y nrdcn aaeeie e et. Wbeteus rqet=nwWbeteus(rBidrTSrn() eTsRqet eus e eTsRqetulule.otig); DbgWieierqetUlihurSrn) eu.rtLn(eus.rWtQeytig; yedrtr rqet il eun eus; } rcrStmvNx(; eode.oeet) } CnoeWieie"Ta' i!Coigterae"; osl.rtLn( hts t lsn h edr) rcrStcoe) eode.ls(; } } } 6. Connect the dots by adding the project reference ‘IisLogsToWebPerfTestEngine’ to ‘IisLogsToWebPerfTest’. Right click the ‘IisLogsToWebPerfTest’ project and add a new class ‘WebTest1Coded.cs’
  • 4. The WebTest1Coded.cs inherits from the WebTest class. By overriding the GetRequestMethod we can inject the log files to the IISLogReader class which uses Log parser to query the log file and extract the web requests to generate the web test request which is yielded back for play back when the test is run. nmsaeIsosoePrTs aepc iLgTWbefet { uigSse; sn ytm uigSse.olcin.eei; sn ytmCletosGnrc uigSse.et sn ytmTx; uigMcootVsaSui.etol.eTsig sn irsf.iultdoTsTosWbetn; uigMcootVsaSui.etol.eTsigRls sn irsf.iultdoTsTosWbetn.ue; uigIsosoePrTsEgn; sn iLgTWbefetnie / Ti casi acddwbpromnets ipeetto,ta sml pse / hs ls s oe e efrac et mlmnain ht ipy ass / tept o teislg t teIsoRae caswihde tehay / h ah f h i os o h iLgedr ls hc os h ev / lfigo raigtecnet o telgfl adcnetn te t tss / itn f edn h otns f h o ie n ovrig hm o et. / Yucudhv mlil sc cassta ihrtfo Wbetadipeet / o ol ae utpe uh lse ht nei rm eTs n mlmn / GteusEueao Mto adps dfen lgflsfrdfeettss / eRqetnmrtr ehd n as ifrt o ie o ifrn et. pbi casWbetCdd:Wbet ulc ls eTs1oe eTs { pbi WbetCdd) ulc eTs1oe( { ti.rAtetct =tu; hsPeuhniae re } pbi oerd InmrtrWbeteus>GteusEueao( ulc vrie Eueao<eTsRqet eRqetnmrtr) { / sbttt tehglgtdpt wt tept o teislgfl / usiue h ihihe ah ih h ah f h i o ie ISoRae rae =nwISoRae(":DmiLg.o"; ILgedr edr e ILgedr@Ceoiso1lg) frah(eTsRqetrqeti rae.eRqet() oec Wbeteus eus n edrGteuss) { yedrtr rqet il eun eus; } } } } 7. Its time to fire the test off and see the iis log playback as a web performance test. From the Test menu choose Test View Window you should be able to see the WebTest1Coded test show up. Highlight the test and press Run selection (you can also debug the test in case you face any failures during test execution).
  • 5. 8. Optionally you can create a Load Test by keeping ‘WebTest1Coded’ as the base test. Conclusion You have just helped your testing team, you now have become the coolest developer in your organization! Jokes apart, log parser and web performance test together allow you to save a lot of time by not having to worry about what to test or even worrying about how to record the test. If you haven’t already, download the solution from here. You can take this to the next level by using LogParser to extract the log files as part of an end of day batch to a database. See the usage trends by user this solution over a longer term and have your tests consume the web requests now stored in the database to generate the web performance tests. If you like the post, don’t forget to share … Keep RocKiNg! Print | posted on Wednesday, July 04, 2012 6:58 PM Comments on this post: Using IIS Logs for Performance Testing with Visual Studio # re: Using IIS Logs for Performance Testing with Visual Studio One important thing you are missing here is that if you are using VS2010 the WebTestFramework.dll is only installed with VS2010 Ultimate, not Pro or Premium. This will save anyone the effort that is interested but doesn't have ultimate. You could copy the binaries from an ultimate machine but that would only allow you to complie the project but not run it. Left by Kevin Scharnhorst on Jul 05, 2012 10:40 PM # re: Using IIS Logs for Performance Testing with Visual Studio Yes that is correct Kevin. Web Performance Testing and Load testing is only supported out of Visual Studio Ultimate. Left by Tarun Arora on Jul 05, 2012 11:04 PM # re: Using IIS Logs for Performance Testing with Visual Studio Frankly, I love your blog. I met by chance. But now I am every day and I think I watched everything! Thank you very much anyway good luck Left by tirage tarot gratuitement on Jul 12, 2012 3:00 PM Your comment: Title: re: Using IIS Logs for Performance Testing with Visual Studio Name: Email: (never displayed)
  • 6. (will show your gravatar) Website: Comment: Allowed tags: blockquote, a, strong, em, p, u, strike, super, sub, code Enter the code shown above Post Comment Copyright © Tarun Arora | Pow ered by: GeeksWithBlogs.net | Join free POPULAR POSTS ON GEEKS WITH BLOGS Fixing the "Microsoft Bus Driver" error message when installing a RealTek sound card CISCO VPN Client Software on Windows Vista Visual Studio 2008 Debugging Tricks – Multi-Threaded Debugging Changing your hosts file in Vista MsMpEng.exe is the nugget draining my CPU... Windows 7 Desktop Gadgets HOWTO: Print to a USB Printer from DOS in Windows XP How to make a transparent background/selection on an image using GIMP How to set the windows path in Windows 7 Loading pages in IFRAME dynamically from codebehind - ASP.NET RELATED POSTS ON GEEKS WITH BLOGS VS2010 crashes when opening a vsp generated using VS 2012 Fix for Failed to load results from the load test results store Presenting to KolkataGeeks Harnessing the cloud for Performance Testing Visual Studio Load Testing using Windows Azure PPT Leveraging Azure for Performance Testing Part 3–Load Testing In the Cloud Automating Test Rig Deployment Part 2–Load Testing In The Cloud
  • 7. Part 1 - Load Testing In The Cloud Load and Web Performance Testing using Visual Studio Ultimate 2010-Part 3 Load and Web Performance Testing using Visual Studio Ultimate 2010-Part 2 POST CATEGORIES TfsDeployer TFS2010 vNext Visual Studio Next Power Tools TFS API TFS SDK TFS Utilties Personal TfsAzure TfsService TfsPreview Tfs2012 TfsTAP MTM Branching & Merging SDET Web Performance Testing Load Testing Load Testing TFS Troubleshooting Azure TestingTours HostedTfs IE Migration ALMing in Hinglish Quartz.Net TBM ALMRangers ALM TfsDemoSetup WebMatrix ARCHIVES November, 2012 (5) October, 2012 (9) September, 2012 (6) August, 2012 (5) July, 2012 (6) June, 2012 (2) May, 2012 (2) April, 2012 (4) March, 2012 (3) January, 2012 (4) December, 2011 (5) November, 2011 (7) October, 2011 (6) September, 2011 (7) August, 2011 (3) July, 2011 (7) June, 2011 (6) May, 2011 (3) April, 2011 (1)