How to Perform Web Testing using Visual Studio 2005 Team System

The Visual Studio 2005 Team System enables Web Testing which makes it easy for testing your website without writing any code. When we say web testing, the Visual Studio 2005 Team System Web testing does not do any user interface testing; instead the tests are done against the data that is flowing through the HTTP. This data is examined and validated with various rules in place.



Testing a web page for the validity of the JavaScript of that page is not done with Visual Studio 2005 Team System or the compatibility of the page for every browser is not tested. There is a step by step approach that can be used to test the website without writing any code. However it is also possible to test the website by writing your customized code as well. The built-in web testing support can also be extended in the Visual Studio 2005 Team System.

Activity recording is supported in Visual Studio 2005 Team System. With this feature in Visual Studio 2005 Team System you can do automated tests against a website by just browsing through the website and filling the forms if present. This automated testing feature is more useful to test a website. So for using the Web Testing feature of Visual Studio 2005 Team System you have to set up a website and a test project.

Create a personal website using the New Web Site option in the File menu. Then select the Personal Web Site Starter Kit and choose the programming language in which you want to create the website.

Once the website is created, you have to create a new account so that you can test the website using that account automatically. Open up the website administration tool by clicking the Website and then the ASP.Net Configuration. Use the Security link and then the Create User link to create the user. Let the role of the user be Administrators. Then close down the website.

You should know that IIS is not used to host the website instead Visual Studio 2005 starts an ASP.Net Development Server. This server chooses a port randomly for hosting the website. If you test a website and then restart the Visual Studio 2005 then the port used changes and hence the tests recorded earlier would become invalid.

It is possible to configure Visual Studio 2005 to use a particular port all the time. Press F4 and go to the Properties window. Here you can see that the ‘Use Dynamic Ports’ value is set to True. Change this to False and select a port number to use.

The next step is to create a Test project. Add a project using the ‘Add Project’ option by right clicking the Solution. After selecting the language of your choice, select the node ‘Test’. Name your test project with an extension .Test.

Now we are ready to record the activity against the website that we have already with us. Now right click the project you have and click Add. Next click ‘Web Test’. After you click ‘Web Test’ a new window opens up. This new window has an explorer bar which is a Web Test Recorder.

Type the URL of the site to be tested in the address bar. Don't forget to enter the port number of the URL. Now use the user name and password that you have created earlier to enter the site.

You activities like browsing to the website URL and submitting the form information will be recorded by the Web Test Recorder. This recorded information is used automatically when you run the Web test against this website. The coordinates at which you clicked the login button is also recorded.

You can also add other steps that can be used for testing, like logging out of the site, entering the site with incorrect login information etc. once you have recorded your activity you can close the window and then save the test. Now if you look at your project, it will have a Web test case file in it which has the information that was recorded while you used that website earlier.

If you want to modify the data that was recorded while you browsed your website, you have to use the Web Test tree and selecting the appropriate node and then use the Properties window.

It is also possible to group a set of requests to make them as a single unit of transaction. For your reference you can add comments to each of the request made. Just right click the request and use ‘Insert Comment’. The comments that you enter are used to document the data that is submitted.

After a test is recorded you are ready to run execute a test against a website. To do this, just run the project and this will open up a Test window that will display the test that are being run and the ones that are pending. Remarks such as Passed / Failed are also displayed depending on the condition. You can also use the Test Manager and Test View window to select a Test and execute it individually.

You can also run the individual web test files. For this, all you have to do is to open that web test file and click the ‘Run’ button. This will run the web test case. The result of each request in a test is recorded. You can view the details of the results by selecting the request. With this you can also view the html of the resulting page. While a test is executed all hyperlinks in a page are tested for their validity. These hyperlinks appear as child nodes of the request. The child nodes have the status of the request made to that URL.

For proper testing just checking the hyperlinks is not sufficient. Extraction Rules and Validation Rules are also use to check the website URLs. There is a need to check whether the user has entered the correct login information. If there is any mistake in that then the request should return an Error page. If the login is successful then the user should be directed to their account page. For this kind of testing you need the extraction rules and the validation rules.

The extraction rules are used to capture the response value. They focus on a particular value in the response got. This information might be used in the other post backs made. Option like ExtractHiddenFields, ExtractAttributeValue, ExtractRegularExpression, ExtractText and ExtractHttpHeader are available for this purpose.

The validation rules are used to examine the response and see whether that response is correct for the information posted. For any failed request you can check the details using the Details tab. Some of the validation rules that are used include ValidationRuleRequiredAttibuteValue, ValidationRuleFindText, ValidationRuleRequiredTag, and ValidationRuleRequestTime.

The property window of the request rules have the feature to modify the value that is used for testing the website. One of the powerful features of Visual Studio 2005 Team System is the ability to use data that is available from a database to be used for the web test requests made.

The toolbar on the Web test has feature called Add Data Source which can be used to add a data source that can be used to pull in data for testing a website. It is also possible to extend the Visual Studio 2005 Team System to write custom code for Web test and to extend its functionality. For more details on these features you can always check the MSDN documentation available in the Microsoft website.

Related Article: 7 Reasons To Choose Visual Studio Code for .NET Development


“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2024 - All Rights Reserved.