Vous êtes sur la page 1sur 89

Introduction to Quick Test Professional (QTP) What is QTP?

HPs Quick Test Professional (QTP) is software that facilitates Automation Testing for software applications Functional and Regression testing to be more specific. QTP comes with a user interface that can be considered an Integrated Development environment (IDE) for the test itself. The IDE has various features that aid the tester to develop a comprehensive script which would successfully validate the purpose of the test. All these features will be discussed in detail as we proceed through the series of these articles. Some of the important aspects of QTP: 1. It uses VB Script as its scripting language. (A scripting language is one that gets interpreted at run time) 2. QTP runs only in a windows environment. 3. The current version of QTP is 11.0 (Latest version Unified Functional Testing UFT 11.5) 4. The technologies it supports are Web, Java .Net, SAP, Oracle, Siebel, PeopleSoft, Web Services, and many major languages. Although some of the older versions dont support all the technologies listed. How does it work? The basic test creation method is record and playback. What does this really mean? Lets talk about Record first. When a tester launches QTP and performs a series of operations on the AUT (Application under test) QTP generates lines of code that corresponds to each operation performed. This will be the basic test script. Moving on to Playback. When the test script created is run, it performs the exact same operations on the AUT thus playing back the sequence of steps already recorded. E.g.: When I launch QTP and try to access the login page of a web based email program, I enter the login ID, Password and press the OK button. These actions are recorded in their equivalent VBScript lines of code in the QTP IDE. When I save this test script and play it back, QTP will enter the same login ID, Password I entered before and clicks on the OK button for me. Now this being the gist of the basic test creation technique, record and playback are not always sufficient to a robust test script. The tester will have to use the other features in the IDE in conjunction with a little bit of his programming skills to achieve the required results. There are various technical aspects to be taken into consideration before we attempt to record and playback, like the state of the AUT, synchronization, the exact menu options, the exact code that QTP generates etc. We will get to that as soon as we discuss the basic concepts of the tool itself.

Heres how all this works. QTP identifies the various objects in the AUT by a name or handler ID or any other unique property/properties that the object possesses. During the record phase it captures all these properties and during playback, it performs the desired operations like mouse click, checkbox checking etc. on these objects. What will you need to get started with QTP? A valid QTP license or in the case of a learner a trial version on their computer. QTP Download: Here is a link to download the QTP trial version:Download QTP. In the above link, go to the Trials and Demos tab and select the HP QTP Essentials 11.0 English Evaluation (web GUI Testing only) option. You can also select the latest version HP Unified Functional Testing 11.50 CC English SW E-Media Evaluation. Let us know if you want more detailed instructions on downloading and installing QTP trial version on your machine. There are two kinds of licenses Seat license and concurrent/floating license. Seat license is for a single machine at one time whereas a current license is for a particular number of concurrent users. Now that we have some background information about QTP, lets examine the tool itself starting with the UI. QTP GUI: When a test is recorded or created it can be viewed in one of these two views: 1. Keyword view: This view is a tabular representation of all the objects and the actions that are performed on them. Every row in the table is a step performed on the AUT and can be modified. Some of the most common columns displayed are: item, operation, value and documentation. 2. Expert view: As the name indicates, this view is for more technical users who would want to tweak the source code as per their requirements. Both the views are available simultaneously so the user can switch between them anytime during the test creation or modification. Lets record a little something to get started Step #1): Launch QTP. The first thing that comes up is an Add-in manager. It displays all the add-ins that are available and the user can check or uncheck the ones as needed. Active-X, Web and Visual Basic are available by default. (This feature can be turned off if required).

Step #2) On Clicking OK in the Add-in Manager QTP start page comes up. (click to image to enlarge)

Step #3) On choosing Record option (F3 key) the Record and Run settings screen comes up with Web and Windows Application Tabs. Click OK without changing any settings. However, all the features of this screen will be discussed at length later on.

Step #4) For our example, I am going to launch the Flight application from the samples that come with QTP. I am going to enter the Agent Name and Password in the Login screen. Now, lets examine the code it generates. The following is the keyword view. As you can see, the actions are in the form of a table with columns: Item, Operation, Value and Documentation. Item corresponds to the object in the AUT on which we performed an action, operation is the action itself, value is the data we set the particular object to and documentation is more or less like a description. (click on image to enlarge)

The corresponding keyword view to the same test is as follows. As you can see this view contains the source code for all the actions performed.

Step #5) The code can be manipulated from either of these views. Conclusion: Here is a gist of everything we discussed in this article: QTP is a software that aids automated Functional and Regression testing of software applications. The current version runs only in a windows environment and uses VB script as a scripting language. The basic method for creation of a test is Record and Play back, although thats not always sufficient. It comes with two kinds of licenses, seat and concurrent. The default add-ins are Active X, Web and Visual Basic. A test can be recorded on a Web or Windows application; the specific details are to be provided in the record and run settings pop-up window. The GUI provides two views, Keyword and Expert. Keyword view is a tabular form that shows details like the name of the objects, its value, and the operation performed etc. Expert view displays the performed actions on the AUT in the form of source code.

Additional operations to be performed on the test objects can be added or deleted either from the Keyword view or programmatically from the Expert view. More details on this in the next article.

Working with Keyword View QTP Training Tutorial 2 Introduction to QTP Keyword View This article is going to give you an insight into the Keyword view of the QTP GUI. During this process we are going to get a quick introduction to Actions, Object Hierarchy and the basic columns in the keyword view. Lets start. There is a drop-down box at the top and it shows Action 1.

What does this mean? Introduction to Actions: Tests in QTP are recorded in terms of actions. Action is nothing but a set of statements performing a sequence of actions. Most often an action is simply a logical unit of modularity. The calls to one or more actions can be defined as a QTP test.

For E.g.: Lets assume that in an online web based email system, the user needs to login, compose and send email and then logout, it is recommended that each of these operations be divided into 3 different actions although all of them can be written under one action. Test Email will have: Action1 Action2 Action 3 The Test >Login >Compose and send email >Logout is essentially:

Call to Action1; Call to Action 2; Call to Action 3 If written in one action, the lines of script would be large and difficult to manipulate and maintain. So the logical division is recommended. Also, as we move on further in our exploration about Actions we are going to understand how actions can be parameterized thus enabling easy repetition of a certain action as many times as desired. So when you create a new QTP test it contains a call to one action, Action 1. When we expand the drop down, it shows the Test Flow. For a test with multiple actions it shows the sequence in which each action is called thus making the name, Test Flow self-explanatory. This drop-down not only displays the sequence of actions, it also provides the option for the user to select or go-to a particular action to view and/or Edit. There is also a Reusable Actions Folder view. For now, lets just say that reusable actions can be used by multiple tests and multiple times in the same test where it was created . We are going to discuss in detail how that can be achieved. Every action by default is reusable. This can be changed if need be. Lets take a little diversion here and talk a little bit about Object recognition hierarchy in QTP. Object Hierarchy If you have noticed in our example the Agent Name and Password are displayed under the item Login. A point to note here is that, QTP uses a tree hierarchy to store objects. In our case, the Agent Name and Password are the child objects to the container object Login which is the Dialog. Container objects are window, dialog box in a windows based environment and web page in a web based environment.

Here is an example, the login Dialog of the flights application:

The container here is the Login dialog and next level objects are Agent name, Password and the other buttons and images in the dialog. There are only 2 levels here. But there could be more levels, like browser.page.button in this case, browser is a container for page and page is a container for button. Working with Keyword view: I am going to use the test we recorded in the previous article. Opening the flights application. Entering the Agent Name and Password in the Login Page and Clicking on OK. I am also going to add some function calls and statements to programmatically from Expert view and show you how they appear under the tabular form in the Keyword view. This is the code I put in the expert view: 1 Dialog("Login").WinEdit("Agent Name:").Set "swati" 2 Dialog("Login").WinEdit("Password:").SetSecure "5112fd3c42beb7a58069b67cfdd9b7e7ad1fc69c" 3 Dialog("Login").WinButton("OK").Click 4 msgbox "text" 5 If x=0 Then 6 msgbox "text 2" 7 End If 8 Window("Flight Reservation").ActiveX("MaskEdBox").Type "010312" 9 Window("Flight Reservation").WinComboBox("Fly From:").Select "Denver" 10 Window("Flight Reservation").WinComboBox("Fly To:").Select "Frankfurt"

Lines 1 through 3 are the login operation. Line 4 is a function call to message box display operation. The I added a dummy if statement just to show you how it appears in the keyword view. X is a dummy value as well. Since we are not going to run this test, lets just use it theoretically. Lines 8 through 10 are entering the date of flight and to, from locations. This is used to understand how objects are grouped. This code appears as follows in the Keyword view: [click on image to enlarge]

As you can see there are 4 columns- Item, Operation, Value and Documentation. The table can be expanded or collapsed by clicking on the little arrow next to the action name. Item: Each step is a sequence of events performed on an item. The item can be one of the following: 1. Test object (e.g.: Agent Name Edit box) 2. Utility Object: These are some objects reserved by QTP to be used in tests. E.g.: DataTable object. More coming up on this later. 3. Statement: Any VB Script programmatic statement or even comments 4. Function call: like msgbox call in our program Operation: It shows the operation that is performed on the item. When this column is clicked for a particular item it lists all the available operations that can be performed on the object.

Value: This column can be considered as the argument of a statement displayed. In our example, the message box function call has a value Text. There can be multiple arguments to one statement in which case this column will be divided accordingly. Documentation: A read only column that translates a statement into easily understandable comments. There are two other columns Assignment and Comment that can be added to the Keyword view table. To do so, the option to select isTools->View Options and choose the required columns from the list displayed.

Assignment: This column is not very widely used and what this does is assigns a value to or gets a value from a variable. [click on image to enlarge]

