quick test professional: introduction: test automation is the use of

44
Quick Test Professional: Introduction: Test automation is the use of software to control the execution of tests, the comparison of actual outcomes to predicted outcomes, the setting up of test preconditions, and other test control and test reporting functions. Commonly, test automation involves automating a manual process already in place that uses a formalized testing process. Quick Test Professional (QTP) is an automated functional Graphical User Interface (GUI) testing tool created by the HP subsidiary Mercury Interactive that allows the automation of user actions on a web or client based computer application. It is primarily used for functional regression test automation. QTP uses a scripting language built on top of VBScript to specify the test procedure, and to manipulate the objects and controls of the application under test. Test Automation Guidelines Test automation is a fulltime effort, not a sideline. The test design and the test framework are totally separate entities. The test framework should be application-independent. The test framework must be easy to expand, maintain, and perpetuate. Any Framework should address Reusability, Maintainability and Traceability If it is not worth Automating Do not automate The success of Test automation depends up on the Test cases and not on the tool Benefits of Automated Testing: Fast: QuickTest runs tests significantly faster than human users.

Upload: irfan

Post on 16-Nov-2014

1.143 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Quick Test Professional: Introduction: Test Automation is the Use Of

Quick Test Professional:

Introduction:

Test automation is the use of software to control the execution of tests, the comparison of actual outcomes to predicted outcomes, the setting up of test preconditions, and other test control and test reporting functions. Commonly, test automation involves automating a manual process already in place that uses a formalized testing process.

Quick Test Professional (QTP) is an automated functional Graphical User Interface (GUI) testing tool created by the HP subsidiary Mercury Interactive that allows the automation of user actions on a web or client based computer application. It is primarily used for functional regression test automation. QTP uses a scripting language built on top of VBScript to specify the test procedure, and to manipulate the objects and controls of the application under test.

Test Automation Guidelines

Test automation is a fulltime effort, not a sideline. The test design and the test framework are totally separate entities. The test framework should be application-independent. The test framework must be easy to expand, maintain, and perpetuate. Any Framework should address Reusability, Maintainability and Traceability If it is not worth Automating Do not automate The success of Test automation depends up on the Test cases and not on the tool

Benefits of Automated Testing:

Fast: QuickTest runs tests significantly faster than human users. Reliable: Tests perform precisely the same operations each time they are run,

thereby eliminating human error. Repeatable: You can test how the Web site or application reacts after repeated

execution of the same operations. Programmable: You can program sophisticated tests that bring out hidden

information. Comprehensive: You can build a suite of tests that covers every feature in your

Web site or application. Reusable You can reuse tests on different versions of a Web site or application,

even if the user interfaces changes.

Page 2: Quick Test Professional: Introduction: Test Automation is the Use Of

Important Features of QTP:

1) Plug-ins 2) Object Spy3) Object Repository4) Record and Play back5) VB Scripting6) Check Points7) Output values8) Data Table9) Active Screen10) Keyword View11) Expert View12) Recovery Manager

Plug-ins

Plug-ins are used to make recording more acceptable to a specific application, we use web plug-ins to automate test cases with respect to web applications. QTP has default plug-ins for ActiveX controls, web applications and VB objects. This means by default QTP supports recording Windows and web applications. Plug-ins for other objects, such as Microsoft .NET objects, is also available. Multimedia plug-ins are also available. In general, each QTP plug-in is available at an additional cost.

Page 3: Quick Test Professional: Introduction: Test Automation is the Use Of

QTP Window:

Page 4: Quick Test Professional: Introduction: Test Automation is the Use Of

Object Spy:

Using the Object Spy pointing hand mechanism, you can view the supported properties and methods of any object in an open application. As you move the pointing hand over the objects in the application, their details are displayed in the Object Spy. These details may include the test object's hierarchy tree, its properties and values, and the methods associated with the object. For methods, the syntax is also displayed. In most environments, you can choose to view the test object properties and methods or the run-time (native) properties and methods.

