Features of Quick Test Professional: Product: Mercury Interactive or Hewlett packard Purpose:Functionality and Regression Testing Tool

Kinds of Application: Both Window Based and Web Based Application. Language:VBScript Language In QTP Testing can be viewed in two ways Keyword View The Keyword View enables you to create and view the steps of

your component in a keyworddriven, modular, table format. Expert View: In the Expert View, you can view an action in VBScript. If you are familiar with VBScript, you can add and update statements and enhance your tests and function libraries with programming. Recording: Normal recording mode records the objects in your application and the operations performed on them. This mode is the default and takes full advantage of the QuickTest test object model

Record-> in the web select option1->in the window select option2-> Add application and working folder click ok. specify agent name and password click ok insert an order file->exit stop the recording Analog Recording. Enables you to record the exact mouse and keyboard operations you perform in relation to either the screen or the application window. Record-> in the web select option1->in the window select option2-> Add application and working folder click ok. specify agent name and password

click ok File->open order->specify order no File->faxorder->enter the faxnumber Automation->analog recording->use the hand icon to select the window Put the agent signature Automation->analog recording Click send Close the application Run the test 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. Note: Steps recorded using Low Level Recording mode may not run correctly on all objects.

Object Identification: Based on what tool is going to identify the objects. Types of properties Mandatory Properties(Main Property) Assistance Properties(Supporitive property) Base Filter Properties Optional Filter Properties First Qtp will learn all the specified mandatory property and then think wheather this properties are sufficient to identify the object uniquely. If the properties are sufficient it will stop learning otherwise it will learn the assistive property

If still QTP feels not satisfy then it will finally learn the ordinal identifier. All the properties learn during this process will be stored in object repository If smart Identification is selected.It will learn base and optional filter properties Object Repository: It is similar to rational test Factory in IBM Robot,Test Frame in silk test,Gui Map file in winrunner. Object Repository is used to store properties of all the predefined objects in the AUT Two Types of Object Repository -Local -Shared

Local: Storing the object in local object repository make them available only to the actions(Specific). Shared: Storing the objects in shared repository enables multiple test to use them.Local object repository are editable and appear in black in color. Shared Object repository appear in gray and they are read only.

Object Repository Merging:

QuickTest Professional provides the ability to merge existing assets from two object repositories into a single shared object repository using the Object Repository Merge Tool. This tool enables you to merge two shared object repositories (called the primary object repository and the secondary object repository), into a new third object repository, called the target object repository. 1.open a new test 2.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok. 3.specify agent name and password 4.click ok 5.insert an order 6.file->exit

7.stop the recording 8.save the test 9.resources Object Repository 10.Fileexport to Local objectssave the file. 2.create the other test 1. open a new test 2.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok. 3.specify agent name and password click ok 4.File->open order->specify order no 5.File->faxorder->enter the faxnumber 6.Click send 7.Close the application,stop the recording 8.save the test

9.resources Object Repository 10.Fileexport to Local objectssave the file. 1.Open a new test 2Resources->object Repository Manager 3.In the repository manager Tools>object repository merge tool 4.Select the primary and Secondary file and click ok Synchronization Point: Synchronization points enable you to solve anticipated timing problems between the test and your application. File->settings->run tab->object synchronisation timeout 5sec

1.open a new test 2.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok. 3.specify agent name and password 4.click ok 5.insert an order 5.1. insert->synchronization point->use the hand icon to select the object. 5.2 click ok->select the property ,specify the property value. 6.close the application 7.stop the recording. 8.Run the test

CheckPoint: A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property. Standard Checkpoint is used to compare the expected values of object properties to the object's current values during a run session. If the results do not match, the checkpoint fails. 1.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok 2.Insert->checkpoint->standard checkpoint 3.Use the hand icon to select the object

Click ok-> change the expected value 4.Click cancel 5.Run the test.

Text Checkpoint. Enables you to check that the text is displayed in a screen, window, or Web page, according to specified criteria. 1.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok 2.Insert->checkpoint->Text checkpoint 3.Use the hand icon to select the object

Click ok-> change the expected value Select match case and Ignore space 4.Click cancel 5.Run the test. Text Area Checkpoint. Enables you to check that a text string appears within a defined area in a Windows application, according to specified criteria. 1.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok 2.Insert->checkpoint->Text Area checkpoint

3.Use the hand icon to select the object Click ok-> change the expected value Select the Exact match,Text not displayed. 4.Click cancel 5.Run the test. Bitmap CheckPoint compares the object or selected area of the object currently displayed on the Web page or application with the bitmap stored when the test was recorded. If there are differences, QuickTest captures a bitmap of the actual object and displays it with the expected bitmap in the details portion of the Test Results window.

