How to Perform Web Testing using Visual Studio 2005

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.

XML INTERVIEW QUESTIONS

Question :Parse an XML file or XML file validation ?
Answer: We can parse an xml FILE with an xsd FILE. It message us that our file is not well-formed and then if it is not valid it lists out the specific reason ,it is quite helpful to find an error in a large XML file it also returns line number which contain error also the tag name. That is done in Visual Studio .NET so to get it to work you will have to change the code around to whatever you want to do. One thing is that we must have namespace in the root element of the XML file.

Question:-Is it possible that XML accept UNICODE characters ?
Answer: Yes XML documents can contain foreign characters, like Norwegian æ ø å , or French ê è é.But XML document can not under stand this to understand this we have to take XML as UNICODE.There are some encoding techniques.



.

Question:-What is DOM?

Answer: Document Object Model (DOM) is a W3C specification that defines a standard (abstract) programming API to build, navigate and update XML documents. It is a "tree-structure-based" interface. As per the DOM specification, the XML parsers (such as MSXML or Xerces), load the entire XML document into memory, before it can be processed. XPath is used to navigate randomly in the document, and various DOM methods are used to create and update (add elements, delete elements, add/remove attributes, etc.) the XML documents.

Question: What is XMLA define it ?
Answer: First of we take a full form of XMLA (XML Analysis Services). Analysis Service was designed to draw reports from data contained in a Data Warehouses and doesnot have any relation with data structure.From XMLA we can expose the Analysis service data to external world in XML.

Question:-What is XML ?

Answer: XML is the Extensible Markup Language. It improves the functionality of the Web by letting you identify your information in a more accurate, flexible, and adaptable way. It is extensible because it is not a fixed format like HTML (which is a single, predefined markup language). Instead, XML is actually a metalanguage—a language for describing other languages—which lets you design your own markup languages for limitless different types of documents. XML can do this because it's written in SGML, the international standard metalanguage for text document markup (ISO 8879).

Question:-What is XPath?
Answer: XML Path Language (XPath) is a W3C specification that defines syntax for addressing parts of XML document. XML document is considered as a logical tree structure, and syntax based on this consideration is used to address elements and attributes at any level in the XML document. For example, considering the XML document described above in answer to question 2, /abc:Employees/abc:Emp/@EmpID XPath expression can be used to access the EmpID attribute under the (first) Emp element under the Employees document element. XPath is used in various other specifications such as XSLT.

Question:-What is XHTML?

Answer: Is simple words, XHTML, or Extensible HTML, is HTML 4 with XML rules applied to it (each begin tag must have an end tag, attribute values in single/double quotes, etc.). However, the overall vision of XHTML is much more than that. In addition to using XML syntax for HTML, XHTML also encloses specifications such as XHTML Basic (minimal set of modules for devices such as PDAs), XForms (represents the next generation of forms for the Web, and separates presentation, logic, and data), XML Events (provides XML languages with the ability to uniformly integrate event listeners and associated event handlers), etc.

Question:-What is XML Parser ?
Answer: Microsoft's XML parser is a COM component that comes with Internet Explorer 5 and higher. Once you have installed Internet Explorer, the parser is available to scripts.
Microsoft's XML parser supports all the necessary functions to traverse the node tree, access the nodes and their attribute values, insert and delete nodes, and convert the node tree back to XML.

To create an instance of Microsoft's XML parser with JavaScript, use the following code:
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")

To create an instance of Microsoft's XML parser with VBScript, use the following code:
set xmlDoc=CreateObject("Microsoft.XMLDOM")

To create an instance of Microsoft's XML parser in an ASP page (using VBScript), use the following code:
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")

The following code loads an existing XML document ("note.xml") into Microsoft's XML parser:


Question:- Some Limitation or Disadvantage of XML?
Answer: XML markup has a few disadvantages:
It can be verbose unless element and attribute names are chosen with care. In large documents the markup overhead need not be large, but in short messages it can be significantly more than the actual data, especially when the element or attribute names are concocted by machine.

Overlapping markup is not permitted (an element cannot start inside one element and end inside another): element markup must nest hierarchically.

Some of the software is truly mediocre.

Question:- How to add in XML document through XSL ?
Answer: XSL (the eXtensible Stylesheet Language) is far more sophisticated than CSS. One way to use XSL is to transform XML into HTML before it is displayed by the browser as demonstrated in these examples:
Below is a fraction of the XML file. The second line,
, links the XML file to the XSL file:

Question:- How do I convert my existing HTML documents into XML?

Answer: Tidy is a command-line utility which runs on a wide variety of operating systems; it uses various command-line switches (parameters) to control its processing. At a minimum, it simply cleans up your HTML by ensuring that elements are properly nested and so on; it also warns you if your HTML uses non-standard code that's likely to cause cross-browser compatibility problems. One of the most useful command-line options is -asxml ("as XML," see?), which does what you seem to be asking. It will properly balance elements, per usual, but it also adds some extra information to the document. For instance, it tacks on an XML declaration, , and a statement, which unambiguously mark this as an XML document. To the root html element it also adds a namespace-declaring attribute that identifies all elements in the document as conforming to the specific XML vocabulary known as XHTML. It even forces all element names to lowercase, since the XHTML standard requires it.

If you're asking about converting HTML to a less generic form of XML than XHTML, your task may turn out to be quite complex. For example, if you've been using HTML to mark up customer invoices, not only the customer's name but also their number, item(s) ordered, quantity, and price are probably all wrapped up inside

and

tags. How do you know which "kind of paragraph" contains a given kind of information, so you can turn one instance of the p element into a custname element, another into custnumber, another into price, and so on? If you've been using CSS for styling your HTML, you may have supplied the different p elements with class="custname" (etc.) attributes and so on; if that's the case, you may be able to generate meaningful XML using an XSLT stylesheet. There may also be customized software to do the sort of conversion you want. Otherwise you're probably looking down the barrel of an ugly gun.



Question:- What is a schema? What are the limitations of a DTD?

Answer: SCHEMA is nothing but METADATA. The schema holds all the information of the xml file that is to be deployed in the project. Metatdata is nothing about data about data since we know that xml is used for data representation language we will be able to understand what metadata is. Metadata includes the tags that is going to be exchanged to and fro from another xml file. DTD (DATA TYPE DEFINITION ) which supervises two conditions namely well formedness and closeness of the xml file. So the user should be aware of what tags he was put into use of this xml file 'A' should be intimated to another application's XML file 'B', by then our xml file will interact with the another xml file, this is the major limitation and mandatory issue that the developers should follow.