Steps to View Object Properties:

Open your application to the page containing the object on which you want to spy.

Choose Tools > Object Spy or click the Object Spy toolbar.

In the Object Spy dialog box, click the pointing hand.

Highlight or click the object whose properties or methods you want to view. The Object Spy displays the object hierarchy tree and the properties or methods of the object that is selected within the tree.

Page 5: Quick Test Professional: Introduction: Test Automation is the Use Of

Object Identification:

The Object Identification dialog box enables you to set mandatory and assistive properties, to select the ordinal identifier, and to specify whether you want to enable the Smart Identification mechanism for each test object.

Mandatory Properties: These are the properties of a class of objects that QTP always learns to identify these objects at runtime.

Assistive Properties: These are the properties of a class of objects that QTP learns to if it is not able to differentiate between the two objects in the application using mandatory properties.

Ordinal Identifiers are used of two or more objects have same set of Mandatory and assistive properties.

Smart Identification is used when some of the properties of the object are changed from recording time to run time.

Object Identification Window:

Page 6: Quick Test Professional: Introduction: Test Automation is the Use Of

Configuring mandatory and assistive properties for a test object class:

Choose Tools > Object Identification. The Object Identification dialog box opens. Select the appropriate environment in the Environment list. (Web, Standard

Windows,etc.)

In the Test Object classes list, select the test object class you want to configure.

In the Mandatory Properties list, click Add/Remove. The Add/Remove Properties dialog box for mandatory properties opens.

Select the properties you want to include in the Mandatory Properties list and/or clear the properties you want to remove from the list.

Click OK to close the Add/Remove Properties dialog box. The updated set of mandatory properties is displayed in the Mandatory Properties list.

In the Assistive Properties list, click Add/Remove. The Add/Remove Properties dialog box for assistive properties opens.

Page 7: Quick Test Professional: Introduction: Test Automation is the Use Of

Select the properties you want to include in the assistive properties list and/or clear the properties you want to remove from the list.

Click OK to close the Add/Remove Properties dialog box. The properties are displayed in the Assistive Properties list.

Selecting an Ordinal Identifier

In addition to learning the mandatory and assistive properties specified in the Object Identification dialog box (Tools > Object Identification), QuickTest can also learn a backup ordinal identifier for each test object. The ordinal identifier assigns the object a numerical value that indicates its order relative to other objects with an otherwise identical description (objects that have the same values for all properties specified in the mandatory and assistive property lists). This ordered value enables QuickTest to create a unique description when the mandatory and assistive properties are not sufficient to do so.

Index. Indicates the order in which the object appears in the application code relative to other objects with an otherwise identical description.

Location. Indicates the order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description.

CreationTime. (Browser object only.) Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description

Smart Identification:

Selecting the Enable Smart Identification check box for a particular test object class instructs QuickTest to learn the property values of all properties specified as the object's base and/or optional filter properties in the Smart Identification Properties dialog box.

Page 8: Quick Test Professional: Introduction: Test Automation is the Use Of

By default, some test objects already have Smart Identification configurations and others do not. Those with default configurations also have the Enable Smart Identification check box selected by default.

Any changes you make in the Object Identification dialog box have no effect on objects already added to the object repository.

Virtual Objects

Complex objects may not be recognized properly by QTP. The Virtual Object concept was implemented to enable users to add some degree of support for these objects. If an object is not recorded out-of-the-box, an experienced user may be able to define that object as a personal virtual object and build a virtual object repository. Assuming that the required information can be extracted from the object, this allows the users to successfully record and playback against that object. In practice, this is not always possible.

You can teach QuickTest to recognize any area of your application as an object by defining it as a virtual object. Virtual objects enable you to record and run tests on objects that are not normally recognized by QuickTest.

Using the Virtual object wizard, you define a virtual object by:

Mapping it to a standard class: Specifies a standard object class from the list. Marking its boundaries: Configures the size and location of the virtual object.

