Hi Friends,
In today’s discussion I am going to discuss about Web tests. Now, web tests are part of Unit Testing. But, unit testing again test only the application logic and other things like validation rules, business rules etc, but it didn’t say anything about your application performance. Now, application performance depends on so many factors and one of the most important factor is number of HTTP Calls involved to load the page.
Now, using Visual Studio you can go ahead and configure your Visual Studio for the application in such a way, that it will record the application session and give you snapshot on application behavior. So, without wasting much time, let’s go ahead and add one additional project for Web Test project in our application as shown below.
Now, when I click ok, it will create one new project for me in the solution explorer as shown below.
Now, I will delete this default template given to me by visual studio “WebTest1.webtest” and will add a new web test project as shown below. Now, as soon as I add a new web test project, it will automatically open the browser where in it will be recording your sessions. Also, if by default in your browser web test recorder won’t appear check your IE Add ONs setting and enable the same for web test recorder as shown below.
Now, since I have already enabled in my browser so, when I go ahead and click on below shown icon, it will open the browser with recording bar
So, as you can see in the left panel, it listed all the http requests when I clicked on various links in my application. Now, when I click on stop recording, it will take me to Visual Studio back with run results as shown below
Now, when I click on the 1st icon as shown below, then it will run the test and give me snapshot as shown below.
On running the test it will produce the below result.
So, as you can see in the above screen shot, it has given page by page analysis, like status code, total time taken, request time and many more parameters necessary to decide your application performance. Now, like these you can test many more test like validation rule test, extraction rules test and many more. I leave this part on readers to delve more on testing part.
Like this there are many more things which is involved with any web development, you can find the same in upcoming book “Hands-on with ASP.NET MVC“. This book i have written completely case study based, started from the blank slate, completed the web development 1st, then optimized the same for Mobile browsers, then hosted on different platforms and many more tiny things which is crucial for End to End application development. Till then stay tuned and happy coding.
Thanks,
Rahul
Waiting for this book!