Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
The basic test creation method is record and playback. What does this really mean? Let s 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.
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.