Using the crosshairs pointer, you can mark the outline for the virtual object in the Web page.

Assigning a parent object: Selects an object in the tree as the parent object.

Specifying a name and collection: Configures a name and a collection for the virtual object. You can also choose to define another virtual object.

Page 9: Quick Test Professional: Introduction: Test Automation is the Use Of

Object Repository:

Object Repository Stores all the objects learnt by the QTP. One can find object Repository in Resources > Object Repository. The Object Repository window displays a tree of all objects in the current component or in the selected action (including all local objects and all objects in any shared object repositories associated with the selected action or component).

The Object Repository window contains the following information:

Action: Enables you to select the action whose objects you want to view Object repository tree: Contains all objects in the current component or in the

selected action Name The name that Quick Test assigns to the test object. It can be changed

Class: The class of the object. Test object details: Enables you to view the properties and property values used

to identify an object during a run session. This can be modified.

Page 10: Quick Test Professional: Introduction: Test Automation is the Use Of

The Object Repository can be saved in Two ways

1) Local. This stored automatically when the test is saved. This can be accessed only by that particular action.

2) Shared or Global. This has to be explicitly saved. This can be accessed across Quickest

Object Repository Manager allows you to create Global or shared Repositories.

Object Repository Manager:A shared object repository stores all of the test objects that may be used when creating scripts. You open the Object Repository Manager by choosing Resources > Object Repository Manager. The Object Repository Manager enables you to open multiple shared object repositories and modify them as needed. You can open as many shared object repositories as you want. Each shared object repository opens in a separate document window.

You open shared object repositories from the Open Shared Object Repository dialog box. In this dialog box, the Open in read-only mode check box is selected, by default. If you clear this check box, the shared object repository opens in editable mode. Otherwise, the shared object repository opens in read-only mode and you must click the Enable Editing button to modify it.

Adding Objects to Object Repository Manager:

Open the application under Test.

Page 11: Quick Test Professional: Introduction: Test Automation is the Use Of

You open the Object Repository Manager by choosing Resources > Object Repository Manager.

Click on add object Icon

Then click the hover on the object you want to learn.

If the object has any child object QTP will prompt to learn them also. You can select any option depending upon your need. The object filter window will look like this,

Add object Icon

Page 12: Quick Test Professional: Introduction: Test Automation is the Use Of

Once the objects are added the objects have to be stored in a Global mode. The shared repository will have the extension as .tsr

Object repository associations:

You can manage the shared object repository associations of a selected test using the Associate Repositories dialog box. The Associate Repositories dialog box enables you to associate one or more shared object repositories with one or more actions in a test. You can also remove object repository associations from selected actions, or from all actions in the test

Steps to Associate Repositories:

Choose Resources > Associate Repositories. In the Object Repository window, choose Tools > Associate Repositories.

In the Object Repository window, click the Associate Repositories button .

The Associate Repositories dialog box opens.

To add a shared object repository to the list so you can associate it to one or more actions in the current test, click the Add Repository button.

Page 13: Quick Test Professional: Introduction: Test Automation is the Use Of

To associate an object repository with one or more actions, or remove existing associations, select the object repository in the Repositories list, and then double-click the action names or select the action names and click the arrow buttons (> and <) to move them between the Available Actions and the Associated Actions lists.

Exporting Local objects to a new shared object repository:

Open the test that has the local objects you want to export. Make sure that the Object Repository window is open.

In the Object Repository window, in the Action box, choose the action whose local objects you want to export.

Choose File > Export Local Objects. The Export Object Repository dialog box opens.

Select the location in which to save the file, specify the file or attachment name, and click Save or OK.

Record and Replay:

Page 14: Quick Test Professional: Introduction: Test Automation is the Use Of

Initial development of automated tests with QTP is usually done by record-and-playback. A user's actions are captured via Microsoft's Component Object Model (COM). These are recorded into Actions, a kind of subroutine, as VBScript commands. All manipulated objects that QTP recognizes are also added to the object repository. Once recorded, the scripts are editable in either Keyword View or Expert View.