1.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok. 2.specify agent name and password 3. Insert->checkpoint->Text Area checkpoint->Use the hand icon to select the object->Click ok->click ok 4.click ok 5. Insert->checkpoint->Text Area checkpoint->Use the hand icon to select the object->Click ok->click ok 6.close the application 7.stop the recording. 8.Interchange the name and run the test

Database CheckPoint is used to check databases accessed by your Web site or application, and to detect defects. Insert->checkpoint->database checkpoint Click next
Click ok Select the dsn(Flight32)->ok Select the orders table->select the field Click next Select order number-> less than equals to->some value(20) Click next Sort by order no->next Finish Run the test Double click the end database Database checkpoint window right click Edit Expected Data change the value Run the test

Accessibility Checkpoint easily locate the areas of your Web site that require

special attention according to the W3C Web Content Accessibility Guidelines. Tools-options-web-advancesaccessibility checkpoint-check all. Record in the web select the option 2 specify the url(apache ) Click ok Insert->checkpoint->Accessibility checkpoint Use the hand icon to select the web page Perform for other pages also. Xml CheckPoint(From Resources) is used to check the contents of individual XML data files or documents that are part of your Web application.

Open the notepad Type the program <books> <bookid> B101</bookid> <bookname>Visual c#</bookname> <price>$89</price> </books> save it in .xml format Insert->checkpoint->xml checkpoint Browse the file Change the data Run the test Data Driver: Enables you to parameterize lines in your test script so you may run your test in a loop with different sets of data.

Record-> in the web select option1->in the window select option1-> Start>programs->quick test proffessional>sample applications->flight specify agent name and password click ok insert an order file->exit stop the recording Tools->datadriver->select the fieldvalue>click paramaterize->next-> next->finish->ok. Regular Expression: Regular expressions enable QTP to identify objects with varying names or titles. A regular expression is a string that specifies a complex search phrase

Record-> in the web select option1->in the window select option2-> Add application and working folder click ok. specify agent name and password click ok File->open order->specify order no File->faxorder->enter the faxnumber Click send Close the application Run the test Click ok in the error window. Resources->object repository Select the object->select the text property->change the expression as Fax order No. .* Select regular expression->click no

Actions: Actions help divide your test into logical units, like the main sections of a Web site, or specific activities that you perform in your application. Creating New Actions You can create new actions and add calls to them during a recording session or while de signing or editing your test. Record-> in the web select option1->in the window select option1-> Start>programs->quick test proffessional>sample applications->flight specify agent name and password click ok Insert->call to new action->click ok(Action2)

insert an order Insert->call to new action->click ok(action 3) File->open order->specify order no Insert->call to new action->click ok(action 4) File->faxorder->enter the faxnumber Click send Insert->call to new action->click ok(action 5) Close the application Make any of the action as reusable action.select the action->right click>action properties->reusable action Save the test

Inserting Calls to Copies of Actions When you insert a call to a copy of an action into a test, the original action is copied in its entirety, including checkpoints, parameterization, the corresponding action tab in the Data Table. Inserting a Call to an Existing Action You can insert a call to a reusable action that is stored in your current test Open the test

Insert->call to copyof action->browse the test->select the action and select at the end of test->click ok Insert->call to Existing action->browse the test->select the action and select at the end of test->click ok Perform this for the actions you want to call Recovery Scenario: An exception is an interruption occurs while executing the test. An Interruption may be a window exception and application exception.

To overcome the exception we need to perform some recovery steps Popup: A specific window that pop ups during test run and interrupts the test.
1.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok. 2.specify agent name( less than 4 characters) and password 3.click ok(Error window) 4. specify agent name 5. click ok 6.close the application 7.stop recording 8.comment the line where you click ok in the error window 9.Run the test 10.click pause 11.Resources->recovery scenario manager 12.click next 13.select pop up 14.click next 15.use the hand icon to select the error window.click->next 16.click next 17.click next 18.select option 3.use the hand icon to select ok button 19.click next 20.un check add another recovery scenario

21.click next 22.proceed to next step 23.click next 24.specify the scenario name click next 25.check both the option 26.save the scenario 27.Run the test

Test Run error: A Test run error return value that can cause an interruption in the test run.
1.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok 2.specify agent name and password 3.click ok 4.insert an order 5.In the script Copy the Fly from Location Line, change the Fly From Location.(List_Select_item) 6.Run the test. 7.Click ok in the error window 8.Resources->recovery scenario manager 9.click next 10.select pop up 11.click next 12.select Item or menu not found click next 13.click next 14.select function call click next 15.create a empty vbs file

