Академический Документы
Профессиональный Документы
Культура Документы
com
1.Activate: Activates the current Dialog Box. Syntax: object.Activate [BUTTON] Example: Sub Activate_Example() The following example uses the Activate method to activate the Internet Options dialog box. Browser(Mercury Tours).Dialog(Internet Options).Activate End Sub2. CaptureBitmap: Saves the screen capture of the object as a .png or .bmp image using the specified file name. Syntax: object.CaptureBitmap FullFileName, [OverrideExisting] Example: Sub CaptureBitmap_Example1() The following example uses the CaptureBitmap method to capture a screen shot of the Internet Options dialog box. The file is automatically saved to a different folder (the test run results folder) in each run. Browser(Mercury Tours).Dialog(Internet Options).CaptureBitmap internet_options.bmp End Sub
3. ChildObjects: Returns the collection of child objects contained within the object. Syntax: object.ChildObjects (pDescription) Example: The following example uses the ChildObjects method to retrieve a set of child objects matching the description listed in the function call and uses the method to display a message indicating how many objects are found with the specified description: none, one (unique), or several (not unique). Public Function CheckObjectDesription(parent, descr) Dim oDesc Create description object Set oDesc = Description.Create() arProps = Split(descr, ,) For i = 0 To UBound(arProps) arProp = Split(arProps(i), :=) If UBound(arProp) = 1 Then PropName = Trim(arProp(0)) PropValue = arProp(1) oDesc(PropName).Value = PropValue End If Next www.ramupalanki.com
www.ramupalanki.com
www.ramupalanki.com
15. MouseMove: Moves the mouse pointer to the designated position inside the activeXobject. Syntax: object.MouseMove X, Y Example: Sub MouseMove_Example() The following example uses the MouseMove method to move the mouse pointer to the position (20, 30) inside the Advanced object. Browser(MyPage).Dialog(Settings).WinObject(Advanced).MouseMove 20, 30 End Sub 16. Move: Moves the dialog box to the specified absolute location on the screen. Syntax: object.Move X, Y Example: Sub Move_Example() The following example uses the Move method to move the Internet Options dialog box to the specified location. Browser(Mercury Tours).Dialog(Internet Options).Move 659, 35 End Sub 17. Maximize: Maximize the dialog box to fill the entire screen. Syntax: object.Maximize Example: Sub Maximize_Example() The following example uses the Maximize method to maximize the Internet Options dialog box. Browser(Mercury Tours).Dialog(Internet Options).Maximize End Sub 18. Minimize: Minimizes the dialog box to an icon. Syntax: object.Minimize Example: Sub Minimize_Example() The following example uses the Minimize method to minimize the Internet Options dialog box. Browser(Mercury Tours).Dialog(Internet Options).Minimize End Sub www.ramupalanki.com
www.ramupalanki.com
This short tutorial guides you to a method by which you can view the Object Properties & Methods with the help of Object Spy in QTP. We can view the Properties and Methods of any object in an open application with the help of Object Spy pointing hand mechanism. As we move the pointing hand over the objects in the application, Spy. These details displayed in the Object Spy are the hierarchy tree of the test object, its properties and values, and the methods associated with the object. For methods, the syntax is also displayed. details get displayed in the Object
Steps to view test object properties or methods: Step-1: Open the application to the page containing the object on which we want to spy say google.com. Step-2: Choose Tools > Object Spy or click the Object Spy toolbar button to open the Object Spy dialog box and display
Or click the Object Spy button from the Object Repository dialog box. Step-3: Select the details we want to view for the object. Click Run-time Object Properties or Test Object Properties radio button. www.ramupalanki.com
Page checkpoint:It is for web applications only.Common things to check with this are load time, broken links etc. 1. Open a blank test.
2.Make sure thathttp://www.google.co.in/
should be open.) 3. Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to "Web" tab and choose first option "Record and run test on any open browser." and click ok. 4. Go to Insert (menu)->Checkpoint->Standard Checkpoint (or press F12). 5. The mouse pointer will become hand and QTP will be minimized. 6. Click anywhere on the white space on the Google.co.in page. 7. It will Open "Object Selection - Checkpoint Properties" window. Click on 'Page : Google' option which has a page icon on left of it with right corner of the page slightly folded. 8. Click ok. 9. A 'Page Checkpoint Properties' window opens up. Let all the options be default. Click ok. 10. Click on Stop in order to stop the Recording.
www.ramupalanki.com
"20" Here it shows the load time as 0 because I did not open Google at the time of running the test, it was already open. When you run it, in the results window, on left hand side, it will show (when every option is expanded): Test Checkpoint-page Summary (where Checkpoint-page is the name with which I saved the test Run-Time Data Table Checkpoint-page Iteration 1 (Row 1) Action1 Summary Google (This will be the browser) Google (This will be the Page) Checkpoint "Google" If you run this test on www.google.com it may fail.
How To close MsgBox Runtime
Write the below line as the first-line in your script. Set sh = CreateObject(Scripting.Shell) This will create a shell object at run-time and will be available until the test ends. If you are getting problem like ,Activex Component cant create object Then use Set sh =CreateObject(WScript.Shell)
Now where ever you are having msgbox replace it with.. sh.Popup message content, 5, msg header, (0+4) the above line will show the message content for 5 seconds(and vanishes after that). The alert-boxs header will have header info. Last parameter(0+4) is actually two things. 0 -> show OK button in the
www.ramupalanki.com
www.ramupalanki.com
Checkpoint only checks for the specific attribute of an object in AUT while Output value can output those attributes value to a column in datatable.
How can i check if a checkpoint passes or not?
code: chk_PassFail = Browser().Page().WebEdit().Check (Checkpoint(Check1)) if chk_PassFail then MsgBox Check Point passed else MsgBox Check Point failed end if
My test fails due to checkpoint failing, Can i validate a checkpoint without my test failing due to checpoint failure?
code: Reporter.Filter = rfDisableAll Disables all the reporting stuff chk_PassFail = Browser().Page().WebEdit().Check (Checkpoint(Check1)) Reporter.Filter = rfEnableAll Enable all the reporting stuff if chk_PassFail then MsgBox Check Point passed else MsgBox Check Point failed end if
Environment How can i import environment from a file on disk
Environment.LoadFromFile C:\Env.xml
How can i check if a environment variable exist or not?
When we use Environment(Param1).value then QTP expects the environment variable to be already defined. But when we useEnvironment.value(Param1) then QTP will create a new internal environment variable if it does not exists already. So to be sure that variable existin the environment try using Environment(Param1).value.
How to connect to a database?
code: Const adOpenStatic = 3 Const adLockOptimistic = 3 Const adUseClient = 3 Set objConnection = CreateObject(ADODB.Connection) Set objRecordset = CreateObject(ADODB.Recordset) objConnection.Open DRIVER={Microsoft ODBC for Oracle};UID=<UID>;PWD=<PWD> objRecordset.CursorLocation = adUseClient objRecordset.CursorType = adopenstatic objRecordset.LockType = adlockoptimistic ObjRecordset.Source=select field1,field2 from testTable ObjRecordset.ActiveConnection=ObjConnection ObjRecordset.Open This will execute your Query If ObjRecordset.recordcount>0 then
www.ramupalanki.com
Step 1: Delete the object repository of 9.0 Step 2: open a Blank test in 8.2 Step 3: Create the shared object repository in 8.2 that should contain all the objects in 9.0 and save. Step 4: create the action structure in 8.2 should contain the same num of actions, same names and structure as the script of 9.0. Step 5: save the test. (From now we call this as 8.2 scripts) Step 6: from 8.2 script copy Test.tsp file to the 9.0 script. Step 7: copy all Resource.MTR file found in Action0, Action 1, etc to 9.0 scripts Step 8: now u can run the scripts with little modifications if require 1 INTRODUCTION Mercury Quick Test Professional 8.0 provides the industrys best solution for functional test and regression test automation - addressing every major software application and environment. This next-generation automated testing solution deploys the concept of Keyword-driven testing to radically simplify test creation and maintenance. Unique to Quick Test Professionals Keyword-driven approach, test automation experts have full access to the underlying test and object properties, via an integrated scripting and debugging environment that is round-trip synchronized with the Keyword View. Quick Test Professional 8.0 satisfies the needs of both technical and non-technical users. It enables you to deploy higher-quality applications faster, cheaper, and with less risk. It empowers the entire testing team to create sophisticated test suites with minimal training. Advantages: Empower the entire team to create sophisticated test suites with minimal training Ensure correct functionality across all environments, data sets, and business processes Fully document and replicate defects for developers, enabling them to fix defects faster and meet production deadlines Easily regression-test ever-changing applications and environments
www.ramupalanki.com
www.ramupalanki.com
When you run a test, QuickTest performs the steps you recorded on the application. The Run option can be used to run the test from start to end. The Run from Step option in the Test menu is used to run the test from a selected step to the end of the current action, if running from the Expert View, or to the end of the test , if running from the Keyword View. Thus it enables us to check a specific part of the application or to confirm that a certain part of the test runs correctly. The Update Run option in the Test menu is used to update the Active screens, Checkpoints and the test object descriptions. While recording, Quick Test saves the snapshots of the application as Active screens which can be used later to set Checkpoints and output values. The Pause option in the Debug menu is used to temporarily suspend the run. To resume running a paused test, click the Run button. The StepInto(F11) option in the Debug menu is used to run the current line of the test. The Insert\Remove Breakpoint(F9) option in the Debug menu is used to stop a test run at a pre-determined place in a test. A breakpoint is indicated by a red-colored hand in the left margin of the test window. The test run is paused when it reaches the breakpoint, before executing the step. You can examine the effects of the test run up to the breakpoint, make any necessary changes, and then continue running the test from the breakpoint. The DebugViewer option in the View menu is used to view, set, or modify the current value of objects or variables in the test,when a test stops at a breakpoint. After a test run, the results are displayed in the Test Results window.If the window is not already open choose Test->Results.The Test result tree can be collapsed and expanded. Iterations, actions, and steps that contain checkpoints are marked Passed or Failed in the bottom right part of the Test Results window and are identified by the icon or in the tree pane. To add details in the Test results window Reporter event is used. The following line of code can be used.
www.ramupalanki.com
www.ramupalanki.com
www.ramupalanki.com
www.ramupalanki.com
www.ramupalanki.com
www.ramupalanki.com
We can create the following categories of output values: Standard Output Values: to output the property values of most objects like editbox,button,radio button,list box,etc. Text Output Values: to output text strings displayed in the application. When creating a text output value, we can output a part of the object's text. The text before and after the output text can also specified. Text Area Output Values: to output text strings displayed within a defined area of the application. We can also output a part of the objects test. Database Output Values: to output the contents of database cells, based on the results of a query on the database. We can create output values from the entire contents of the result set, or from a part of it. XML Output Values: to output the values of XML elements and attributes in XML documents. Example Browser("Google").Page("Google").WebEdit("Search").Set "QTP" Browser("Google").Page("Google").WebEdit("Search").Output CheckPoint("Search") Browser("Google").Page("Google").WebEdit("Search").Submit Browser("Google ").Page("Google Search: QTP").Link("QTP").Click Browser("Google ").Page("QTP").Sync 8.0 PARAMETERIZATION A parameter is a variable that is assigned a value from an external data source at run time. We use parameterization when we want to change the value of properties at run time. Parameterization can be done in three ways using Quick Test. Datatable Environment variables Random numbers A property of an object can be parameterised from the object repository.Select the property to be parameterised www.ramupalanki.com
www.ramupalanki.com
www.ramupalanki.com