After clicking on the playback button all these actions will be played back. During playback, QTP attempts to identify and perform operations on the same objects, again using COM.

Recording Tool Bar:

Recording a Test:

Start QuickTest and open a new test. Choose Automation > Record or click the Record button. The Record and Run

Settings dialog box opens.

Give Proper Setting in the Dialog box and click OK

Activate the application under test

Perform actions on the application. Usually the actions have to be the test steps of the test case being automated.

Stop Recording

You will some script generated in the expert window.

Record and Run Settings Dialog Box

Page 15: Quick Test Professional: Introduction: Test Automation is the Use Of

There are three modes of recording;

1) Normal Mode recoding or Context Sensitive.2) Analog Mode Recording

3) Low level Recording.

Context Sensitive mode is the default recording mode OF QTP. It performs recording based on the object repository. It depends only on the objects. Usually the recording happens on parent – child hierarchy model. Example when you click on Search button on Google page the script will look something like this:

Browser(“Google”).Page(“Google Search”).WebButton(“Search”).Click.

Analog Recording enables you to record the exact mouse and keyboard operations you perform in relation to either the screen or the application window. In this recording mode, QuickTest records and tracks every movement of the mouse as you drag the mouse around a screen or window.

This mode is useful for recording operations that cannot be recorded at the level of an object, for example, recording a signature produced by dragging the mouse.

Page 16: Quick Test Professional: Introduction: Test Automation is the Use Of

Low Level Recording Enables you to record on any object in your application, whether or not QuickTest recognizes the specific object or the specific operation. This mode records at the object level and records all run-time objects as Window or WinObject test objects. Use low-level recording for recording in an environment or on an object not recognized by QuickTest. You can also use low-level recording if the exact coordinates of the object are important for your test.

Active Screen

QTP captures the screen of the application and saves along with the script. The active screen section highlights the objects in the active screen as the user navigates through the script so the user knows what object he/she will be performing the action upon.

Active screen is also helpful in creating checkpoints. A right-click on an object displayed in the active screen produces a drop-down menu, which includes a list of checkpoints that can be placed at the current cursor position in the script.

VB Scripting:

Once the script is generated by recording, we may want to enhance the script to make it more effective. QTP allows you to do this with the help of VB script language elements. Following are some of the VB Script language elements that are commonly used.

Command: InputBox.

Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns the contents of the text box.

Syntax: InputBox(“Enter your name”)

Command: MsgBox.

Displays a message in a dialog box, waits for the user to click a button, and returns a value indicating which button the user clicked.

Syntax: MsgBox(“Hello World”)

Page 17: Quick Test Professional: Introduction: Test Automation is the Use Of

String Functions:

StrComp: Returns a value indicating the result of a string comparison.

Usage:

A=Strcmp(“Hello”,”Hello”)

A will have value 0 which means true.

InStr: Returns the position of the first occurrence of one string within another

Usage:

val1="welcome to India"

val2="India"

val=InStr(1,val1,val2)

val will have value 12 . This means that the position of the word India in val1 is 12.

Split: Returns a zero-based, one-dimensional array containing a specified number of substrings with respect to delimiter.

Usage:

Val=”appleXballXcatXdog”

Sval=Split(val,”X”,-1)

Now Sval(0) will have apple

Sval(1)=ball

Sval(2)=cat.

That is Split command will split the string based upon the delimiter specified.

Page 18: Quick Test Professional: Introduction: Test Automation is the Use Of

Date and Time Functions:

Now: Returns the current date and time according to the setting of your computer's system date and time.

Usage:

Dim MyVar

MyVar = Now ' MyVar contains the current date and time.

DateAddf: Returns the number of intervals between two dates

Usage:

DiffADate = "Days from today: " & DateDiff("d", Now,"2/7/2008" )

MsgBox DiffADate