Comments: The tester can write anything under this column. It will be treated as comments in the expert view. Conclusion: Well, that sums up an interesting insight into the basic capabilities of the QTP keyword view. Actions are logical units of separation in a test. A test is therefore a series of function calls. When a new test is creation it contains one call to an action. By default all the actions are reusable. QTP follows a multi-level hierarchy to recognize objects. An object that contains a next level of objects is called a container. There can be more than one level of containers in a test. In the next article we will talk about way we can use this view to Insert Steps. Modify them, Insert checkpoints, Breakpoints and how we can manage actions. ********** Adding Standard Steps From Keyword View In last tutorial we saw how to work with keyword view. Todays article is going to be about adding steps to a QTP test from the keyword view. Before we go about adding the steps, lets see what kind of steps we can add at all: 1. Standard Step: A standard step is anything that acts on an object. For example, a set operation on an edit box with a particular value or selecting a value from a list box. 2. Checkpoint Step: Checkpoint is a step in a QTP Test that compares an expected value of a specific property/state of an object with the actual value. This is a kind of validation that QTP provides to the users to make sure their AUT is working as intended. So, when this kind of a step is inserted, QTP performs a check during this step execution and if expected and actual values are same, the checkpoint passes or else it fails. An example of a checkpoint is, if in an application a checkbox is supposed to be ON after its selected

3.

4. 5. 6.

or a particular name that a text on the screen should be, etc. QTP has 10 checkpoints that it provides the users with. Apart from these, the tester can verify and validate any conditions by programmatically writing them. All the check points will be dealt in detail in the coming articles. Output value: As the name implies an output value is nothing but a variable that stores the outcome of a particular step in a test. This value can be used subsequently as an input for another step. This value is only available for the time period of a test run after which it gets reset. This topic also will be detailed out shortly. Comments: Any step that is a non-programmatic and wont be executed, but is put in the script to increase readability is a comment. Conditional and Loop statement. Other: These are the kind of statements that help in designing the programming logic. Some examples are sync statement, writing into test results etc.

Lets start with adding a standard step. For our convenience I am going to explain the use of only item, operation, value and documentation columns in the keyword view. Though there are two more columns, they are seldom used. Inserting a step is the first part of adding a line to a program. A step merely adds a blank line in your test. It is up to the tester to define the step and to add details to the step. The details include what item to act on, what operation to perform, what value to assign etc. If its a new test, any step we are trying to add becomes the first step. From the menu main, select Insert-> New Step after clicking anywhere in the keyword view.

Another way is to right click on an existing step and selecting Insert new step from the menu.

Both of these option result in the addition of a new line after the selected step. If a container object was selected while adding a new line, the new step gets added as a sub-step. If a last-level object was selected, the new line gets added as a sibling. Here is how the new line looks like. The new line added is nothing but a skeleton that can be defined as required.

So, the first thing you see in a newly inserted line is a Select an item drop down.

Given the fact that everything operation needs an object to be performed on, this is inevitable. Now as we already discussed item can be anything, a Test object, Statement, Utility Object or comment. The Test objects that are contained under a Container Object are displayed here. Therefore, according to our example, Agent Name, OK, Password is displayed in the list when a new step is to be added while clicking on or under the sub-level steps of the Login Dialog. Object Repository:

If anything other than the items listed are required by the user there is an option to select the same from Object Repository. Now, this is the first time in our articles that we have encountered

the word Object Repository. So, what is it really? When we try to put it simply, an Object Repository is what its name suggests. It a place or more like a database where all the Objects in a test are stored. This is what happens when the user chooses Object Repository from the list.

So either from the list displayed or from Object repository an item can be selected. The next thing is to define the operation to be performed on the selected object. Click in the Operation column and a list of operations that can be performed on the selected object are displayed. This list is dependent on the type of object selected. For instance, a dialog object will have different methods available than when an Edit box is chosen. Choose the desired operation

The next column is the Value. As we already know that this column is the argument to the operation to be performed on the selected item. On clicking in this column, the arguments are displayed as shown below:

If more than one argument is required to carry out the said operation, all the arguments will be displayed as multiple cells in the Value column. The type operation on the FlyFrom item needs a keyboard input. When the icon in this column is displayed the following dialog is displayed that helps the user to configure this value. As you can see from the window above, the value to be entered in this field can either be a Constant in which case the constant value can simply be typed in the text box and then followed by clicking the OK button in the window. Or it could be parameterized, which means it would be picked up from a location in the data sheet, a random number or an Environment variable. How to parameterize a value for an argument will be discussed in length later on.

In our example, I am writing Test in the constant field and clicking OK and here is how the line generated looks:

It should be noted that the Documentation field gets auto-populated with the description pertaining to the operation performed on the item selected. Conclusion So, that concludes the topic, Adding a standard step to a test from the Keyword View. We have discussed the various kinds of steps that can be added from the Keyword view and explored the adding of a Standard Step in detail. Well have couple of more articles on QTP keyword view. In the coming articles, we will see how to add the other kinds of steps, adding conditional and loop statements and how the Keyword view can be used to modify/delete the test steps. *****

Condition and Loop Statements in Keyword view A quick recap of what we learned so far We acquainted ourselves with the Keyword View of the QTP and we are trying to understand the different features this view provides and see how these features can be used to write effective tests. To do that, we are working with a basic example where we recorded a series of simple operations on the Sample Flight Application. This aids in understanding how QTP translates the steps performed on the application into a table with 4 essential columns of the Keyword view. Not only does QTP show the user the operations performed in terms of a table but also lets the user manipulate the steps from this very table. We have explored how a standard step can be added to the keyword view. Apart from a standard step, this view also displays the conditional and loop statements in a test. In this article we are going to explore how QTPs Keyword view handles these statements. Firstly, what do Loop and If statements do? Loop Statement: This is a part of programming logic that is used when a particular set of statements have to be executed repeatedly for a particular number or times. Another variation to this statement is to repeat execution for a block of code until a certain condition is satisfied or while the said condition is satisfied. If statement: As the name indicates, the if statement in a program is used to perform a check for a certain condition to be satisfied, and when it does a certain block of code gets executed. Variations to an if statement is if ..else and if else if Keyword view has a different icon to indicate each of these statements in the keyword view. Lets include some dummy steps into our program and see how these statements appear in the keyword view. For convenience and since the steps that I am about to insert are dummy, I am going to put the code directly into Expert view and we observe it in keyword view.

1) Conditional statements:

The above is the different variations of the if statement that I entered in the expert view and as I said all the code does not serve any purpose except for our understanding. We will note how these statements are represented in the keyword view.

As you can see each statement type is given a different icon for identification. 2) Loop Statements: Lets look at how these statements are represented. We will follow the exact method that we did for conditional statement.

Adding condition statements to the keyword view: For my examples above I have added the conditional statements from the Expert view and we merely looked at their representation in the Keyword view. So far we have not added them directly from the keyword view. Keyword view does provide a way for these statements to be added directly to the test. Here is how you can do it. Click anywhere in the keyword view, just like how you would do it to add a standard statement, right click and choose Insert->Step followed by Conditional Statement and the statement that you would need. Here is how it looks:

As you can see above, An If..Then, Elseif..then, Else are the statements that can be chosen based on the requirement of the tester. Let us choose an if..then and see what happens.

This is what gets inserted. Now, just the way we would do for a standard step, we will need to define a conditional statement too. Item: Click on the item column corresponding to the if statement and all the objects available will be displayed. This feature again is no different from the standard step definition. So choose an object that you wish to act on. As an example, I am going to check if the Password field exists. So I choose Password from the list. Operation: Again, a list of all the functions available will be displayed when this column is clicked on. Since I am checking if the password field exists or not, I will choose Exist Value: The argument/arguments for the function is what this field is. For the Exist function an argument is not necessary so we will leave it empty. Let us now look at how this new statement looks in the keyword view as well as what it looks like in Expert view. Keyword view

Expert view:

As you can see, the if statement is defined. Now, we have to add code or statements to define what needs to be done if the condition becomes true. For the sake of our example, if the password box exists we will enter a value in the field. How can we accomplish this? Once a conditional or loop statement are added any steps that the user adds or records will be directly added under them unless explicitly specified. The statement added or recorded could be a standard step or another conditional or loop statements (nesting). So, to define the Then part of our if statement, I am going to record the action of entering the password value. To do so, I will choose Record from the menu options and enter a password value in the Flights Login page. Take a look at the screen shots below, the recorded statement got directly added under the if statement.

Any steps you add further will be added under to the if..then block. To want to add outside the block, select the block (the if statement), right click and choose Insert New Step after block

The new step just comes as a sibling to the if block.

Now, that we have understood the basic functionality it goes without saying that all the other conditional statements work the same way and any of them can be used as needed by the programmers logic. Adding Loop statements to the keyword view: The procedure to add the loop statement is by right clicking in the keyword where you want it inserted and choosing Insert New Step->Loop Statement and the required option.

As always, the inserted step has to be defined. Any steps recorded or added after the loop will be within the block and to exit the block the user has to be explicitly specify that the new step is to be added outside the block by right clicking on the loop statement and choosing Insert New step after block option. Let us add a For Statement as an example. I chose the For from the menu option and this is what gets inserted into the keyword view:

In the value column I will set the iterator value. I set it as 1 to 3. Next I added a statement as msgbox x. Lets look at how this looks in the keyword view.

Conclusion: So, that concludes our session on the conditional and loop statements and how they can be inserted from the keyword view. If or loop statements can be pretty much added just the way a standard step is added. Just like a standard step these steps also need to be defined. Steps that are recorded or added after a block statement will be added within the block by default unless specified. When a statement has to be added outside the loop we need to choose the option