16.browse the file which u created. 17.click next 18.un check add another recovery scenario 19.click next 20.proceed to next step 21.click next 22.specify the scenario name click next 23.check both the option 24.save the scenario 25.Run the test 26.open the file paste the line in between function and end function

VB Scripting: Program 1: <html> <title>First example</title> <body> <script type=text/vbscript> document.write("Hello From VB script") </script> </body> </html>

Program 2: <html> <title>vbscriptexamples</title> <script type="text/vbscript"> dim a a="Hariprasad" document.write(a &"<br/>") document.write(weekdayname(7)) </script> </html> program 3: <html> <body> <script type="text/vbscript"> dim arrayex(3)

arrayex(0)="hari" arrayex(1)="karthi" arrayex(2)="ezhil" for i=0 to 2 document.write(arrayex(i) &"<br/>") next </script> </body> </html>

Program 4: <html> <body> <script type="text/vbscript">

dim famname(5) famname(0)="Jan Egil" famname(1)="Tove" famname(2)="Hege" famname(3)="Stale" famname(4)="Kai Jim" famname(5)="Borge" for i=0 to 5 document.write(famname(i) & "<br />") next </script> </body> </html> User Defined Function: Program 5: <html> <body>

<script type="text/vbscript"> function example() dim a a=hour(time) if a<12 then document.write("Good Morning") else document.write("Good Day") end if end function </script> </body> <body onload=example()> </body> </html>

Predefined dialog boxes and control structures:

Program 6: <html> <body> <script type="text/vbscript"> function example1() dim a a=inputbox("Enter a") if a<50 then msgbox "Fail" elseif a>50 and a<70 then msgbox "Average" elseif a>70 and a<90 then msgbox"above Average" elseif a>90 and a<=100 then msgbox"Excellent" end if end function </script> </body>

<body onload="example1()"> </body> </html>

Program 7: <html> <body> <script type="text/vbscript"> dim a dim b dim c dim d a=inputbox("Enter value") b=inputbox("Enter value") c=inputbox("Enter value")

select case a case "+" d=int(b)+int(c) msgbox(d) case "-" d=int(b)-int(c) document.write(d) case else document.write("Invalid input") end select </script> </body> </html>

Program 8: <html> <head> <title>First vbscript example</title> </head> <body> <form name="firstexample"> <Input type="button" name="cmdclickMe" value="Just Click"> <SCRIPT FOR="cmdClickMe" EVENT="onClick" LANGUAGE="VBScript"> MsgBox "A simple example of VBScript in action."

</SCRIPT> </form> </body> </html> Program 9: <html> <head> <title>First vbscript example</title> <SCRIPT LANGUAGE="VBScript"> Sub cmdclickMe_onClick MsgBox "A simple example of VBScript in action." End Sub </SCRIPT>

</head> <body> <form name="firstexample"> <Input type="button" name="cmdclickMe" value="Just Click"> </form> </body> </html> Output Values Take a Value from any part of the application and refer the same value in some other part of that application
Steps for Output Values
Step 1: Record for Flight 4a ,login screen , file – open order -> provide an order number ( this order number becomes the reference value in other windows so , this is our output value ) for creating this as the output value go to insert menu -> output value -> standard output value -> select the order number field and select the text property -> choose the modify button in that window where it says where should we output the value so

Choose the Option as DataTable here

The Name for the Column In the data Table

select the OK Button In the application File -> Fax Order -> where even there we have the order number , lets check whether it is the same order Number or not so lets create a checkpoint for that Insert -> checkpoint -> standard Checkpoint -> choose only the text Value and here we don’t know what value is and the value is placed in the data table so choose the option parameter and select the icon parameter options In that Choose as Follows

The Column Name in the data Table had to be referred

Click OK , Close the Application , Stop Recording and Execute the Test Here there is one more advantage when we go for Output Values When we normally go for checkpoint if the value is changed before executing the script the script would go for a failure status .But in output value as we are not takind any specific value / Constant Value for reference its only the value which is outputted is taken as a Expected Result for the Checkpoint so as and when the reference value changes the expected Result is also changed dynamically. So It is most used when we create checkpoints during parameterization Note : Create a Parameterized script for the OrderNumber and use the concept of ouput value

Object Model Reference A test object is an object that QuickTest uses to represent an object in your application. Each test object has one or more methods and properties that you can use to perform operations and retrieve values for that object. Each test object also has