DiffADate will have the no of days between today and "2/7/2008"

DateAdd: Returns a date to which a specified time interval has been added.

Usage:

NewDate = DateAdd("m", 1, "31-Jan-95")

The NewDate will be “28-Feb-95”. One month latter than “31-Jan-95”

Day(now): This will return todays day alone. Like 21, 15 or 12

Hour(now): This will retun the current hour alone.

Page 19: Quick Test Professional: Introduction: Test Automation is the Use Of

User Defined Function:

Example Function

Public Function Total(a,b, ByRef c)

c=a+b

End Function

Call Total(2,3,d)

D will have the output, the value of c.

Syntax For Writing a Function.

[Public [Default] | Private] Function name [(arglist)]

[statements]

[statements]

End Function

Public

Indicates that the Function procedure is accessible to all other procedures in all scripts.

Default

Used only with the Public keyword in a Class block to indicate that the Function procedure is the default method for the class. An error occurs if more than one Default procedure is specified in a class.

Private

Indicates that the Function procedure is accessible only to other procedures in the script where it is declared or if the function is a member of a class, and that the Function procedure is accessible only to other procedures in that class.

name

Name of the Function; follows standard variable naming conventions.

Page 20: Quick Test Professional: Introduction: Test Automation is the Use Of

arglist

List of variables representing arguments that are passed to the Function procedure when it is called. Commas separate multiple variables.

statements

Any group of statements to be executed within the body of the Function procedure.

File handling:

Writing Values From a File:

Const ForReading = 1, ForWriting = 2

Dim fso, MyFile

Set fso = CreateObject("Scripting.FileSystemObject")

Set MyFile = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)

MyFile.WriteLine "Hello world!"

MyFile.WriteLine "The quick brown fox"

MyFile.Close

Reading Values from a File:

Const ForReading = 1, ForWriting = 2

Dim fso, MyFile

Set fso = CreateObject("Scripting.FileSystemObject")

Set MyFile = fso.OpenTextFile("c:\testfile.txt", ForReading)

Val= MyFile.ReadLine

Val1=MyFile.ReadLine

MyFile.Close

Page 21: Quick Test Professional: Introduction: Test Automation is the Use Of

Fetching Values from a Database using VBScript.

Set MyConn = CreateObject("ADODB.Connection")

MyConn.Open"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\Program”+_ "Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight32.mdb"

Set RS = MyConn.Execute("SELECT * FROM Orders")

While Not RS.EOF

msgbox RS("Order_Number").Value

Rs.MoveNext

Wend

QTP’S test Object Functions:

Exist: You can enter Exist and/or Wait statements to instruct QuickTest to wait for a window to open or an object to appear. Exist statements return a boolean value indicating whether or not an object currently exists. Wait statements instruct QuickTest to wait a specified amount of time before proceeding to the next step. You can combine these statements within a loop to instruct QuickTest to wait until the object exists before continuing with the test.

Example:

blnDone=Window("Flight Reservation").Dialog("Flights Table").Exist

counter=1

While Not blnDone

       Wait (2)

blnDone=Window("FlightReservation").Dialog("FlightsTable").Exist counter=counter+1

       If counter=10 then

              blnDone=True

       End if

Wend

Page 22: Quick Test Professional: Introduction: Test Automation is the Use Of

Check Property: Checks whether the specified object property achieves the specified value within the specified timeout.

Syntax: object.CheckProperty (PropertyName, PropertyValue, [TimeOut])

Example:

var_CheckProperty = Browser("HP QuickTest Professional").Page("HP QuickTest Professional").Link("1.2 License Models").CheckProperty("text", "Licence Models")

Return Value

A Boolean value.  Returns TRUE if the property achieves the value, and FALSE if the timeout is reached before the property achieves the value.

A TRUE return value reports a Passed step to the test results; a FALSE return value reports a Failed step to the test results.

GetTOProperty: Returns the value of the specified property from the test object description.