Insert new step after block option from the right click menu after choosing the block after which we desire the steps to follow. Other features of the Keyword View: We are almost approaching the end of sessions concerning the Keyword View of QTP. How it looks, what it does, what can we do with it These are some of the aspects we are trying to unveil in the course of our articles. Understanding the view, adding steps, conditional statements are already dealt with. Today well learn remaining Keyword View features such as moving steps, deleting steps and dealing with breakpoints. Just like always, we will use the sample test we have been working with The login operation on the Flight sample application. Moving steps: 1) The first and the simplest way Keyword view acts like any text modification application when it comes to cutting, copying and pasting the steps. Thus, all the clipboard shortcuts are applicable. Ctrl+C Copying Ctrl+V Moving Ctrl+X- Cut 2) The next way is by choosing the menu option. To use this, select the step that needs to be moved and choose the following menu choices: Edit->Cut Edit->Copy Edit->Paste 3) The other method is dragging and dropping. Any of the above methods can be used to move steps. However, there are few ground rules: 1. The loop or condition statements can only be moved in blocks. For example, for an ifelse statement you cannot just move the else part. 2. In a step, where the item is a child object and the user decides to move it, there is one of the two scenarios that come up. Either the step gets moved under the same parent or to a different parent. If it is moved under the same parent, it simply comes up in the new position chosen. But if it is moved under a different parent, the parent gets duplicated. Lets see this pictorially: [Note - click on any image to enlarge]

I am going to move the step where we enter the agent name (the one highlighted above) under the Flight Reservation parent object. Lets note that the parent object for Agent Name is Login. I simply dragged the step to be the last one. This is how, it appears:

Earlier in the introduction sessions, we have discussed that we can have multiple actions in a test. Let us see how a test with multiple actions would appear in the keyword view and how this view can be used these actions as desired. To achieve this is, I am simply going to convert all the steps under the parent object Flight Reservation in our above example to appear under another action. Adding actions, steps to actions all these are going to be discussed in detail as we move on in our sessions. Action 1:

Action2:

As you can notice in the test flow pane, the sequence in which these actions are executed is displayed.

If I would want the Action 2 to run first followed by Action 1, keyword view l ets me do that by allowing me to drag and drop the actions to the necessary position. With this, we have covered all the information necessary to move steps/actions/blocks within a test using the keyword view. Delete Steps: Deleting steps from QTP could not have been simpler. All you need to do is choose the step that you do not want in the test and simply hit the Delete button on the keyboard or right click on a step and select Delete from the menu or select a step and choose Edit->Delete from the main menu.

If a step that has sub-steps defined for it is chosen for deletion, the following message is displayed to the user:

What this means is that, if a step with sub-steps is chosen for deletion, all the sub-steps get deleted too. And, thats all there is to discuss about deleting steps. Adding Breakpoints to the test from the keyword view: Often, during the execution there might be one or more things that you want to key an eye out for and observe what kind of changes are happening. This might be to see the state an Object gets to or to note a value a variable takes etc. A facility that helps us do just that is a Breakpoint. It is basically a certain point in your test where you want to pause the test run and observe or obtain certain information about your test. Most times this feature makes debugging easier.

Now, that we know what a breakpoint is, we will try to understand how to add them to our tests from the keyword view. All you need to do is, click in the left margin at the particular step where you need to pause the test. The addition of a breakpoint is represented by a red dot in the left margin corresponding to the step where a break is added. Here is how it looks:

Selecting a step and pressing F9 on the keyboard also results in the addition of a breakpoint.

Lastly, the menu option Debug->Insert/Remove Breakpoint can also be used. So, once a breakpoint gets inserted, the test will run until the step where it is inserted normally and will come to a halt before executing it. At the point the tester can perform the required observations for which the program was stopped and continue to run it by choosing the Run option one more time from the main menu whenever he is ready. If we add a breakpoint from the keyword view, the same is displayed in the Expert view also in front of the line corresponding to the row to which it gets added.

The vice versa is true too, if you add a breakpoint from the Expert view, it gets reflected in the keyword view. As simple as it is to insert a breakpoint it is even simpler to delete is once its purpose is served or when it is no longer needed. Delete Breakpoints Clicking one more time on the line where the breakpoint already exists will result in its deletion. Keyword F9 or the menu option Debug->Insert or Delete Breakpoint can be chosen on a step with a breakpoint and it gets removed. Conclusion: So this concludes the discussion of all the properties and capabilities of keyword view in detail. This view is the most readable one among the two and once all the features are understood, we can use it as effectively as possible to make the tests robust.

Understanding QTP Record and Run Settings for Our First Test The last few QTP tutorials have been about the QTPs Keyword view which was really crucial in getting a high-level understanding of a QTP tests structure and also introduced us to few ways in which our tests can be tailored to meet our needs. So I think we are ready to record our first test in its entirety. We are going to do just that in the next few QTP training articles. Todays topic, therefore is the first step in doing so which is the Record and Run settings. We are going to understand all about this, why it is important and how this can affect a test. Record and Run Settings Dialog When QTP is launched and we choose to record a new test, the record and run settings dialog opens up. Alternately a user can choose to access this window by choosing Automation>Record and Run Settings option from the menu. So far in our examples we have just continued with its default settings but now we will explore it further. The following is the how this dialog looks:

As the same suggests, this is a space that QTP provides the user to set certain parameters that help the user to create a test via record and to execute the same during a run session. QTP can record and run a test on either a windows app or a web app. The web tab is available only when the Web add-in is selected to be loaded at start up. This tab is used for Web, .NET Web Forms, PeopleSoft, and Web-based SAP objects. So there are 2 tabs to define the settings separately for each of these environments. There will be a separate Siebel tab available is a Siebel add-in is installed and loaded during start up. Lets look at the Web tab first: Web Tab on Record and Run Settings Dialog: The default settings are as shown in the picture above. This setting means that when a record session is started the target of the record operation can be any of the web application that is already open in a browser. The user also has a instruct QTP to ignore certain web pages like QC or any other page with a specific URL or a specific title. The way he can do that is, Tools>Options->Web and define those pages in the following QTP dialog:

But if the user chooses, the next option Open the following address when a record or run session begins the corresponding elements in the screen get enabled. Take a look at it below:

The user can enter the address of any page and the choice of the browser. The browsers that QTP 11 supports are:

The browsers that are supported and are currently installed in your machine will only appear in the list. There is another way to set the record and run settings other than from this window and that method is through Environment variables. Since we did not yet get there, we will discuss them in detail later on. For the sake of mentioning, if the environment variables URL_env andBrowser_env are set, then it overrides the URL and browser chosen in the Record and Run Setting window. How to create these and how they work all this will be dealt with later. Do not record and run on browsers that are already open If this option is chosen all the browsers that are open prior to recording and running and also prior to launching QTP will be ignored. It is as if these browsers dont exist for QTP because the user can not even spy these pages to view the objects. In other words, these browsers are totally ignored and as a result deemed inaccessible to QTP.

Close the browser when the test closes this option when chosen will close the browsers on which the record and/or run session was carried out when the test ends. Windows Tab on Record and Run Settings Dialog: This tab is for the windows based applications. The default option to record and run on any windows app opened.

If the Record and Run only on option is chosen, the other options under it get activated. 1. Applications opened by QuickTest: when this option is chosen, the applications that are opened as a result of an invoke operation performed by Quick Test are only chosen for recording 2. Applications opened via the Desktop (by the Windows shell):This means that the application that are opened from a windows desktop are chosen 3. Applications specified below: choosing this option will open another child window where a specific app to be opened by the QTP at the beginning of a record or run session can be defined.

As you can see from the above window, the path of an application and its folder should be added and QTP opens that particular app while record and/or run. That concludes a quick introduction to various record and run settings that can be used for a QTP test. When testing a web app, it is also important to make sure that we add the correct settings in the windows application tab too. It is crucial because, it will help us in preventing opening up of unnecessary applications and also to make sure that we do not accidentally change any of the already open windows applications. It should be noted that, the setting in the windows tab do not directly affect the testing performed on a web app. So the recommended settings for the windows tab while testing a web app are:

Once these settings are done, the test recording begins. Any operation performed on the test gets recorded in the QTP. The tester can stop the record operation once all the steps that he wished to perform on the AUT are done by clicking on the STOP option available in the QTP menu. The recorded steps can then be re-performed on the AUT by choosing RUN option from QTP. Run operation too invokes the application (web or windows) depending on the setting specified. Conclusion This forms the basis for performing any basic steps on the AUT using QTP. In the real world this alone isnt sufficient. Testing as an activity is verification and validation inclusive, so we will have to tailor these basic lines of code to include certain verification and validation points. To do so, QTP provides some checkpoints and the tester can also programmatically add steps to check few things as needed. We will discuss these checkpoints in the coming series of articles and also try to learn the best practices to be followed while test creation to ensure maximum efficiency.

QTP Tutorial #7 QTPs Object Identification Paradigm How QTP Identify Objects Uniquely? How QTP Identify Object Uniquely? This is the 7th QTP Tutorial in our QTP training series. We are getting ourselves equipped with all the basic concepts that will enable us to write robust QTP tests. We have covered the QTPrecord and run settings, working with keyword view and the other related topics. This is the next article in the series that talks about a crucial aspect of QTP The mechanism it uses to identify an object uniquely. When you look at the below screen:

There are 3 buttons and 2 text boxes along with various other elements in this dialog. In the previous examples, when we entered the user name and password we saw how QTP recorded the same operations in terms of programmatic code as well as a table in keyword view. Now, during play back how does QTP know that the value we provide as Agent Name or Password has to go respectively in those edit boxes. Or how does it know which button to click to submit the values entered? Let us try to find an answer to that. It is clear that QTP somehow remembers which object to act on. The way it does it is, it stores the object in the AUT as a test object. It then examines its properties and classifies the object. For E.g.: when it encounters the OK button it examines its properties and based on these, it classifies the object as a WinButton. QTP has a predetermined set of properties that it learns/stores for every class of object it identifies. There are 3 aspects to this: 1. Mandatory properties: This is the list of properties for a certain class that QTP always stores. We could say that this is the object description. It also checks this in conjunction with the parent object to see if the description is sufficient to identify the object uniquely.