a number of identification properties that can describe the object. You can use the QuickTest Professional Automation Object Model to write programs that automate your QuickTest operations. The QuickTest Automation Object Model provides objects, methods, and properties that enable you to control QuickTest from another application.The new QuickTest Professional Automation Object Model enables you to automate test management.

You can write a script that modifies the test object description properties in the Object Identification dialog

box and performs an update run on all tests in a specified file folder. After installing a new add-in, an automation script can associate this add-in to all relevant tests. You can write an automation script to run a selected batch of tests. For each test, you can retrieve the associated add-ins list. Then, if the necessary add-ins are not already loaded, you can close QuickTest, load the necessary add-ins, reopen QuickTest, and run the test.

Examples for the Object Model Reference with the Database Objects

GetTO Property The following example uses the GetTOProperty method to retrieve and view the value of the database's Source property before and after it is modified. Set TO Property The following example uses the SetTOProperty method to modify the database table's source property, and then retrieves and displays the new value. Steps Create a DataBase Checkpoint and then proceed with these codings DbTable("DbTable").Check CheckPoint("DbTable")

IsExists = DbTable("DbTable").Exist (0) If IsExists Then Dim SQL SQL = DbTable("DbTable").GetTOProperty ("Source") MsgBox SQL DbTable("DbTable").SetTOProperty "Source", "SELECT * FROM ADDRESS" Dim NewSQL NewSQL = DbTable("DbTable").GetTOProperty ("Source") MsgBox NewSQL End If

Automating Quick Test We can Invoke Quick Test from any other Programming Lanaguages also , Below are the sample codings in VB Script to invoke QTP from a different Language Code 1: To start the application from VB Script Dim qtApp Set qtApp = CreateObject("QuickTest.Application") ' Create the application object qtApp.Launch 'Start QuickTest qtApp.Visible = True ' Make it visible

Code 2:A sample Script to load the add ins in QTP 'This example opens a test and loads all the add-ins associated with the test. Dim qtApp 'As QuickTest.Application ' Declare the Application object variable Dim blnNeedChangeAddins ' Declare a flag for indicating whether the test's associated add-ins are currently loaded Dim arrTestAddins

' Declare the variable for storing the test's associated add-ins Set qtApp = CreateObject("QuickTest.App lication") ' Create the Application object arrTestAddins = qtApp.GetAssociatedAddinsFo rTest("C:\Tests\Test1") ' Create an array containing the list of addins associated with this test ' Check if all required add-ins are all already loaded

blnNeedChangeAddins = False ' Assume no change is necessary For Each testAddin In arrTestAddins ' Iterate over the test's associated add-ins list If qtApp.Addins(testAddin).Sta tus <> "Active" Then ' If an associated add-in is not loaded blnNeedChangeAddins = True ' Indicate that a change in the loaded add-ins is necessary Exit For ' Exit the loop End If

Next If qtApp.Launched And blnNeedChangeAddins Then qtApp.Quit ' If a change is necessary, exit QuickTest to modify the loaded add-ins End If If blnNeedChangeAddins Then Dim blnActivateOK blnActivateOK = qtApp.SetActiveAddins(arrTe stAddins,errorDescription) ' Load the add-ins associated with the test and check whether they load successfully.

Then ' If a problem occurs while loading the add-ins MsgBox errorDescription ' Show a message containing the error WScript.Quit ' And end the automation program. End If End If If Not qtApp.Launched Then ' If QuickTest is not yet open qtApp.Launch ' Start QuickTest (with the correct add-ins loaded) End If

If Not blnActivateOK

qtApp.Visible = True ' Make the QuickTest application visible qtApp.Open "C:\Tests\Test1" ' Open the test Set qtApp = Nothing ' Release the Application object Object spy: Open the application Tools->object spy->use the spy icon to capture the object See the properties of an object Virtual object:

Debug Options: Run to Step You can instruct QuickTest to run from the beginning of the test or action (Expert View only)—or from the current location in the test or action—and to stop at a particular step. Debug from Step You can instruct QuickTest to begin your debug session from a particular step instead of beginning the run at the start of the test or action. User Defined Function

public Function myfunc() msgbox "one" msgbox "two" msgbox "three" End Function myfunc myfunc myfunc Step over: The Step command assists with test script debugging by enabling you to observe the response of your application as QTP executes each test script line. Step Into:

Step Into command assists with test script debugging by enabling you to observe the response of your application as QTP executes each test script line. Step out Step Out command to eliminate the need to execute a called test or function lineby-line using the Step and Step Into commands.

Batch Test: It is used to execute Multiple Test in a single Batch Test.

Startprogramsquick test professionalTools->Test Batch Runner Add the test Run the test