Syntax: object.GetTOProperty (Property)

Example : var_GetTOProperty = Browser("HP QuickTest Professional").Page("HP QuickTest Professional").Link("1.2 License Models").GetTOProperty("Innertext")

Return Value: A variant value which will have the inner text of the link “1.2 License Models”

GetROProperty: Returns the current value of the test object property from the object in the application.

Syntax: object.GetROProperty (Property)

Example : var_GetTOProperty = Browser("HP QuickTest Professional").Page("HP QuickTest Professional").Link("1.2 License Models").GetROProperty("Innertext")

Return Value: A variant value which will have the current inner text value of the link “1.2 License Models”

Page 23: Quick Test Professional: Introduction: Test Automation is the Use Of

ReportEvent : Reports an event to the test results

Syntax: Reporter.ReportEvent EventStatus, ReportStepName, Details [, Reporter]

Example:

Reporter.ReportEvent 1, "Custom Step", "The user-defined step failed."

or

Reporter.ReportEvent micFail, "Custom Step", "The user-defined step failed."

SystemUtil.Run : You can run any application from a specified location using a SystemUtil.Run statement

Example:SystemUtil.Run"C:\ProgramFiles\InternetExplorer\IEXPLORE.EXE","","C:\Documents and Settings\Administrator","open"

The statement opens the Internet Explorer.

ExecuteFile: This can be used to execute an external VB Script File

Syntax: ExecuteFile FileName

Example : ExecuteFile “C:\sample.vbs”

The above discussed functions can be easily Accessed by step Generator:

Step Generator:

Step Generator can found in insert menu.

Page 24: Quick Test Professional: Introduction: Test Automation is the Use Of

Step Generator Dialog Box:

The Step Generator dialog box enables you to add steps that perform operations, using test object methods (for tests only), Utility object methods, or function calls.

When you define a new step, you first select the type of step that you want to add to your test. You can then select the specific object and method for the step, or the function that you want the step to use.

After you select the operation for the step, you can specify the relevant argument values and the location for the return value, if applicable. These values can be parameterized if required.

Finally, you can view the step documentation or statement syntax and add your new step or statement to your test or function library.

Test Objects: Enables you to select a test object and method for the step (for tests only).

Utility Objects: Enables you to select a Utility object and method for the step.

Functions: Enables you to select a function for the step from the available library functions (tests only), VBScript functions, and internal script functions.

Page 25: Quick Test Professional: Introduction: Test Automation is the Use Of

Check Points:

QuickTest enables you to add checks to your test. A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property. This enables you to identify whether your Web site or application is functioning correctly.

When you add a checkpoint, QuickTest adds a checkpoint to the current row in the Keyword View and adds a Check CheckPoint statement in the Expert View. By default, the checkpoint name receives the name of the test object on which the checkpoint is being performed. You can choose to specify a different name for the checkpoint or accept the default name.

When you run the test, QuickTest compares the expected results of the checkpoint to the current results. If the results do not match, the checkpoint fails. You can view the results of the checkpoint in the Test Results window.

Adding a Checkpoint while recording:

Choose Insert > Checkpoint > Standard Checkpoint or click the Insert Checkpoint or Output Value button and choose Standard Checkpoint. The QuickTest window is hidden, and the pointer changes into a pointing hand.

Click the object whose text you want to check. The Object Selection - Checkpoint Properties dialog box opens.

Page 26: Quick Test Professional: Introduction: Test Automation is the Use Of

Select the item you want to check from the displayed object tree.

Click OK. The Checkpoint Properties dialog box opens. In the Name box, either accept the name that QuickTest assigns to the checkpoint

or specify another name for it. By default, the checkpoint name is the name of the test object on which the checkpoint is being performed.

Select the text property

If necessary, edit the text value you want QuickTest to check. Note that you can parameterize this value.

If you want to check only text, clear the other check boxes in the dialog box.

Click OK to close the dialog box. A checkpoint statement is added for the selected object