2. Assistive properties: In case the description of mandatory properties is insufficient to identify the Object a set of non-mandatory properties will be added to the description one after the other until there is enough data to identify the object. 3. Ordinal Identifier: If the assistive properties also do not result in unique identification of an object a special ordinal identifier is added by QTP, such as the objects location on the page or in the source code. So, this is how QTP forms Test Objects. It uses this Test Object description to search for the objects to act on during a run session. It chooses the objects that match perfectly with the description it contains. These objects are called Run-Time objects. Unless your application has changed significantly the Test Object description that QTP has is sufficient to find an object. For the WinButton object that we have in our Flight app, let us see what properties QTP has stored. This information is available in the Object Repository. Menu option Resources->Object Repository will launch the OR for us. Alternately, you can use CTRL+R or click on the icon.

If you notice in the above window, it stored the text in the WinButton as its description to identify this button at runtime. For more complicated applications, the tester can add or remove certain properties to make the description robust enough to identify the object at runtime more precisely. To do this, simply click on the + icon.

All the other properties of the object will be displayed. The user can choose to add one or more of these properties. There is also something called Visual Relation Identifier in the OR screen for the WinButton properties. This is a feature that further supports the object recognition according to their neighboring objects in the AUT. Once set, this creates a kind of link for the less stable components in your AUT with the objects that are more uniquely identifiable. QTP will identify these objects as long as they maintain their relative position to these unique objects. To set a kind of positional link we are going to have to click on this column in the OR and the following screen comes up:

In this screen select the + sign to add an object with which you want your test object to have a positional link. I will choose Agent Name and say that this object should be above OKbutton. This is how I set that:

Now, in case some properties of OK button changes in the future, QTP will identify it if, Agent Name is above it. Smart identification:

This is the mechanism employed by QTP under one of these two situations. The description for an object that QTP has: 1. does not match with any run time objects 2. Matches with multiple objects This is a little bit of an advanced concept, so we will get to it at a later time via some example for easy and elaborate understanding. Ordinal identifier: This is a numeric value that depicts the relative order of the object with objects that have a similar description. If an object 1 and Object 2 have the same mandatory and assistive properties, then the ordinal identifier will be used to recognize the object uniquely. This value is related to the other objects of the screen, so in case anything changes in the screen, this identifier might not come useful.

It should be noted that, if the mandatory and assistive properties are enough then an ordinal identifier is not assigned during record. It can be added later on by clicking on the respective column for the object in the OR There are 3 kinds of ordinal identifiers: 1. Index: this is based on the order of appearance of an object in the application code 2. Location: based on the location in a screen or dialog or page 3. Creation Time: This is used only for browser objects. In case 2 browsers with similar properties exist, then the one that is created first and next are considered. For example, Let us understand how index identifier works in our Flight application s login screen: These are the following components:

As you can see, the static text and the edit boxes have the same text property. If I know that one of them is a static text and the other is WinEdit object, then there is no problem at all. Say if all these are treated as WinObject then I will have to specify which object to act on. This is only going to happen when the mandatory, assistive and smart identification have failed. So in order to tell QTP which is what, I am going to assign an Index ordinal identifier. I will do so from the OR.

I will set the Agent name static text identifier as 0 and for the editbox I will set it as 1. This is how it looks:

So if I need to access the static text then I will do so as follows: WinObject(text:=Agent Name:, index:=0) This will refer to the static text WinObject(text:=Agent Name:, index:=1) This will refer to Edit box The same theory applies to Location identifier too except that we will choose the location in the window to determine the numeric value that is applicable to a certain object. Configuring Object identification properties: The mandatory, assistive properties and ordinal identifiers to be considered for an object of a certain class to be recognized can be configured by using Tools->Object Identifier. We can also set the smart identification properties through this window. The window looks as follows:

As can be seen in this above image, the environment can be chosen from the drop-down box. Once that is chosen the classes of objects in the corresponding environments are shown in the list. After an object is selected, the mandatory and assistive properties are displayed. The user can Add/Remove additional properties to this list. Also smart identification can be enabled/disabled for a certain class of object when needed. To set the ordinal identifier there is a drop-down that can be chosen to identify the object using Location, Index or Creation Time (only for browser type only).

QTP Tutorial #8 Learn About QTP Recording Modes, Object Spy and Object Repositories In this article we will talk about the different recording modes, Object Spy and Object repositories in QTP. Recording Modes in QTP: Recording is the most commonly used method to create a test. The basic steps are typically recorded and the test later under goes improvements in order to suit the needs of the testing process.

QTP provides 3 modes of recording: 1. Normal 2. Low-level 3. Analog Though only the normal recording mode gets used most of the times, it is important to know the others too, as the knowledge about the same can come handy when the need arises for them. Normal Recording mode- The default recording method is always the normal mode. In all our previous articles when we say record we meant the normal mode. So, as we know this method uses the model of Test Objects and Runtime objects to learn and act on the AUT. Analog recording mode- records the exact mouse and key strokes that the user performs in relation to either the screen or AUT window. The steps that are recorded using this method cannot be edited. The way this usually gets represented in a code is: Window/app.RunAnalog Track1 One scenario in which this type of recording can be used is when we are trying to capture a signature. Low Level recording mode- This mode records the co-ordinates in the application where the operation is performed, irrespective of whether QTP recognizes the specific Object or Operation. Some important points to note about these different modes are: 1. In the middle of recording, we can switch to Analog/Low-level mode, finish the task required and go back to normal recording 2. Analog and Low-level recording modes require more memory space than the normal mode. 3. Mouse movements are not recorded in the low-level recording mode 4. The switch to Analog mode is available only during recording and not during editing 5. The test that is recorded in an analog mode will fail if it is run after changing the screen resolution. The menu option to change the recording mode is:

3.Running

Modes

a. Run - Normal Run, if we don't have any errors or show stopers then we can use this mode b. Run From Step - Perticular portion of the scripts we can execute or we can execute specific Action. c. Update Run - This can be used to update Object Properties, Check Points Properties and Active Screen images and values. d. Debug Run - To Identify the problems we can use the Debug mode. By using Step-In, Step_Out and Step-Over we can identify the problem fastly. When object has changed in application and QTP is able to recognize the object by smart identification(or any other way) Then Maintenance Run mode provide a dialog displaying the changed properties. Here user can update or keep the same original object property. But in Update Run mode object properties are updated directly without providing any alert dialog. When object has changed and QTP is not able to recognize the object.

Then Maintenance Run Mode asks user find the object in application and update one/many/all properties associated with that object. But in Update run mode, QTP throws error.

Quick test professional test run options for maintenance & updating the test object properties are two ways and here we provided whats is the basic difference for better understanding. Maintenance Mode : If QTP doesn't recognize the test object by means of using defined identification properties, tool will pop up message with expected and actual properties giving an option to select the new properties, update and save the current test. Update Mode : QTP would recognize the test object by non-identified or stored object properties, tool would not pop up message with stored and actual properties giving an option to select the new properties, update and save the current test. Rather it would update on self methods and save's the current test.

Object Spy: Object Spy is an extremely helpful tool that QTP has to view the properties and operations of an object in the AUT. The prerequisite to using this tool is that the AUT has to be opened. The Object Spy can be accessed by using Tools->Object Spy or by directly clicking on the below

It is also available from the Object repository and Object repository manager windows. When Object Spy is launched, this is how its interface looks:

By clicking on the pointy hand you can point to any object whose properties you wish to examine. This is how it displays the properties:

As you can see, it shows all the properties of the object and the corresponding values. It shows the object hierarchy. There is also an Operations tab which when clicked displays all the operations that can be performed on the test object:

The spy not only displays the properties, it also has a provision that lets the users add a certain object to the OR.

You can do that by clicking on the OR icon with a + in it. Object Repository In one of the previous articles we talked about how an OR is like a warehouse where all your objects are stored. OR has the list of Objects that QTP learned during the record process and the class to which they belong. It stores the set of properties that uniquely identifies the Object (description) and also names the object for the sake of identification in our test, based on its most prominent feature.

The objects that are acted upon during record get automatically added to the OR. Alternately, the user can add additional objects on a need basis. This can be done directly from the OR window or from Object Spy. (Ctrl+R or Resources->Object Repository or click on the icon.) There are two kinds of repositories: 1. Local 2. Shared Every time a test is created we have seen that a call to Action 1 is the only statement by default. We can add other actions and call them as needed. So, for every action QTP creates its own local repository by default. It contains the objects that are related to that particular action. Conversely, the user may decide to use a common repository for multiple actions in which case, this repository is to be associated with the actions and all of them can share the objects that it contains. This can be done using the Object Repository manager. The objects can be exported from a local repository into the shared one to maintain a single location for all the objects. Also, a shared repository is read-only in the action level and any changes to it have to be made via Object Repository manager. The repository to be used by an action has to be specified in the action properties. How is it done practically is something we will look into using some examples later on. Some of the important points to note here are: 1. Even though there is a single shared repository for all actions every action will have its own local repository whether the test uses it or not. For example: For test 1 if there are Action 0, Action 1 and Action 2 and there is a shared repository ORShared, there will be local repositories OR0, OR1 and OR2 by default. However, if all the actions use one shared repository, local OR will be empty. 2. If a local OR and Shared OR have an object with the same name, the action will consider the object in its local OR. 3. There can be more than one Shared ORs associated to the same action. If Shared OR1 and Shared OR2 have one object named OBJ1 each and if the action calls for OBJ1 then the order in which the shared ORs were associated will be considered. That means, if Shared OR1 was first associated then the OBJ1 from Shared OR1 will be taken into account. It goes without saying that having a shared Object Repository is more efficient as it helps in easy maintenance and you can use one object description across multiple actions. Here we covered some of the key concepts that will enable us to understand and create better QTP Tests. In my opinion information on Actions, Active screen and a rather impromptu but

important password encoder tool are few more aspects we will have to cover before we move to more advanced topics.

QTP Tutorial #9 VBScript Basics You Should Know to Write Robust QTP Tests Part 1

