Thursday, July 17, 2008

Checking Links with QTP 9.2

Checking Links


Checking all links on a website isn't that easy as it might look. The scripts demonstrates on how to do it for a normal website. What it does is that it counts the links on the homepage and then one by one click on the links and close the popup window in case it's opened in a new window.

Features:

* Closing the popup when clicking a link opens ones
* Workaround for determining if a popup is present or not. QTP provides "Exist" function for checking if a object exists or not. For checking a popup browser we can use Browser("CreationTime:=1").Exist and use Browser("CreationTime:=1").Close the popup window. But the problem is that sometimes QTP returns true even when the browser does not exists and using close function closes the main browser window which leads to the failure of the script. The script uses a workaround by comparing the hwnd of the main browser and the popup browser and closing the popup only if the handles don't match.
* Checks for normal 404 or page cannot be displayed messages in the source code of the browser.


Limitation:

* More than 1 popup: Opening a website or a link which leads to other popup will make the script fail as it closes on 1 popup. But with small enhancement it can be easily changed to support these websites also.
* Ignoring a link: Clicking on links like "Logout" is not excluded and hence may fail the script.
* Changing website: If clicking of a link changes the home page of a website then the script will fail. Consider the case of www.google.com, now if you run the script on this page it will fail becuase when the script clicks on one of the languages link, the home page of website will change and even the no. of links might change. This can be correct by two ways, one is to close all the browsers every time and delete all cookies and then go for the next link and other ways would be to delete the session cookies of the browser. For deleting session cookies there is no software available except the one that I created and is present on this website

No comments:

Quality Center


Quality Center

A Quality Center project is a database for collecting and storing data relevant to a testing process. For QuickTest to access a Quality Center project, you must connect to the local or remote Web server where Quality Center is installed. When QuickTest is connected to Quality Center, you can create tests and save them in your Quality Center project. After you run your tests, you can view the results in Quality Center.


Quality Center helps you maintain a project of all kinds of tests (such as QuickTest tests, business process tests, manual tests, tests created using other Mercury products, and so forth) that cover all aspects of your application's functionality. Each test in your project is designed to fulfill a specified testing requirement of your application. To meet the goals of a project, you organize the tests in your project into unique groups.

You can instruct QuickTest to automatically submit a defect to a Quality Center project for each failed step in your test. You can also manually submit a defect for a specific step to Quality Center directly from within your QuickTest Test Results window. These options are only available when you are connected to a Quality Center project.

Saving Tests to a Quality Center Project

When QuickTest is connected to a Quality Center project, you can create new tests in QuickTest and save them directly to your project. To save a test, you give it a descriptive name and associate it with the relevant subject in the test plan tree. This helps you to keep track of the tests created for each subject and to quickly view the progress of test planning and creation. In QuickTest, click Save or choose File > Save to save the test. The Save Test to Quality Center dialog box opens and displays the test plan tree.

The Save Test to Quality Center dialog box opens only when QuickTest is connected to a Quality Center project. To save a test directly in the file system, click the File System button to open the Save QuickTest Test dialog box. You can return to the Save Test to Quality Center project dialog box by clicking the Quality Center button.

Submitting Defects to a Quality Center

When viewing the results of a run session, you can submit any defects detected to a Quality Center project directly from the Test Results window.

To manually submit a defect to Quality Center: or click the Choose Tools > Quality Center ConnectionQuality Center Connection button to connect to a Quality Center project. Choose Tools > Add Defect or click the Add Defect button to open the Add Defect dialog box in the specified Quality Center project. The Add Defect dialog box opens. You can modify the defect information if required. Basic information about the test and any checkpoints (if applicable) is included in the description. Click submit button.

To automatically submit defects to Quality Center: Choose Tools > Options or click the Options button . The Options dialog box opens. Click the Run tab. Select the Submit a defect to Quality Center for each failed step check box.