The above one is a standard Checkpoint. There are also other check points and the procedure is same.

Page 27: Quick Test Professional: Introduction: Test Automation is the Use Of

DataTable Parameterization:

When you test your application or Web site, you may want to check how it performs the same operations with multiple sets of data. For example, if you are testing the Mercury Tours sample Web site, you may want to check that the correct departure and the arrival cities are selected before you book a particular flight.

To parameterize

1) In the Keyword View, click in the Value cell of the step and then click the parameterization icon. In the Value Configuration Options dialog box, select the Parameter radio button. In the Name box, rename p_item to Location.

2) Click Ok.

Page 28: Quick Test Professional: Introduction: Test Automation is the Use Of

Data Table Functions:

DataTable.Import: Imports the specified Microsoft Excel file to the run-time Data Table.

Example:

DataTable.Import ("C:\flights.xls")

DataTable.Export:

Saves a copy of the run-time Data Table in the specified location

Example:

DataTable.Export ("C:\flights.xls")

Recovery Scenario:

The Recovery Scenario Wizard leads you, step-by-step, through the process of creating a recovery scenario. The Recovery Scenario Wizard contains the following main steps:

defining the trigger event that interrupts the run session specifying the recovery operations required to continue choosing a post-recovery test run operation specifying a name and description for the recovery scenario (for tests) specifying whether to associate the recovery scenario to the current test

and/or to all new tests

You open the Recovery Scenario Wizard by clicking the New Scenario button in the Recovery Scenario Manager dialog box (Resources > Recovery Scenario Manager).

Page 29: Quick Test Professional: Introduction: Test Automation is the Use Of

Defining Trigger Events: The Select Trigger Event screen enables you to define the event type that triggers the recovery scenario, and the way in which QuickTest recognizes the event.

Pop-up window. QuickTest detects a pop-up window and identifies it according to the window title and textual content. For example, a message box may open during a run session, indicating that the printer is out of paper. QuickTest can detect this window and activate a defined recovery scenario to continue the run session.

Object state. QuickTest detects a specific test object state and identifies it according to its property values and the property values of all its ancestors. Note that an object is identified only by its property values, and not by its class.

Tests run error. QuickTest detects a run error and identifies it by a failed return value from a method. For example, QuickTest may not be able to identify a menu item specified in the method argument, due to the fact that the menu item is not available at a specific point during the run session. QuickTest can detect this run error and activate a defined recovery scenario to continue the run session.

Application crash. QuickTest detects an application crash and identifies it according to a predefined list of applications. For example, a secondary application may crash when a certain step is performed in the run session. You want to be sure that the run session does not fail because of this crash, which may indicate a different problem with your application. QuickTest can detect this application crash and activate a defined recovery scenario to continue the run session.

Page 30: Quick Test Professional: Introduction: Test Automation is the Use Of

Trigger for Pop up

After you select the object whose properties you want to specify in the Select Object Screen, the Set Object Properties and Values screen opens.

Trigger for object State

Triggers for Test Run Error: Any error. Any error code that is returned by a test object method.

Page 31: Quick Test Professional: Introduction: Test Automation is the Use Of

Item in list or menu is not unique. Occurs when more than one item in the list, menu, or tree has the name specified in the method argument.

Item in list or menu not found. Occurs when QuickTest cannot identify the list, menu, or tree item specified in the method argument. This may be due to the fact that the item is not currently available or that its name has changed.

More than one object responds to the physical description. Occurs when more than one object in your application has the same property values as those specified in the test object description for the object specified in the step.

Object is disabled. Occurs when QuickTest cannot perform the step because the object specified in the step is currently disabled.

Object not found. Occurs when no object within the specified parent object matches the test object description for the object.

Object not visible. Occurs when QuickTest cannot perform the step because the object specified in the step is not currently visible on the screen.

The Recovery Operations screen enables you to manage the collection of recovery operations in the recovery scenario. Recovery operations are operations that QuickTest performs sequentially when it recognizes the trigger event.