Today we will take a look at the basic VB scripting concepts. VB script is the language that QTP uses for its tests. While QTP is quite a user friendly tool, it is very important for the tester to be able to have a basic programming skill using VB Script to be able to effectively create, maintain and execute QTP tests. Basic of VB Scripting Concepts to Learn QTP It should be noted that this article is not an exhaustive list of all the VB Script features. Consider this as a place that will introduce you to certain key concepts to guide you while you attempt to self-learn the language. Since the expert view of QTP is a VB Script editor, it is a must that we try to understand VBscript for QTP before we move on to our articles on QTP Expert View. VBScript data types and subtypes: Data types: 1) There is only one data type: Variant. It can store different kinds of information based on the context in which it is used. 2) If used in a numeric context it is a number or a string if used in a string expression. 3) If a number has to behave as a string we could enclose it within . 4) There are various subtypes to a variant. You can explicitly specify these subtypes to achieve a clear definition for your data. The below is a screen shot from the VB User guide that shows all the subtypes of data that can be used: (click on image to enlarge)

5) Conversion functions can be used to convert one subtype of data into another. 6) Since it is the only data type available, all the return values from a function are variants. Here are different VBScripting examples you can try on your own. Variables: 1) A variable is nothing but a space in the computers memory that can store certain information. This information is bound to change from time to time. Where the information goes physically is immaterial but when needed, it can be accessed or changed by addressing the name of the variable. E.g: If there is statement that you want to run a number of times, you could use a variable to contain that count. Say X. X is a variable that can be used to stored, change and use the space in the memory where we want to keep the count. 2) All variables are of the datatype Variant. 3) Declaring a variable prior to its use is optional, although its a good practice to do so. 4) To make the declaration mandatory there is a Option ExplicitStatement available.To declare variables: Dim x This declares x Dim x, y, z This declares multiple variables X=10 This is how a value is assigned. As a general rule, the variable is the left hand side component and the right is its value. X=Swati this is the way a string value is assigned. To make declarations mandatory this is how the code has to be written: Option Explicit Dim x, stri If Option explicit statement was not used, we could have directly written: x=100

stri=Swati and it would not have thrown an error. 5) Naming convention: Names must start with an alphabetic character, must be unique, cannot contain and embedded period and cannot exceed 255 chars. 6) A variable containing a single value is a scalar variable and the one that has more than one is an array. 7) A one dimensional Array can be declared as: Dim A(10). All the arrays in VB Script are zero based that means the array index starts from 0 through the number declared. That means, our array A has 11 elements. Starting from 0 to 10.

8) To declare a 2 dimensional array simply separate the row count and column count by a comma. Eg: Dim A(5, 3). This means it has 6 rows and 4 columns. The first number is always row and the second always a comma. 9) There is also a dynamic array whose size can change during run time. These arrays can be declared using dim or redim statements. If an array is declared as Dim A(10) and during run time if we need more space we can so the same by using the statement: redim A(10). There is a Preserve statement that can be used in conjunction with the redim statement. Dim A(10,10) . Redim preserve A(10,20) This piece of code shows how we do it. Initially A is a 11 by 11 array. Then we are resizing it to be a 11 by 21 array and the preserve statement will make sure that the data that is previously contained in the array is not lost. Constants: 1. As the name implies a constant is nothing but an unchanging value in a program that is assigned a name. 2. They can be declared by prefixing Const to a name. 3. Eg: Const a=10 or Const Astr=Swati. 4. This value cannot be changed accidentally while the script is running. Operators: Some of the important operators that are most commonly used are: 1. 2. 3. 4. 5. String concatenation: & (Eg: Dim x=good&day, so x contains goodday Addition (+) Subtraction (-) Multiplication (*) Division(/)

6. Logical negation (Not) 7. Logical conjunction (And) 8. Logical disjunction ( Or) 9. Equality(=) 10. Inequality (<>) 11. Less than (<) 12. Greater than(>) 13. Less than or equal to(<=) 14. Greater than or equal to (>=) 15. Object equivalence(Is) It is important to note that the list is not complete but merely a subset containing the most commonly used operators. The operator precedence rules are: 1. Multiplication or Division take precedence over addition or subtraction 2. If multiplication and division exist in the same expression, then left to right order is considered 3. If Addition and subtraction occur in the same expression,then too, left and right order is taken into consideration. 4. The order can be over ridden by using parenthesis. In this case, the expression within the parenthesis is executed first. 5. & operator takes precedence after all arithmetic operators and before all logical operators. Conclusion So, this being the VBScript basics, in the coming article we will look into how we can write loop and conditional statements that are essential in building the programming logic. The next article will be the last in the VB Script series before we move on back to QTPs expert view.

QTP Tutorial #10 Writing Loop and Conditional Statements VB Script Basics Part 2 VB Scripting Basics Writing Loop and Conditional Statements for Building the Programming Logic In the last VB Scripting article we saw some of the basic features of VB script. We are going to learn a few more programming concepts before we conclude our introduction series.

Conditional Statements: 1) If statement: If {Statement Else {Statement End (condition)..Then statement} statement} if

or or

a a

block block

of of

This is the typical syntax to write this statement. The if..then..else statements can be nested to any number of levels. Alternately, the else block can be used or not. Elseif is another variation that can be used when choosing between one of the multiple options. if x=0 then Msgbox value=0 Elseif x=1 then msgbox value=1 Elseif x=2 then msgbox value=2 Else msgbox value not found End if 2) Select statement This is to choose one out of the many options depending on the condition that comes satisfied. The condition is evaluated once and based on the value it attains one of the following blocks of code gets chosen to be run. Select Case (expression) Case case1 {Block 1} Case case 2 {Block 2} ..

Case {Else End Select Looping statements:

Else block}

There are 4 kinds of loop statements: 1) Doloop: This is used when a statement or a block of statements need to be executed while or until a said condition is true. Let us first look at the syntax of this: Syntax 1: Do (While | Until) condition {Statement or statements} [Exit Do] {Statement or statements} Loop Syntax 2: Do {statement or statements] [Exit Do] {statement or statements] Loop [{While | Until} condition] Condition: could be a numeric or string component that either attains a true or false value. If the condition is null it is treated as False. Observe the Exit do in the above. There is also a slight difference between the syntax 1 and syntax 2. In case of syntax 1, the statements within the do loop do not get executed unless, the condition becomes true or holds true. For syntax 2, the statements within the loop get executed at least once and then the check is performed on the condition. Exit Do: In order to avoid infinite loops we will have to force the loop to exit. Exit Do is a statement that is used in such circumstances. 2)Whilewend Syntax: While {Statement or block of statement} Wend It is self explanatory from the syntax that the statements nestled under the while block get executed as long as the condition holds true.

Although this statement is available, it is not very flexible so it is recommended to use the DoLoop statement. 3) ForNext This is the statement that you would use when you want a statement/set of statements to run a certain number of times while a certain counter gets incremented or decremented. For counter = start To end [Step step] [statements] [Exit For] [statements] Next As you can see from the syntax above, there is a Step clause to this statement. This clause is optional. The step clause if not specified, the for loop steps one counter forward by default The step can be used to increment or decrement the counter value Exit For is similar to Exit Do, it can be used to come out of the For block and execute the statement that follow. Any number of Exit For statements can be used within one block of For statement It is usually used with a if..then statement to make sure some condition that would lead to infinitely looping is true and in case if it does, the For statement has a way to exit. Any number of For statements can be nested within a For. Example:

For i=1 to 10 If x=true then Exit for End if Next Example for a positive step: For i = 2 To 12 Step 2 total = total + k Next Example for a negative step: For i = 12 To 2 Step -2 total = total + k Next 4) For eachnext: This is similar to For next. This is used for collection objects or arrays. This statement runs a statement or a set of statements for every object or item in an array instead of a number of times specified. As the Fornext statement Exit for is used to exit before the looping is through,

like in case of an error. Also, any number of For Each statements can be nested within each other. Syntax: For Each element In group [statements] [Exit For] [statements] Next [element] Element is the variable that is used to iterate through the elements in the array or collection object group stands for the name of the collection object or array Note: We have not discussed collection objects so far in our series, but a collection object is nothing but an object which is a set of related items (objects, these might be of the same type or could be of different types) Best Practices for Code Writing in VB Script 1. In the beginning of every program, write down a brief description of what the program does 2. Provide comments for every variable used during its declaration to briefly describe what this variable is going to do 3. Keep the code modular, as much as possible 4. Have the main program readable and have all the logic segregated in terms of function, so it makes them easy to read and maintain. 5. The segregation of code into functions will also increase reusability 6. An agreed naming convention has to be used to maintain consistency 7. Comments Provide comments to make the code more understandable 8. Indentation Make sure that you indent the lines of code to clearly understand the sequence of execution 9. Option Explicit is to be declared so that you dont run into issue when you have a spelling mistake of a variable name 10. Watch out for infinite loops Conclusion This concludes our brief introduction to VB Script. As already mentioned, this is in no way a complete guide to learning the scripting language, but enough to get us through writing beginner to moderate level QTP programs. There is one topic of functions that we did not cover here but that exclusion was deliberate. It is because, functions is a full length and a very important topic which we will discuss in detail in the coming articles. QTP Tutorial #11 Use of Password Encoder and Active Screen Explained With Examples

QTP Password tool: For obvious reasons websites do not display password even while we are providing it as an input to sign in. QTP has a unique feature that will preserve the password from being out in the open thus maintaining the passwords integrity. As you might have noticed when we enter the password as Mercury in the flights application a long and illegible sequence of characters is set in the password edit box. This is how it looks: Dialog(Login).WinEdit(Password:).SetSecure 512c58cda469a14c01aa536f4a1a6a544d7d09e6 In the above line of code we can see that the password is encrypted. QTP records a SetSecure method when a password is entered. It automatically encodes the password entered during login and decodes the same while running the test. This is a mechanism that QTP employs to hide the password on the screen. The user can also choose to enter a value discreetly into a non-password text box by using the SetSecure method and a encrypted equivalent of the text to be entered as a parameter. If a need arises that we need to set a secure value in a certain text box then QTP comes with a tool called Password Encoder. This tool will take a regular text and encodes it. The Password Encoder Utility is available at: Start > Programs > HP QuickTest Professional > Tools > Password Encoder It launches the following app:

