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.

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 .Object Identification: Based on what tool is going to identify the objects.

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

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

into a new third object repository. 1.insert an order 6.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok.file->exit . called the target object repository.click ok 5.open a new test 2.specify agent name and password 4. 3.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).

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

Fileexport to Local objectssave the file. 1.In the repository manager Tools>object repository merge tool 4.9.resources Object Repository 10. File->settings->run tab->object synchronisation timeout 5sec .Open a new test 2Resources->object Repository Manager 3.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.

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

1. the checkpoint fails.CheckPoint: A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok 2.Insert->checkpoint->standard checkpoint 3. 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.Use the hand icon to select the object .

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

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

Click cancel 5.Text not displayed. .3.Use the hand icon to select the object Click ok-> change the expected value Select the Exact match. If there are differences. 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.Run the test. QuickTest captures a bitmap of the actual object and displays it with the expected bitmap in the details portion of the Test Results window. 4.

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

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 .Database CheckPoint is used to check databases accessed by your Web site or application. and to detect defects.

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.special attention according to the W3C Web Content Accessibility Guidelines. 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.

A regular expression is a string that specifies a complex search phrase . Regular Expression: Regular expressions enable QTP to identify objects with varying names or titles.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.

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 . .

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) .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.

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 .

parameterization. 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 .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. the corresponding action tab in the Data Table. including checkpoints.

An Interruption may be a window exception and application exception.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. .

specify agent name( less than 4 characters) and password 3.use the hand icon to select the error window.click next 20.select pop up 14.Record-> in the web select option1->in the window select option2-> Add application and working folder click ok. specify agent name 5.Resources->recovery scenario manager 12.click next 17. click ok 6.use the hand icon to select ok button 19. 2.click next 13. 1.un check add another recovery scenario .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.click next 18.select option 3.click ok(Error window) 4.comment the line where you click ok in the error window 9.Run the test 10.click->next 16.close the application 7.click next 15.stop recording 8.click pause 11.

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

click next 18.browse the file which u created.proceed to next step 21. 17.click next 22.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.un check add another recovery scenario 19.check both the option 24.save the scenario 25.16.click next 20.write("Hello From VB script") </script> </body> </html> .Run the test 26.specify the scenario name click next 23.

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

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"> .

write(famname(i) & "<br />") next </script> </body> </html> User Defined Function: Program 5: <html> <body> .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.

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

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") .

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

" .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.

" End Sub </SCRIPT> .</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.

file – open order -> provide an order number ( this order number becomes the reference value in other windows so .login screen .</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 . 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 .

Each test object also has .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. Each test object has one or more methods and properties that you can use to perform operations and retrieve values for that object. 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. Close the Application .Click OK . 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 .

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

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

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.Check CheckPoint("DbTable") . Set TO Property The following example uses the SetTOProperty method to modify the database table's source property. Steps Create a DataBase Checkpoint and then proceed with these codings DbTable("DbTable"). and then retrieves and displays the new value.

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

Visible = True ' Make it visible .Application") ' Create the application object qtApp.Automating Quick Test We can Invoke Quick Test from any other Programming Lanaguages also .Launch 'Start QuickTest qtApp. 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.

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 .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.

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 .' Declare the variable for storing the test's associated add-ins Set qtApp = CreateObject("QuickTest.

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 .blnNeedChangeAddins = False ' Assume no change is necessary For Each testAddin In arrTestAddins ' Iterate over the test's associated add-ins list If qtApp.

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

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

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: .qtApp.Visible = True ' Make the QuickTest application visible qtApp.

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. User Defined Function . 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.

Step Into: .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.

Batch Test: It is used to execute Multiple Test in a single Batch Test.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.

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

Sign up to vote on this title
UsefulNot useful