Wednesday 13 July 2016

[Visual Studio] Load Testing Web Application with Web Performance Test [Part 2]

This post is the second part and continuation from this post http://jaryl-lan.blogspot.com/2016/07/visual-studio-creating-web-performance.html. If you are unsure on how to create a Web Performance Test, it is advisable to pay a visit on the first part of the post as this post is about using Web Performance Test to run with Load Test.

So, once you have create and configured your Web Performance Test file. You can then create a Load Test and run it.
Steps to create Load Test.
1) On the Solution Explorer in Visual Studio, right click on your "Web Performance and Load Test Project". Hover to "Add" and click "Load Test...". A window named "New Load Test Wizard" will be prompted.
Add Load Test
Add Load Test
2) On the welcome wizard, click Next button.
New Load Test Wizard - Welcome Screen
New Load Test Wizard - Welcome Screen
3) In Scenario, change the name to your desired value. If your Web Performance Test is only making service call, select "Do not use think times". Whereas if your Web Performance Test contain user interaction on web pages, select either "Use recorded think times" or "Use normal distribution centered on recorded think times" based on what you desired and fill in the time in seconds for "Think time between test iterations". Once you are done, hit on the Next button. (Note: For those who comes from first part of the post, select "Do not use think times" since the Web Performance Test is created for calling services).
New Load Test Wizard - Scenario
New Load Test Wizard - Scenario
4) In Load Pattern, you can choose either Constant Load or Step Load. Constant Load is for the load test to constantly send the same amount of "users" based on the "User Count" value. Whereas Step Load is for the test to start from a smaller amount of "Users" based on the value defined in "Start user count" and slowly increase until it reaches the maximum number of "Users" as defined in "Maximum user count". How fast and how much it increases each time is based on the "Step duration" and "Step user count". Once done, click Next button.
New Load Test Wizard - Load Pattern
New Load Test Wizard - Load Pattern
5) In Test Mix Model, you can pick either one of the offered options based on what you desired. Each options selected will have pictures and description located at the right side to describe the selected model. Once you have made your choice, hit Next button.
New Load Test Wizard - Test Mix Model
New Load Test Wizard - Test Mix Model
6) In Test Mix, you can add 1 or more Web Performance Test. In case you have not created it or unsure how to create it, head to the first part of the post for more detail about Web Performance Test. So, to add the Web Performance Test file, click "Add..." button. On the "Add Tests" window under Available tests, select your desired test file and hit the "right arrow" button. Once you are done, click OK button to close this window and click Next button to proceed.
New Load Test Wizard - Test Mix
New Load Test Wizard - Test Mix
Add Tests to Test Mix
Add Tests to Test Mix
7) In Network Mix, LAN is added by default. If your Web Performance Test is calling the service that exist in local area network, you can just click Next button. Otherwise you can make changes as you see fit.
New Load Test Wizard - Network Mix
New Load Test Wizard - Network Mix
8) In Browser Mix, Internet Explorer 9.0 is added by default. You can make any changes as you want here based on your desired browser. After you have completed the changes, click Next button.
New Load Test Wizard - Browser Mix
9) In Counter Sets, you can leave things as default and click Next button. But in case you want to monitor extra stuff, you can click "Add Computer..." and select your desired counter set.
New Load Test Wizard - Counter Sets
New Load Test Wizard - Counter Sets
10) In Run Settings, you can choose your load test to run in duration or by iterations. In Load test duration, you can set how long the test runs and how long it needs to warm up before sending "users" to your Web Performance Test. Whereas Test iterations is for you to set fix number of users to be sent to Web Performance Test, which means if you set 100 iterations, the load test will only sent 100 users and the test is completed.

In details group box, you can make changes or leave it as default based on what you desired. Click Finish button and visual studio will immediately open the load test file.
New Load Test Wizard - Run Settings
New Load Test Wizard - Run Settings
If this is your first time setting up web performance test and load test, there is a chance that you will be unable to run the load test after clicking the "Run Load Test" button. This is due to for some reason the LoadTest2010 database is not created or the database connection is not configured properly. We will go into that on the next post update. But for now, we have to disable the load test from storing information to database. Do take note that by disabling it, you will not be able to see "Summary Report" at Summary tab.
Run Load Test
Run Load Test
Steps to disable database storage. (This steps is for those who have problem related with database or those who do not want to see the summary report)
1) Open up your load test file, select "Run Settings". Right click on it and click properties.
Go to Run Settings' Properties
Go to Run Settings' Properties
2) Look for Storage Type and change it to None.
Change Storage Type to None
Change Storage Type to None
3) Click "Run Load Test" button.
Run Load Test
Run Load Test
You will see some nice charts and some information for you to monitor. The following are some stuff that you may want to consider to monitor as they provide information on how well your web application performed, the errors to be fixed and possible of noticeable memory leak.
  • Total Requests - shows the number of requests sent to Web Performance Test.
  • Requests/Sec - shows the number of requests the service can process in a second.
  • Failed Requests - shows the number of requests failed to processed by the service.
  • The Max, Min and Avg value for Pages/Sec, Avg. Page Time, Errors/Sec, % Processor Time and Available MBytes.
Load Testing
Load Testing
Load Test Summary
Load Test Summary (Storage Type: Database)
Refer here for the sample project.
https://1drv.ms/u/s!Aj2AA7hoIWHmgnUMr8J4fNegrFDE




No comments:

Post a Comment