The tool is very user-friendly and self explanatory. When the Password field is provided with an input, the Generate button becomes active and on clicking it, the encoded text is displayed in the Encoded String field. The same can be

copied to the clipboard by clicking on the Copy button which gets enabled when the encoded password is generated. For example:

Click Generate:

The encoded text can be used as a direct input to a text/edit box or as a parameter in the DataTable. Active Screen: This is another versatile feature that QTP provides to make the testing process more transparent to the user. While recording QTP saves a snap shot of the application state when a certain operation was performed on it. The amount of details that you want your active screen to store and record depends on the settings. Before we talk more about the settings and what it means let us take a look at how the active screen looks. To view the active screen, click on View->Active Screen. Here I have a test that creates a Gmail account and I chose to view the active screen. This is how it looks: [Click to enlarge image]

As you can see, when I have the statement selected the corresponding object on which the statement acted upon is highlighted in the snap shot that the active screen has captured. Let us see what happens when I move to the next statement, (Click to enlarge image)

The corresponding text box where I am trying to enter the First Name is highlighted and as it can be noted this is no longer the Gmail page, it is the create a new Google account page. Now let us see what how much of information can we ask QTP to store in this snap shot while recording and how do we do it. Choose Tools->Options->Active Screen from the menu. It opens up the following window:

Each level of capture and its corresponding features are explained in this window. The default setting is as you see it in the screen shot.

The levels can be changed as required. The following are the levels and what each level means gets displayed as the user sets them. 1. Complete 2. Partial(Default) 3. Minimum 4. None The capture level can be decreased or increased even after a test is created. Alternately the user can set a custom level of active screen capture by clicking on the Custom Level button and choosing the relevant options. The active screen, apart from being a visual aid at examining process also has several important aspects that can help the tester to manipulate the tests as required. 1. The Objects in the Active screen can be added to the local or shared object repositories. 2. Check-points can be added from this screen.

3. Output values can be added 4. Parameterization for the fields can also be done from this screen 5. Steps can be added to the test For example, in our Gmail page earlier if I choose to add the Sign in button to the repository I can do that by right clicking on the object and the following options get displayed for me to choose from: (Click to enlarge image)

As you can see, I can insert a checkpoint, output value or choose to view or add object among other things. Although we are yet to uncover the checkpoint and output value features, it is inevitable to mention them here, as they are some key functionality that the active screen helps with. Replacing the active screen for a certain step: In case a need arises for me to change the active screen that got recorded by default, QTP provides me a way to do that. Choose the option Tools->Change Active screen from the menu and QTP lets you go to the new screen and when you click on the new screen, the control goes back to QTP with the following confirmation message: (Click to enlarge image)

On choosing Yes to this message, the new screen will be displayed hence forth when active screen for that step is viewed. If all the snap shots in your test have to be replaced or updated, you can choose to run the test in Update Run mode. You might be able to guess what this means, but in any case we will have a detailed discussion on it later on in the coming articles.

Real time use of active screen is when you want to make changes to the test without opening your application but just from the screen captured during record. Although it must be noted that tests with Active screen captured occupy way more disk space than the ones without it. On saving a test using Save as an option to exclude Active screen is available to the user.

So what you can do is, record a test with active screen, modify it as needed while leveraging as many features as you can from it and Save as a new test without the active screen. This ensures that your tests are easy on disk space at the same time you get to use the active screen to your benefit while it was needed. That is some brief insight into the topics, password encoder and Active screen. The next article is going to be about Expert view, Step generator, and we will try to include some checkpoints too. Please feel free to post your questions. QTP Tutorial #12 Expert View, Step Generator and Checkpoints Explained with Example It is going to be an article on Expert View overview, Step generator and a brief introduction to Checkpoints that will be carried on further until we cover all the details elaborately with examples on how to use these while recording actual scripts. This is 12th tutorial in QTP training series. Expert view of QTP Expert view is where the operations we performed on the AUT get displayed as VB Script code. For every LOC in this view, there is a corresponding column in Keyword view. There is also the action drop down box that can be used to access, view and edit different actions in the test. This view is particularly useful for users who are familiar with programming using VB script. One of the most important uses of this view is that it facilitates the creation of functions and function libraries. (a topic for detailed discussion later) The user can print the test or function library as it appears in this view any time. File>Print will print the test. This is how it looks:

You can add statements to this view directly by typing in or by using step generator. Step generator: This is a facility that QTP provides in order to make adding programmatic steps into QTP easy for the user. You can use it in the Keyword view, function library, Active screen or Expert view to generate steps It can be used to write steps into a test or to a function library. To launch, use the menu option Insert->Step Generator menu option. Right click any where you want the step to go and select Insert Step-> Step generator or F7(except in Active screen)

Example: I will explain this with a scenario: Open www.gmail.com and click on Create Account link. This is how this statement will look.

1 Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Link("Create an account").Click If I need to check if the link exists at all, before I write the code to click on it, I will need a step before the above statement. This is how I do it: Step # 1) Select the place where you need the step inserted. a) Expert view: Place the cursor where you want the step to go and launch step generator. b) Keyword view: Select the step below which you want to insert the step. c) Active screen: In the active screen window, right click and choose the step generator option. It will ask you to choose the object on which your step should be based on. Following that the step generator window is launched.

Step #2) This is the step generator window that gets launched. Please note the details that it is displaying now. It is showing all the details related to the step that is currently chosen. We can choose the required values for the new step but that does not affect the current step.

I am going to set the values as required by me to enable checking if the link exists.

As you can see, I chose a Test Object, Create an account link and chose the operation Exist. I left the arguments empty because it is optional and chose that the return value of the operation be stored in a variable var_Exist. It displays the VB Script statement, as it is going to appear in the Expert view in the Generated Step field. In other words, the syntax. Step #3) The drop down where I chose a test object, I can alternately choose to base my step on a utility object or Functions.

Step #4) Object: this field contains a list of required object or the function library source. Step #5) Operation field will let you choose the appropriate method, property or function. Step #6) Arguments and Return value: These fields are self explanatory. The user could parametewise the arguments or provide constant values. Step #7) The user can just insert one statement or choose to follow it with another one by checking the Insert another step option ON. Step #8) So, back to our example. I will click OK. This is the statement that gets inserted. 1 var_Exist = Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Link("Create an acc 2 Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Link("Create an account").Click Checkpoints We have so far encountered in various places of your articles, somereferences to checkpoints. There are many ways to define what a checkpoint is, this is mine It is a logical point in your test where you are trying to establish if there is a match between a certain expected value to the actual value as it exists on the AUT.

We have talked earlier; QTP provides certain inbuilt checkpoints but does not limit the user to just those. At any point in a test, the tester is free to build any number of check points in his test to include verification points. That according to me is one of the most versatile features in QTP. It is obvious that custom checkpoints are entirely relative to each ones problem at hand. We will equip ourselves with basic concepts on the checkpoints that come as an integral part of QTP.

1) When a checkpoint is added, QTP adds a Check CheckPoint in the Expert view and a corresponding row in the keyword view. Example: 1 Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Check CheckPoint("Gmail: Ema 2) The user can have the check point statement return a boolen value that depicts the result of the checkpoint. If it passed, it returns a 1 and 0 if failed. To be able to that, we need to use parentheses around the checkpoint argument in the statement in the Expert View. Example: 1 i=Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Check(CheckPoint("Gmail: E 3) By default, the name of the checkpoint will be the name of the object on which this check is performed. 4) The user can accept this name or change it 5) When the test runs, if the expected value matches with the actual one for the checkpoint, the checkpoint passes otherwise it fails. 6) The results can be viewed in the Run Results viewer. There are 10 checkpoints that QTP provides to its users: 1. Standard Checkpoint 2. Image Checkpoint 3. Bitmap Checkpoint 4. Page Checkpoint 5. Text Checkpoint 6. XML Checkpoint 7. Text Area Checkpoint 8. Table Checkpoint 9. Accessibility Checkpoint 10. Database Checkpoint The general way a checkpoint is inserted is after the initial test steps are created. It is possible to add checkpoints during recording or editing though. It is recommended that the tester has preliminary knowledge about all the checkpoints in order to make the right judgment about what checkpoint is apt for the task at hand. We are going to do just that in the next article. We are going to see what each checkpoint does and try to learn how to use them.

QTP Tutorial #22 Using QTP Object Repositories Object Repositories and Object Repository Manager Todays topic is Object repositories. In the previous articles, we have discussed how QTP identifies and stores objects in a warehouse, the OR. We also have seen how the object properties appear in the OR. To quickly recap, we will take a look at the OR screen. You can launch it from your current test by clicking on the icon or from the Resources->Object Repository option. It launches the following Object repository dialog box:

Points to note here: 1. The objects are stored in a hierarchical manner. 2. This is a local repository that contains the objects for Action1. 3. If the action had any checkpoints the same would have been available in this dialog to edit. We also have made multiple references to Shared ORs in our previous articles. Let us learn all about them. A shared object repository stores objects in a file that can be accessed by multiple tests (in read-only mode). One of the important aspects when planning your tests (or choosing aframework for your project) is to consider where and how you want your objects to be stored and how they have to be made available to the tester. The following are some Object Repository types in QTP: 1. Local ORs- each action will have its objects stored in its local repository 2. Shared ORs all the actions will refer to a single read only OR

