QTP Web Testing Essentials: A PDF Guide with Tips, Tricks and Best Practices
Technology Specific Guide for QTP for Web Testing PDF Download
If you are looking for a comprehensive and practical guide on how to use QTP (Quick Test Professional) for web testing, you have come to the right place. In this article, you will learn what QTP is, why it is a powerful tool for web testing, how to install and configure it, how to create and run a web test using it, and how to use some of its advanced features. You will also find a link to download the PDF version of this guide for your convenience.
Technology Specific Guide For Qtp For Web Testing Pdf Download
What is QTP?
QTP is an automated functional testing tool that helps testers to execute automated tests in order to identify any errors, defects or gaps in contrary to the expected results of the application under test. It was designed by Mercury Interactive and later on acquired by HP and now MicroFocus. Full form of QTP is QuickTest Professional while UFT means Unified Functional Testing.
QTP supports both record and playback features, which means you can record your actions on the web application and then replay them later. QTP also allows you to enhance your tests by adding logic, parameters, checkpoints, output values, etc. QTP uses VBScript as its scripting language and works with various technologies such as Java, .NET, SAP, Oracle, etc.
Why use QTP for web testing?
Web testing is the process of verifying the functionality, usability, performance, security and compatibility of a web application across different browsers, platforms and devices. Web testing can be challenging due to the dynamic nature of web applications, the diversity of user scenarios and the complexity of web technologies.
QTP is one of the best tools for web testing because it offers many benefits such as:
It has an excellent object identification process or mechanism that can recognize and interact with various web elements such as buttons, links, text boxes, etc.
It supports different add-ins like Oracle, Java, SAP, NET, Web Forms, People soft, etc. that enable you to test web applications based on different technologies.
It allows you to enhance your tests even without the AUT (Application Under Test) through an active screen that shows you the properties of the objects on the screen.
It supports popular automation frameworks such as keyword driven testing approach, modular testing approach, data-driven testing approach, etc. that help you organize your tests in a structured way.
It comes with an inbuilt IDE (Integrated Development Environment) that provides you with various tools and features such as debugging, syntax highlighting, code completion, etc.
It can be integrated with test management tools like Quality Center, Test Director, and Winrunner that help you manage your test cases, test data and test results.
It supports XML (Extensible Markup Language) reporting that allows you to generate detailed and customized reports of your test execution.
How to install and configure QTP for web testing
Prerequisites
Before you install QTP, you need to make sure that your system meets the following requirements:
Operating system: Windows 8.1, Windows 10, Windows Server 2012 or Windows Server 2016.
Processor: Intel Core i3 or higher.
Memory: 4 GB RAM or higher.
Disk space: 2 GB free disk space or higher.
Browser: Internet Explorer 11, Chrome, Firefox or Safari.
Installation steps
To install QTP, follow these steps:
Download the QTP setup file from the official website of MicroFocus or from any other trusted source.
Run the setup file and follow the instructions on the screen.
Select the components and add-ins that you want to install. For web testing, you need to select the Web add-in.
Enter the license key that you have received from MicroFocus or from your vendor.
Complete the installation process and restart your system if required.
Configuration settings
To configure QTP for web testing, follow these steps:
Launch QTP from the Start menu or from the desktop shortcut.
Select Tools > Options from the menu bar.
In the Options dialog box, select the Web tab and make sure that the following settings are enabled:
Enable Smart Identification: This option allows QTP to use additional properties to identify an object if the original properties are not unique.
Run mode: This option allows you to choose how QTP runs your test. You can choose between Fast, Normal or Debug mode. Fast mode runs your test faster but does not show any details on the screen. Normal mode runs your test at a normal speed and shows the details on the screen. Debug mode runs your test slower but allows you to debug your test step by step.
Page load timeout: This option allows you to set the maximum time that QTP waits for a web page to load before it times out. You can increase or decrease this value depending on your network speed and application performance.
Click OK to save your settings and close the dialog box.
How to create and run a web test using QTP
Recording a web test
To record a web test using QTP, follow these steps:
In QTP, click File > New > Test from the menu bar.
In the New Test dialog box, enter a name and a description for your test and click Create.
In the Test pane, click Record from the toolbar or press F3 on your keyboard.
In the Record and Run Settings dialog box, select Web from the left pane and make sure that Record and run test on any open browser is selected. Click OK.
QTP will minimize itself and start recording your actions on the web browser. Perform the actions that you want to test on your web application. For example, you can navigate to a website, enter some data, click some buttons, etc.
When you are done with recording, click Stop from the toolbar or press F4 on your keyboard. QTP will maximize itself and show you the recorded steps in the Keyword View or Expert View of the Test pane.
Enhancing a web test
To enhance a web test using QTP, you can use various features such as parameters, checkpoints, output values, etc. Here are some examples of how to use them:
To parameterize a web test, you can use data tables that allow you to store and retrieve data from external sources such as Excel files, databases, etc. To use data tables, follow these steps:
In QTP, click View > Data Table from the menu bar to open the Data Table pane at the bottom of the screen.
In the Data Table pane, click Sheet1 and rename it as Global. This sheet will store data that is common for all iterations of your test.
In the Global sheet, enter some column names and values that you want to use in your test. For example, you can enter URL, Username and Password as column names and enter some values for them in each row.
In QTP, click View > Keyword View from the menu bar to switch to the Keyword View of the Test pane.
```html Properties dialog box.
In the Properties dialog box, click the Value cell and then click the Configure Value button.
In the Configure Value dialog box, select Parameter from the left pane and then select DataTable from the right pane. Choose Global sheet as the location and select the column name that matches your parameter. Click OK.
Repeat these steps for any other steps that you want to parameterize. You can also create a new sheet in the Data Table pane and name it as Action1. This sheet will store data that is specific for each action in your test.
To add a checkpoint to a web test, you can use checkpoints that allow you to verify the expected values of various web elements such as text, images, tables, etc. To add a checkpoint, follow these steps:
In QTP, click Insert > Checkpoint > Standard Checkpoint from the menu bar.
In the displayed web browser, point to the web element that you want to check and click on it.
In the Checkpoint Properties dialog box, enter a name and a description for your checkpoint and click OK.
In the Checkpoint Settings dialog box, select the properties and values that you want to check for your web element. You can also modify the checkpoint timeout and options. Click OK.
QTP will insert a checkpoint step in your test and highlight it in yellow.
To add an output value to a web test, you can use output values that allow you to capture the actual values of various web elements and store them in data tables or variables. To add an output value, follow these steps:
In QTP, click Insert > Output Value > Standard Output Value from the menu bar.
In the displayed web browser, point to the web element that you want to capture and click on it.
In the Output Value Properties dialog box, enter a name and a description for your output value and click OK.
In the Output Options dialog box, select where you want to store your output value. You can choose between Data Table or Variable. If you choose Data Table, you can specify the sheet and column name. If you choose Variable, you can specify the variable name and scope. Click OK.
QTP will insert an output value step in your test and highlight it in green.
Running a web test
To run a web test using QTP, follow these steps:
In QTP, click Run > Run from the menu bar or press F5 on your keyboard.
In the Run dialog box, select how you want to run your test. You can choose between Run on all rows, Run from row or Run one iteration only. Click OK.
QTP will start running your test and show you the progress on the screen. You can also pause or stop your test at any time by clicking Pause or Stop from the toolbar.
Analyzing a web test
To analyze a web test using QTP, follow these steps:
After running your test, QTP will display the Test Results window that shows you the summary and details of your test execution.
In the Test Results window, you can view various information such as status, duration, errors, warnings, etc. of each step in your test. You can also expand each step to see more details such as screenshots, properties, values, etc.
You can also view various reports of your test execution such as Run Results Summary Report, Run Results Details Report, Error Report, etc. by clicking Report > View Report from the menu bar.
You can also export or print your test results by clicking File > Export or File > Print from the menu bar.
How to use advanced features of QTP for web testing
Working with object repositories
An object repository is a collection of objects and their properties that QTP uses to identify and interact with the objects in your application. QTP has two types of object repositories: shared and local. A shared object repository is stored in a separate file and can be used by multiple tests. A local object repository is stored within a test and can be used by that test only.
To work with object repositories using QTP, follow these steps:
In QTP, click Resources > Object Repository Manager from the menu bar to open the Object Repository Manager window.
In the Object Repository Manager window, you can create, edit, delete, merge, compare and associate object repositories. You can also add, modify or delete objects and their properties in an object repository.
To create a new object repository, click File > New from the menu bar and enter a name and a description for your object repository. Click Save.
To add objects to your object repository, click Object > Add Objects from the menu bar and then select the objects from your application that you want to add. You can also use the Object Spy tool to capture the objects and their properties.
To edit an object or its properties in your object repository, select the object from the object tree and then modify its properties in the properties grid. You can also use the Object Identification dialog box to change the identification method or properties for an object.
To delete an object from your object repository, select the object from the object tree and then press Delete on your keyboard or click Edit > Delete from the menu bar.
To merge two or more object repositories, click Tools > Merge from the menu bar and then select the source and target object repositories. You can also resolve any conflicts that may arise during the merge process.
To compare two object repositories, click Tools > Compare from the menu bar and then select the object repositories that you want to compare. You can also view the differences and similarities between them.
To associate an object repository with a test, click File > Associate Repository from the menu bar and then select the test and the object repository that you want to associate. You can also change or remove an association at any time.
Parameterizing a web test
Parameterizing a web test means replacing fixed values in your test with parameters that can take different values from various sources such as data tables, environment variables, random numbers, etc. Parameterizing a web test helps you to run your test with different data sets and scenarios.
To parameterize a web test using QTP, follow these steps:
In QTP, switch to the Expert View of the Test pane by clicking View > Expert View from the menu bar.
In the Expert View, locate the step where you want to use a parameter and double-click on it to open its Properties dialog box.
In the Properties dialog box, click the Value cell and then click the Configure Value button.
In the Configure Value dialog box, select Parameter from the left pane and then select one of the following options from the right pane:
DataTable: This option allows you to use data from data tables as parameters. You can specify the sheet and column name of your data table.
```html the name of your environment variable.
Random number: This option allows you to use random numbers as parameters. You can specify the minimum and maximum values of your random number.
Test/Action parameter: This option allows you to use test or action parameters as parameters. You can specify the name and default value of your test or action parameter.
Click OK to save your parameter settings and close the dialog box.
Repeat these steps for any other steps that you want to parameterize.
Synchronizing a web test
Synchronizing a web test means making sure that QTP waits for your application to be ready before performing any actions or checks on it. Synchronizing a web test helps you to avoid errors or failures due to timing issues.
To synchronize a web test using QTP, follow these steps:
In QTP, switch to the Keyword View of the Test pane by clicking View > Keyword View from the menu bar.
In the Keyword View, locate the step where you want to add synchronization and right-click on it. Select Insert Synchronization Point from the context menu.
In the displayed web browser, point to the web element that you want to synchronize with and click on it.
In the Object Selection - Synchronization Point dialog box, enter a name and a description for your synchronization point and click OK.
In the Synchronization Point Settings dialog box, select the property and value that you want to check for your web element. You can also modify the synchronization timeout and options. Click OK.
QTP will insert a synchronization point step in your test and highlight it in blue.
Adding checkpoints and output values
Adding checkpoints and output values to a web test means verifying and capturing the expected and actual values of various web elements such as text, images, tables, etc. Adding checkpoints and output values to a web test helps you to validate and store the results of your test.
To add checkpoints and output values to a web test using QTP, follow these steps:
In QTP, switch to the Keyword View of the Test pane by clicking View > Keyword View from the menu bar.
In the Keyword View, locate the step where you want to add a checkpoint or an output value and right-click on it. Select Insert Checkpoint or Output Value from the context menu.
In the displayed web browser, point to the web element that you want to check or capture and click on it.
In the Checkpoint Properties or Output Value Properties dialog box, enter a name and a description for your checkpoint or output value and click OK.
In the Checkpoint Settings or Output Options dialog box, select the properties and values that you want to check or capture for your web element. You can also modify the checkpoint or output timeout and options. Click OK.
QTP will insert a checkpoint or output value step in your test and highlight it in yellow or green respectively.
Using descriptive programming
Using descriptive programming means writing your own code to identify and interact with the objects in your application instead of using object repositories. Using descriptive programming gives you more flexibility and control over your test script.
To use descriptive programming in a web test using QTP, follow these steps:
In QTP, switch to the Expert View of the Test pane by clicking View > Expert View from the menu bar.
In the Expert View, locate the step where you want to use descriptive programming and delete it.
In its place, write your own code using VBScript syntax and QTP methods and properties. You can use either static or dynamic descriptive programming. Static descriptive programming means specifying all the properties and values of an object in your code. Dynamic descriptive programming means creating a description object that stores all the properties and values of an object in your code.
Here are some examples of how to use descriptive programming in a web test:
To navigate to a website using static descriptive programming, write this code:
```vbscript Browser("title:=Google").Navigate "https://www.google.com" ``` To navigate to a website using dynamic descriptive programming, write this code:
```vbscript Set myBrowser = Description.Create myBrowser("title").Value = "Google" Browser(myBrowser).Navigate "https://www.google.com" ``` To enter some data in a text box using static descriptive programming, write this code:
```vbscript Browser("title:=Google").Page("title:=Google").WebEdit("name:=q").Set "QTP" ``` To enter some data in a text box using dynamic descriptive programming, write this code:
```vbscript Set myPage = Description.Create myPage("title").Value = "Google" Set myWebEdit = Description.Create myWebEdit("name").Value = "q" Browser("title:=Google").Page(myPage).WebEdit(myWebEdit).Set "QTP" ```
How to download the PDF version of this guide
If you want to download the PDF version of this guide, you can click on the link below and save it to your device. The PDF version contains the same content as this article, but in a more convenient and portable format.
Download Technology Specific Guide for QTP for Web Testing PDF
Conclusion
In this a