You must define at least one recovery operation. To define a recovery operation and add it to the Recovery operations list, click next to continue to the Recovery Operation Screen.

Page 32: Quick Test Professional: Introduction: Test Automation is the Use Of

If you define two or more recovery operations, you can select a recovery operation and use the Move Up or Move Down buttons to change the order in which QuickTest performs the recovery operations. You can also select a recovery operation and click the Remove button to delete a recovery operation from the recovery scenario.

Recovery Options:

Keyboard or mouse operation. QuickTest simulates a click on a button in a window or a press of a keyboard key. Select this option and click Next to continue to the Recovery Operation – Click Button or Press Key Screen.

Close application process. QuickTest closes specified processes. Select this option and click Next to continue to the Recovery Operation – Close Processes Screen.

Function call. QuickTest calls a VBScript function. Select this option and click Next to continue to the Recovery Operation – Function Call Screen.

Restart Microsoft Windows. QuickTest restarts Microsoft Windows. Select this option and click Next to continue to the Recovery Operations Screen.

When you clear the Add another recovery operation check box in the Recovery Operations Screen and click Next, the Post-Recovery Test Run Options screen opens. Post-recovery test run options specify how to continue the run session after QuickTest has identified the event and performed all of the specified recovery operations.

Page 33: Quick Test Professional: Introduction: Test Automation is the Use Of

After you specify a test run option in the Post-Recovery Test Run Options Screen, and click Next, the Name and Description screen opens.

Give the name and FinishQuick Test Testing Process as a Whole:

Planning

Before beginning to create a test, you should plan it and prepare the required infrastructure. For example, determine the functionality you want to test, and decide which information you want to check during the test run. Before preparing the required infrastructure, you should spend time analyzing your application and determining which objects and operations are used by the set of business processes that need to be tested.

Page 34: Quick Test Professional: Introduction: Test Automation is the Use Of

You should also determine which operations require customized keywords to provide additional functionality.

Creating Tests

You create a test either by building an object repository and adding steps manually or by recording a session on your application. You can create steps using the table-like, graphical Keyword View using keyword-driven functionality—or you can use the Expert View, if you prefer programming steps directly in VBScript.

Every test is composed of one or more actions. At its most basic level, each action contains steps that duplicate the activities that you or another user might perform when using your application or Web site. You can enhance the testing process by modifying your test with special testing options and/or with programming statements.

By default, each test begins with a single action. You can organize your test by dividing it into multiple actions. This is similar to creating separate modules, or logical units, for testing various parts of your application orWeb site.

When you create your test, you:

Add steps to your test Build an object repository and use these objects to add keyword-drivensteps manually in the Keyword View or Expert View.

The object repository should contain all the objects that you want to test in your application or Web site. For more information on building an

Record a session on your application or Web site.

As you navigate through your application or site, QuickTest graphically displays each step you perform as a row in the Keyword View. A step is something that causes or makes a change in your site or application, such as clicking a link or image, or submitting a data form. In the Expert View, these steps are displayed as lines in a test script (VBScript). The Documentation column of the Keyword View also displays a description of each step in easy-to-understand sentences

Insert checkpoints into your test.

A checkpoint checks specific values or characteristics of a page, object, or text string and enables you to identify whether or not your Web site or application is functioning correctly.

Page 35: Quick Test Professional: Introduction: Test Automation is the Use Of

Broaden the scope of your test by replacing fixed values with parameters. When you test your site or application, you can parameterize your test to check how your application performs the same operations with different data. You may supply data in the Data Table, define environment variables and values, define test or action parameters and values, or instruct QuickTest to generate random numbers for current user and test data. When you parameterize your test, QuickTest substitutes the fixed values in your test with parameters. When you use Data Table parameters, QuickTest uses the values from a different row in the Data Table for each iteration of the test or action. (Each run session that uses a different set of parameterized data is called iteration.)

Run your test to check your site or application.