3. Local and Shared ORs- an action can use both local and multiple shared ORs. In one of our previous tutorial we talked about how objects get selected if a certain action has both Shared OR and Local OR, multiple shared ORs, etc. We will see how a shared OR is created and how we can move objects to and from a shared OR to local or vice versa. To maintain ORs in your test there is a specialized Object Repository Manager that QTP provides. It can be accessed from the menu item Resources->Object Repository Manager. Using ORM you can do the following: Creating New Object Repositories Opening Object Repositories Saving Object Repositories Closing Object Repositories Managing Objects in Shared Object Repositories Managing Repository Parameters Modifying Object Details Locating Test Objects Performing Merge Operations Performing Import and Export Operations In this example, we will see how to create a shared OR for a test, understand how it can be associated and see how the objects can be used. To create a shared OR (.tsr) file, launch ORM. A new repository will open up or you can explicitly do so by using the option File->New. Any OR is only as good as the objects it has. So the next step is obviously to add objects. There are 3 ways you do that from here: Method #1) Define Test objects. Object->Define Test Object on choosing this option the following dialog appears:

In here, you can specify environment, Class, Name, Properties and Add the object to the repository. The screenshot can be a sample data you could enter. Method #2) Add Objects: On choosing this option, the pointy hand gets active, QTP gets minimized and when you click on the object you wish to add, the following dialog shows up and you can add the object.

Method #3) Navigate and Learn: This is the most interesting and most used way. As the name indicates, you just have to instruct QTP to navigate and learn, point to an object in your app and QTP automatically gets the objects depending on your filter settings. Choose this option from the menu or hit F6, in the screenshot notice the little navigate and learn dialog on the top of the page. Now Hit the Learn button in the dialog and click on the page. Navigate as many pages and hit learn as many times as required. Once done, close the Navigate and Learn dialog.

The filter options are as follows:

I chose All Object Types from the dialog and clicked on the main gmail.com page, the following are the objects that get added to the OR:

Using any of the above ways create a shared ORM, add objects and save it.

There is another way objects can be added to a shared OR. It is from the local OR. Open your test or create a new test. Gmail Login- our example. Launch the OR for this test. It looks like this:

I want to create a shared OR that contains the Email, password and Sign In objects. The File Menu has 2 options under it, Export Local Objects and Export and Replace Local Objects. You can use either one of these options. If you use Export Local Objects, the local objects are exported to the specified shared object repository (a file with a .tsr extension). Your test continues to use the objects in the local object repository, and the new shared object repository is not associated with your test. With Export and Replace Local Objects, the new shared object repository (a file with a .tsr extension) is associated with your test, and the objects in the local object repository are deleted. Choose any of the options and choose the shared OR to export to. Associating the shared Object Repository to your test After you decide to use a shared OR for your test, create one and add objects to it, the tester has to explicitly include the .tsr file to the test to be able to use the objects in it. To do so, go to Resources->Associate Repositories. The following dialog box opens up:

Click on the + sign. Choose the OR. Once you choose it, all the actions that are available in your test will appear under the Available Actions box. Select as many or as few as you would like. I just have one, so I am going to go ahead and choose it. Click OK when done.

On successful association, the shared OR will appear in the Resources pane if it is already visible or you can launch the same from View->Resources option.

If you want to remove the association, you can right click on the .tsr in the resources pane and select Remove Repository from List option. Or you can go to Resources->Associated Repositories menu option, select the shared ORM to remove and click on the cross sign. For rules on how a shared OR and Local OR will work, please refer to our tutorial #8. Though there are many other features to ORM and OR, we will limit ourselves to what we have learned in this article as they are the most useful ones. The rest of them are very easy for any tester to figure out on their own once they read this article.

QTP Interview Questions and Answers with Some Useful Interview Tips Below are some useful tips to prepare for QTP interview, followed by the most common QTP interview questions and answers. Actually we had planned this post at the end of our QTP training article series. But many readers requested to provide interview questions so that you can prepare for interview while learning QTP. Note In this post we have covered some useful tips to prepare for QTP interview along with top 20 common and crucial Quick Test Professional questions and answers. Please provide more questions in comments and well update this post with answers to your questions.You can also post your questions using this Share Your QTP Interview Questions page. We devised a list of pre-requisites or non-technical aspects that every QTP interviewee has to be familiar with. Here are some useful tips to prepare for QTP interview:

QTP is merely a tool that facilitates testing. The ultimate goal of QTP- or any other testing tool for that matter- is efficient and effective testing. So, make sure your testing fundamentals are solid. Next undeniably is the knowledge about the QTP tool. Make sure you know all the basic information about the tool. QTP predominantly relies on a testers programming skills to design, develop and maintain tests. That does not mean knowing all the features of the tool or VB Script are enough. The most important skill the automation tester should have is the ability for logic building. QTP tool and VB Script are simply vehicles that help you reach a solution. In the recent days most interviewers are asking questions that either involve writing a script on paper or coding on a QTP installed machine. If you can code on a machine or write the code spontaneously, thats great! If not, I suggest you to write the solution to the problem given to you in simple English statements. This will give a chance to show case your solution forming ability. Explain that to translate this solution into a program is simply a matter of referring to the help files of the programming language to find the equivalent statements. In an interview, when you are writing code, please do not forget to include comments. Showcase good programming practices. Before attending a QTP interview, be sure to know the version of the QTP, the add-ins that you use, the versions of all the other software you are using etc. If you have not been using QTP recently but have had past experience, it helps to take a couple of hours to re-familiarize with the IDE. The most common but crucial questions that are asked in the QTP interview. The best part of these questions is that you have time to prepare an answer in advance before even the interview begins. 1. What are the reasons for choosing to automate your project and why did you choose QTP? 2. What is the most challenging testing situation you faced and how did you overcome it? 3. Did QTP prove efficient for your project? Yes or No, explain? 4. How did you achieve reusability via QTP? 5. Did you find anything in your project that QTP proved inefficient to perform?

6. Under what conditions would you recommend QTP for future projects? We suggest you spend some time with these questions and come up with answers based on your practical experience from using QTP in your respective projects. Another important question that your interviewer would be interested to know is the statistics. For example: 1. How many scripts did you have? 2. How often were they executed? 3. How many lines of code in each script? 4. Did you use function libraries and/or shared ORs? 5. How long to develop a script? 6. Did the scripts need lot of maintenance? If yes, why? Again, be sure to be prepared with the answers to these questions. Last piece of advice, be honest and straightforward. Keep in mind that not all projects are same and not everybody follows the same methods. So we recommend that you have clear understanding of your project and exhibit the potential to learn. Nobody expects you to know everything; they only expect you to know what you do best. Lets move on to the technical QTP questions. QTP Interview Questions and Answered Top 20 Most Asked QuickTest Professional Interview Questions 1) Different types of QTP test assets and their extensions:

2) Technologies supported by QTP: Web, Java (Core and Advanced), .Net, WPF, SAP, Oracle, Siebel, PeopleSoft, Delphi, Power Builder, Stingray 1, Terminal Emulator, Flex, Web Services, Windows Mobile, VisualAge Smalltalk, Silverlight and mainframe terminal emulator 3) Does QTP run in any environment? No, QTP works only in the windows environment. 4) Explain the views in the QTP GUI? Keyword view: This view is a tabular representation of all the objects and the actions that are performed on them. Every row in the table is a step performed on the AUT and can be modified. Some of the most common columns displayed are: item, operation, value and documentation. Expert view: As the name indicates, this view is for more technical users who would want to tweak the source code as per their requirements.

5) What is QTPs model for test creation? a) Determine testing needs Define testing environment, Analyse your application and plan actions b) Set up repositories Local or Shared OR c) Define function libraries d) Generate test steps Add steps, Add checkpoints e) Data drive your tests f) Run the tests 6) What are the different kinds of test steps? 5 types of steps: Test Object ( Performs actions on a TO) Functions Utility (Steps to control run session. Eg: Reporter.report) Comment - Programming logic (Loop, conditionsetc) 7) What are the different ways to invoke an application using QTP? a) SystemUtil.Run SystemUtil.Run ( FileName, Parameters, Path, Operation ) Example: SystemUtil.Run(iexplorer.exe,http://www.google.com) SystemUtil.Run(test.txt, ,C:\,1) b) InvokeApplication Example: InvokeApplication C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.google.com

c) Creating a shell object using VB Script Example: Create a WScript.shell object. Dim testshell Set testshell= CreateObject (Wscript.shell) testshell.run %windir%\notepad 8) What are the different recording modes and how do they work? QTP provides 3 modes of recording: Normal Recording mode The default recording method is always the normal mode. This method uses the model of Test Objects and Runtime objects to learn and act on the AUT. Analog recording mode records the exact mouse and key strokes that the user performs in relation to either the screen or AUT window. The steps that are recorded using this method cannot be edited. The way this usually gets represented in a code is: Window/app.RunAnalog Track1 One scenario in which this type of recording can be used is when we are trying to capture a signature.

Low Level recording mode This mode records the co-ordinates in the application where the operation is performed, irrespective of whether QTP recognizes the specific Object or Operation. 9) Which recording modes need more memory? Analog and Low-level recording modes 10) Is it possible to switch between recording modes during a test creation? Yes, in the middle of recording, we can switch to Analog/Low-level mode, finish the task required and go back to normal recording. The switch to Analog mode is available only during recording and not during editing 11) Does Low level recording capture mouse movements? No. Mouse movements are not captured. 12) How does QTP identify an object? QTP has a predetermined set of properties that it learns/stores for every class of object it identifies. There are 3 aspects to this: Mandatory properties: This is the list of properties for a certain class that QTP always stores. We could say that this is the object description. It also checks this in conjunction with the parent object to see if the description is sufficient to identify the object uniquely. Assistive properties: In case the description of mandatory properties is insufficient to identify the Object a set of non-mandatory properties will be added to the description one after the other until there is enough data to identify the object. Ordinal Identifier: If the assistive properties also do not result in unique identification of an object a special ordinal identifier is added by QTP, such as the objects location on the page or in the source code. 13) What is Smart identification? If the recorded description does not enable QTP to identify a specific object then QTP uses Smart identification mechanism. It uses the following additional properties to identify the object a) Base Filter Properties (primary) The set of properties that cannot be changed without changing the object type b) Optional Filter Properties (secondary) additional properties that help identify the object uniquely. 14) What is Object Spy? Object Spy is an extremely helpful tool that QTP has to view the properties and operations of an object in the AUT. It shows all the properties of the object and the corresponding values. It also shows the object hierarchy. It also has a provision that lets the users add a certain object to the OR. 15) What is an object repository? OR is like a warehouse where all the objects in a test are stored. OR has the list of Objects that QTP learned during the record process and the class to which they belong. It stores the set of properties that uniquely identifies the Object (description) and also names the object for the sake of identification in our test, based on its most prominent feature. 16) What are the two types of repositories available, explain them? Local and shared repository these are the two kinds of available repositories.

Every action by default has a local repository of its own and has all the objects that are used within it. Alternately, the tester can have a common repository for multiple actions so that all of them can share the objects that it contains. The common repository is called a shared OR. 17) An action has both shared and local OR associated to it and both have the same object in them. In the test which one will be considered? If a local OR and Shared OR have an object with the same name, the action will consider the object in its local OR. 18) Can an action have 2 shared object repositories associated with them? In that case, if two of them contain the same object, which one will be considered? There can be more than one Shared ORs associated to the same action. If Shared OR1 and Shared OR2 have one object named OBJ1 each and if the action calls for OBJ1 then the order in which the shared ORs were associated will be considered. That means, if Shared OR1 was first associated then the OBJ1 from Shared OR1 will be taken into account. 19) Can the user toggle between using Local OR and shared OR for the same action? Yes, it is possible to switch between one or the other types of ORs at any time. To do so, the menu option is Test->Settings->Resources and choosing the options accordingly. 20) Are Shared ORs read only? By default, shared ORs open as read only. To open them in order to edit them you will have to open them from Object Repository Manager. ORM->File->Enable Editing

QTP Interview Questions and Answers (Part 2) 1) What are advantages of test automation? Time It produces quick results No Manual intervention Cost effective Not prone to human errors 2) If the objects hierarchy is changing from build to build, then how you will handle that condition? In this case descriptive programming can be used instead of having an OR. Even while descriptive programming try to use regular expressions to identify the unique property of the objects. 3) I have developed and executed a script successfully, and saved the same to QC. When I tried to execute the script from QC, the script is not executing. What are the possible reasons? 1) Firstly, QuickTest Add-In for Quality Center has to be installed. 2) In the QTP Tools > Options >run tab you should have Allow other Mercury products to run tests and components selected.

3) Make sure you are running QTP as an Admin 4) All the test resources have to be in the correct path 4) What is the extension of QTP local Repository? If it is .mtr then what is .bdb extension stands for? .bdb is the local OR. .mtr is a binary file that contains other information about checkpoints and all. To re-verify the .bdb is the OR, try to rename the file with the extension as .tsr and open it from ORM. The same objects in the OR will be displayed here. The same will not work if you try it on .mtr file. 5) What is virtual object? A virtual object is a non-standard object that is instructed by the tester via QTP to behave like a standard one. More details in thetutorial #23 6) How do you capture tool tip using QTP? Tool Tip capture method varies depending on the type of object this tool tip appears for. It could be for links, images or any other web elements. For web elements use: Object.title property. For image: Image(some name).GetROProperty(alt)..etc. 7) How can you close the second opened browser? You can know which browser instance was opened after another can be known by using the creation time property. In simple terms, this is nothing but a counter for each browser instance that gets launched. For the first one, it is 0 and gets incremented from then on. To close the second opened browser, you can use the following code: Browser(creationtime:=1).Close 8) How do know the number of browsers opened? To do this you will have to check how many child objects of the type browser are p resent on the desktop. The following is the code that explains it: Set ObjectBrowser = Description.Create ObjectBrowser(micclass).Value = Browser Set BObj = Desktop.ChildObjects(ObjectBrowser) Msgbox Obj.Count 9) What is synchronization point in QTP? It is a feature that QTP provides to make your test wait until a certain property on a certain object becomes an expected value before proceeding with the next steps. More information in tutorial #24. 10) What is reusable action? An action that can be called multiple times within or outside the same test is called reusable action. By default all actions are reusable. More information in tutorial #21. 11) Why do we use breakpoints in QTP?

This is to stop the execution of your test at a certain point while its running. Typically it is used to observe the state of your application or to understand how a certain feature works at a certain phase at runtime. (The checking is of course a manual step.) 12) What is throw object? VB Script does not have any specific throw object. (At least to the best of my knowledge) This question will not come up unless a specific add-in that supports this feature is explored. 13) How do you know the location Id of an object if you know its index id? Location is the position of the object from left to right and top to bottom within the parent window, frame, or dialog box relative to other similar objects. Index Id: is the order in which the object appears in your AUT relative to other similar objects. E.g if you have 2 links, then index id=0 will be first link and index id=1 will be the second link. The answer to this question is entirely dependent on where the object lies, whether it is within the same parent or not. 14) What test cases you can automate using QTP? As an automation enthusiast I would say, you can automate anything. It is only limited by your imagination and expertise. However, in case you need to understand the look, feel or human reaction to a certain feature, then that is not possible. This is the case with any tool, not specific to QTP. 15) How to handle Java tree in QTP? You will need to select and load the Java Add-in. Then you can record and work on a Java Tree object just like you would with any other object. 16) How to give call to another action from one action? Calling one action from the other can be done by Inserting a call to an existing action or by creating a new action. Please refer tutorial #21 for detailed explanation. 17) How to find Operating system information using QTP script? You can do that with the help of environment variable. The exact variable is, OS and OSVersion is for the version information. 18) How you can identify browser and its information using QTP script? You can identify and act on any browser that you opened again by referring to its creationtime property and use it like you would with a browser object in your OR. 19) How are actions and functions different in QTP?

Actions have their own Datatables and OR, but functions dont. More importantly, Functions are a VB Scripting element, not only applicable to QTP. Please refer article 21 a detailed explanation of these.

20) Explain how to use QTP to check broken links on a page? Page checkpoint. You can incorporate this page checkpoint on every page to check for broken links. To do so, you can go to Tools->options->Web->Advanced and choosing the option to check for broken links automatically on every page QTP accesses. More information in the tutorial #15. 21) Can we run multiple QTP scripts one after the other without manual intervention? How? Yes. To do so, you will have to create a batch file using the batch runner tool and information about the same is available in tutorial #23. 22) Explain process of smart Identification in QTP If the recorded description does not enable QTP to identify the specified object in a step, and a smart identification definition is defined (and enabled) for the object, QTP tries to identify the object using Smart identification. For more information please refer to the article number: 23 23) When to use shared and local object repository? The decision is completely up to you. Shared OR will make more sense when you have multiple scripts referring to the same objects. 24) What are the advantages of Object Repository? OR is an inbuilt feature provided by QTP to store your test objects. There are many advantages and the most important one is that it is a mandatory element unless you are going for descriptive programming. More information on OR in tutorial #22. 25) In Hybrid framework, data can accessed through database, excel file, XML etc. Is it true? Yes. Any of the mentioned data sources are permissible. 26) How to associate function library at run time? 1. You can do so by using the LoadFunctionLibrary method. LoadFunctionLibrary Completepath 2. You can also use the ExecuteFile method. ExecuteFile Completepath 27) Hybrid framework can be implemented for any application. Is it true? Yes 28) Hybrid framework supports Descriptive programming. Is it true?

Yes. Frameworks are mostly based on how and where you want your test assets to be placed and how they are to be accessed for maximum efficiency. They do not restrict how you write you test itself. 29) What are the advantages of Hybrid framework? Hybrid framework is nothing but a combination of frameworks that make you arrive at a solution for your testing needs by taking what works best for your scenario. The obvious advantage is the versatility. It can be tailored to meet any testing projects need. 30) What is Procedure or Subroutine in VB Script? Sub procedure is a series of VB Script statements (enclosed by Suband End Sub statements) that perform actions but dont return a value. A Sub procedure can take arguments (constants, variables, or expressions that are passed by a calling procedure). If a Subprocedure has no arguments, its Sub statement must include an empty set of parentheses (). 31) Is VB Script Case sensitive or Case insensitive? It is not case sensitive with respect to command and variable names. Everything else, like strings (text) is. 32) How to record application running on Virtual machine? You can access and record QTP script as long as the application is available to you via a browser and not by using remote connecting software. 33) What are the factors on which script execution time is dependent? 1. Network and computer speeds. The response time from the app, the database etc. This is true even if you are manually executing the test. 2. It also depends on the wait statements you have included. 3. Not loading the add-ins that your test does not use helps too. 4. Descriptive programming steps take longer than regular ones to execute 5. Capturing screenshots at run time through QTP also consumes time 6. Disabling smart identification also speeds up the QTP script running time 34) What is Test Fusion Report in QTP? Test Fusion report as the name indicates is a detailed test results that QTP provides in a tree format. It has all the iteration information, data used for each of them along with the standard information. 35) Both Static and dynamic arrays are handled by VB script. Is it true? Yes. A static array is declared as Dim A(10). This means its an array of 11 items. If the tester needs to modify it to contain 20 items he can do so by using redim. redim A(19). There is a Preserve statement that can be used in conjunction with the redim statement. When preserve is used all the previous values are not erased.

36) What is the difference between keyword view and expert view? They are two ways QTP shows your test. Each one has their own features and caters to users of different levels of expertise. Keyword view: This is a tabular representation of your test that has the information like the Item, Operation,Data and Comments. Expert view: This displays your test in terms of the actual lines of code. It is more like a VB Script editor and is used by advanced users. More information is available in the tutorial #2 and #12. 37) In website, protocol has been changed http: to https what you will do? Tell me your approach? Since the protocol change does not necessarily affect the UI change, except may be for a warning message about certificates, there are not many changes. All you need to do is provide the new URL and make sure you handle the security related pop-ups.

Vous aimerez peut-être aussi