SAP Testing Training

11,877 views
11,639 views

Published on

SAP Testing, Testing, SAP, HP BPT, SAP TAO, TAO,BPT,HP, HP QC,HP QTP

Published in: Education, Technology
2 Comments
3 Likes
Statistics
Notes
  • I am Sreekanth, I have got trained By Tarakesh on SAP Testing, Currently i am working in Mumbai for an MNC. not only me a lot of other students also got the jobs. Tarakesh Trains on real time Scenarios with hands on experience. He is the GURU of SAP Testing. He is the first person who started SAP Testing Training. Please try to speak the truth... it will be useful to other Students.
    Thanks
    Sreekanth
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • VGlobal is very good compared to Mr. Tarkesh from Delta technologies and Qedge. He does not teach SAP testing properly, does not complete course. Bad customer service also. I compare both because i took classes from both. Anytime Govind is better.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
11,877
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
436
Comments
2
Likes
3
Embeds 0
No embeds

No notes for slide

SAP Testing Training

  1. 1. VLearn Technologies www.mysaptesting.comQTP 9.2 provides following features:Mercury Screen Recorder: Capture your entire run session in a movie clip or capture only the segments witherrors, and then view your movie from the Test Results window.Dynamic Management of Object Repositories: Quick Test now has a new Repositories Collection reserved object that you canuse to programmatically manage the set of object repositories that are associated with anaction during a run session.Object Repository Manager: You can use the Object Repository Manager to manage all of the shared objectrepositories in your organization from one, central location. This includes adding anddefining objects, modifying objects and their descriptions, parameterize test objectproperty values, maintaining and organizing repositories, and importing and exportingrepositories in XML format. You can open multiple object repositories at the same time. Each objectrepository opens in its own resizable document window. This enables you to compare thecontent of the repositories, to copy or move objects from one object repository to another,and so forth.Object Repository Merge Tool: You can use the Object Repository Merge Tool to merge the objects from twoshared object repositories into a single shared object repository. You can also use theObject Repository Merge Tool to merge objects from the local object repository of one ormore actions or components into a shared object repository. When you merge objects from two source object repositories, the content iscopied to a new, target object repository, ensuring that the information in the sourcerepositories remains unchanged. If any conflicts occur during the merge, for example, if two objects have the samename and test object class, but different test object descriptions, the relevant objects arehighlighted in the source repositories, and the Resolution Options pane details theconflict and possible resolutions.Multiple Object Repositories per Action or Component: Quick Test provides several options for storing and accessing test objects. Youcan store the test objects for each action or component in its corresponding local objectrepository, which is unique for each action and component. You can also store testobjects in one or more shared object repositories that can be used in multiple actions andcomponents. Alternatively, you can use a combination of objects from the local objectrepository and one or more shared object repositories. You choose the combination thatmatches your testing needs.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 1
  2. 2. VLearn Technologies www.mysaptesting.comXML Object Repository Format: Quick test now enables you to import and export object repositories from and toXML format. This enables you to modify object repositories using the XML editor ofyour choice and then import them back into Quick Test. You can import and export fileseither from and to the file system or a Quality Center project (if Quick Test is connectedto Quality Center).Functions Library Editor: Quick Test now has a built-in function library editor, which enables you to createand edit function libraries containing VBScript functions, subroutines, modules, and soforth, and then call their functions from your test or component.Handling Missing Actions and Resources: Whenever a testing document (test, component, or application area) contains aresource that cannot be found, Quick Test opens the Missing Resources pane and lists themissing resource(s). For example, a test may contain an action or a call to an action thatcannot be found; a testing document may use a shared object repository that cannot befound; or a testing document may use an object repository parameter that does not have adefault value. In all of these cases, Quick Test indicates this in the Missing Resourcespane, enabling you to map a missing resource to an existing one, or remove it from thetesting document, as required.How can I check if a parameter exists in Data Table or not? on error resume next Val=DataTable ("ParamName", dtGlobalSheet) if err. number<> 0 then Parameter does not exist else Parameter exists end ifHow can I check if a checkpoint passes or not?chk_PassFail = Browser (...).Page (...).WebEdit (...).Check (Checkpoint ("Check1"))if chk_PassFail thenMsgBox "Check Point passed"else MsgBox "Check Point failed"end ifMy test fails due to checkpoint failing, Can I validate a checkpoint without my testfailing due to checkpoint failure?Reporter. Filter = rfDisableAll Disables all the reporting stuffName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 2
  3. 3. VLearn Technologies www.mysaptesting.comchk_PassFail = Browser (...).Page (...).WebEdit (...).Check (Checkpoint ("Check1"))Reporter. Filter = rfEnableAll Enable all the reporting stuffif chk_PassFail thenMsgBox "Check Point passed"elseMsgBox "Check Point failed"end ifWhat is the difference between an Action and a function? Action is a thing specific to QTP while functions are a generic thing which is afeature of VB Scripting. Action can have an object repository associated with it while afunction cant. A function is just lines of code with some/none parameters and a singlereturn value while an action can have more than one output parameters.Where to use function or action? Well answer depends on the scenario. If you want to use the OR feature then youhave to go for Action only. If the functionality is not about any automation script i.e. afunction like getting a string between to specific characters, now this is something notspecific to QTP and can be done on pure VB Script, so this should be done in a functionand not an action. Code specific to QTP can also be put into a function using DP.Decision of using function/action depends on what any one would be comfortable usingin a given situation.When to use a Recovery Scenario and when to us on error resume next? Recovery scenarios are used when you cannot predict at what step the error canoccur or when you know that error wont occur in your QTP script but could occur in theworld outside QTP, again the example would be "out of paper", as this error is caused byprinter device driver. "On error resume next" should be used when you know if an error isexpected and dont want to raise it, you may want to have different actions dependingupon the error that occurred. Use err.number & err.description to get more details aboutthe error.How to use environment variable?A simple definition could be... it is a variable which can be used across the reusableactions and is not limited to one reusable action.There are two types of environment variables:1. User-defined2. Built-inWe can retrieve the value of any environment variable. But we can set the value of onlyuser-defined environment variables.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 3
  4. 4. VLearn Technologies www.mysaptesting.comTo set the value of a user-defined environment variable:Environment (Variable Name) = NewValueTo retrieve the value of a loaded environment variable:CurrValue = Environment (VariableName)ExampleThe following example creates a new internal user-defined variable named MyVariablewith a value of 10, and then retrieves the variable value and stores it in the MyValuevariable.Environment. Value ("MyVariable") =10MyValue=Environment.Value ("MyVariable")How to rename a checkpoint (QTP 9.0)?Example:Window ("Notepad").WinEditor ("Edit").Check Checkpoint ("Edit")in the above example, the user would like to change the name of the Checkpoint objectfrom "Edit" to something more meaningful.Note: This functionality is new to QuickTest Professional 9.0.This is not availablefor QTP 8.2 and below.1. Right-click on the Checkpoint step in the Keyword View or on the Checkpoint objectin Expert View.2. Select "Checkpoint Properties" from the pop-up menu.3. In the Name field, enter the new checkpoint name.4. Click. The name of the checkpoint object will be updated within the script.Example:Window ("Notepad").WinEditor ("Edit").Check Checkpoint ("NewCheckPointName")Note: You must use the QuickTest Professional user interface to change the name of thecheckpoint. If you manually change the name of the checkpoint in the script, QuickTestProfessional will generate an error during replay. The error message will be similar to thefollowing:"The "" Checkpoint object was not found in the Object Repository. Check the ObjectRepository to confirm that the object exists or to find the correct name for the object."The Checkpoint object is not a visible object within the object repository, so if youmanually modify the name, you may need to recreate the checkpoint to resolve the error.What is the lservrc file in QTP?The lservrc file contains the license codes that have been installed The lservrc file contains the license codes that have been installed. Whenever anew license is created, the license code is automatically added to this file. The lservrc fileis a text file, with no extension.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 4
  5. 5. VLearn Technologies www.mysaptesting.comFile Location:1) For a Concurrent (Floating) license installation:Example: C:Program FilesXYZ TechnologiesABC ServerEnglishlservrc2) For a Seat (Stand-alone) license installationExample:C:Program FilesMercury InteractiveQuickTest ProfessionalBinlservrcWhat to do if you are not able to run QTP from quality center?This is for especially for newbie‘s with QTP.Check that you have selected Allow other mercury products to run tests and componentsfrom QTP  Tools  Options  Run Tab.Understanding the Smart Identification ProcessIf QuickTest activates the Smart Identification mechanism during a run session (becauseit was unable to identify an object based on its learned description), it follows thefollowing process to identify the object:1. QuickTest "forgets" the learned test object description and creates a new objectcandidate list containing the objects (within the objects parent object) that match all ofthe properties defined in the Base Filter Properties list.2. QuickTest filters out any object in the object candidate list that does not match the firstproperty listed in the Optional Filter Properties list. The remaining objects become thenew object candidate list.Walking Through a Smart Identification Example The following example walks you through the object identification process for anobject. Suppose you have the following statement in your test or component:Browser("Mercury Tours").Page("Mercury Tours").Image("Login").Click 22,17When you created your test or component, QuickTest learned the following objectdescription for the Login image:However, at some point after you created your test or component, a second login buttonName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 5
  6. 6. VLearn Technologies www.mysaptesting.com(for logging into the VIP section of the Web site) was added to the page, so the Webdesigner changed the original Login buttons alt tag to: basic login.The default description for Web Image objects (alt, html tag, image type) works for mostimages in your site, but it no longer works for the Login image, because that images altproperty no longer matches the learned description. Therefore, when you run your test orcomponent, QuickTest is unable to identify the Login button based on the learneddescription. However, QuickTest succeeds in identifying the Login button using its SmartIdentification definition.The explanation below describes the process that QuickTest uses to find the Login objectusing Smart Identification:1. According to the Smart Identification definition for Web image objects, QuickTestlearned the values of the following properties when you recorded the click on the Loginimage:2. QuickTest begins the Smart Identification process by identifying the five objects on theMercury Tours page that match the base filter properties definition (html tag = INPUTand image type = Image Button). QuickTest considers these to be the object candidatesand begins checking the object candidates against the Optional Filter Properties list.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 6
  7. 7. VLearn Technologies www.mysaptesting.com3. QuickTest checks the alt property of each of the object candidates, but none have thealt value: Login, so QuickTest ignores this property and moves on to the next one.4. QuickTest checks the name property of each of the object candidates, and finds thattwo of the objects (both the basic and VIP Login buttons) have the name: login.QuickTest filters out the other three objects from the list, and these two login buttonsbecome the new object candidates.5. QuickTest checks the file name property of the two remaining object candidates. Onlyone of them has the file name login.gif, so QuickTest correctly concludes that it hasfound the Login button and clicks it.Step-by-Step Instructions for Configuring a Smart Identification Definitionyou use the Smart Identification Properties dialog box, accessible from the ObjectIdentification dialog box, to configure the Smart Identification definition for a test objectclass.To configure Smart Identification properties:1. Choose Tools > Object Identification. The Object Identification dialog box opens.2. Select the appropriate environment in the Environment list. The test object classesassociated with the selected environment are displayed in the Test object classes list.Note: The environments included in the Environment list are those that correspond to theloaded add-in environments.3. Select the test object class you want to configure.4. Click the Configure button next to the Enable Smart Identification check box. TheConfigure button is enabled only when the Enable Smart Identification option is selected.The Smart Identification Properties dialog box opens:Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 7
  8. 8. VLearn Technologies www.mysaptesting.com5. In the Base Filter Properties list, click Add/Remove. The Add/Remove Propertiesdialog box for base filter properties opens.6. Select the properties you want to include in the Base Filter Properties list and/or clearthe properties you want to remove from the list.Tip: You can also add property names to the set of available properties for Web objectsusing the attribute/ notation. To do this, click New. The New Property dialog box opens.Enter a valid property in the format attribute/ and click OK. The new property is added tothe Base Filter Properties list. For example, to add a property called MyColor, enterattribute/MyColor.7. Click OK to close the Add/Remove Properties dialog box. The updated set of basefilter properties is displayed in the Base Filter Properties list.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 8
  9. 9. VLearn Technologies www.mysaptesting.com8. In the Optional Filter Properties list, click Add/Remove. The Add/Remove Propertiesdialog box for optional filter properties opens.9. Select the properties you want to include in the Optional Filter Properties list and/orclear the properties you want to remove from the list.Note: You cannot include the same property in both the base and optional property lists.You can specify a new property by clicking New and specifying a valid property name inthe displayed dialog box.Tip: You can also add property names to the set of available properties for Web objectsusing the attribute/ notation. To do this, click New. The New Property dialog box opens.Enter a valid property in the format attribute/ and click OK. The new property is added tothe Optional Filter Properties list. For example, to add a property called MyColor, enterattribute/MyColor.10. Click OK to close the Add/Remove Properties dialog box. The properties aredisplayed in the Optional Filter Properties list.11. Use the up and down arrows to set your preferred order for the optional filterproperties. When QuickTest uses the Smart Identification mechanism, it checks theremaining object candidates against the optional properties one-by-one according to theorder you set in the Optional Filter Properties list until it filters the object candidatesdown to one object.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 9
  10. 10. VLearn Technologies www.mysaptesting.comHow to verify that the Siebel Test Automation module is installed?Check that the list of running processes in the Windows Task Manager includes a processnamed SiebelAx_Test_A. This process will appear only after you have logged into theSiebel application.Does Mercury QTP care what mode the Siebel application is in (HI vs. SI)?Support for High Interactivity applications is different from support for StandardInteractivity applications. When recording a script against a HI application, the scriptmostly contains calls into the Siebel-provided test automation API. In contrast, whenrecording a script against a pure SI application or against a SI component that isembedded within an HI application (e.g. customer dashboard, query assistant, searchcenter), the script mostly contains calls that use Mercury‘s native scripting syntax.Descriptive Programming:Whenever QTP records any action on any object of an application, it adds somedescription on how to recognize that object to a repository of objects called objectrepository. QTP cannot take action on an object until unless its object description is in theObject Repository. But descriptive programming provides a way to perform action onobjects which are not in Object repositoryObject Identification:To identify an object during the play back of the scripts QTP stores some propertieswhich helps QTP to uniquely identify the object on a page. Below screen shots shows anexample Object repository: Now to recognize a radio button on a page QTP had added 2 properties the nameof the radio button and the html tag for it. The name the left tree view is the logical nameName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 10
  11. 11. VLearn Technologies www.mysaptesting.comgiven by QTP for the object. This can be changed as per the convenience of the personwriting the test case. QTP only allows UNIQUE logical name under same level ofhierarchy. As we see in the snapshot the two objects in Browser->Page node are―WebTable‖ and ―testPath‖, they cannot have the same logical name. But an object undersome other node can have the same name. Now with the current repository that we have,we can only write operation on objects which are in the repository. Some of the exampleoperations are given belowBrowser("Browser").Page("Page").WebRadioGroup ("testPath").Select "2"CellData = Browser("Browser").Page("Page").WebTable ("WebTable").GetCellData(1,1)Browser("Example2").Page("Page").WebEdit("testPath").Set "Test text"When and Why to use Descriptive programming?Below are some of the situations when Descriptive Programming can be considereduseful:1. The objects in the application are dynamic in nature and need special handling toidentify the object. The best example would be of clicking a link which changesaccording to the user of the application, Ex. ―Logout <>‖.2. When object repository is getting huge due to the no. of objects being added. If the sizeof Object repository increases too much then it decreases the performance of QTP whilerecognizing an object.3. When you don‘t want to use object repository at all. Well the first question would bewhy not Object repository? Consider the following scenario which would helpunderstand why not Object repositoryScenario 1: Suppose we have a web application that has not been developed yet.NowQTP for recording the script and adding the objects to repository needs the application tobe up, that would mean waiting for the application to be deployed before we can start ofwith making QTP scripts. But if we know the descriptions of the objects that will becreated then we can still start off with the script writing for testingScenario 2: Suppose an application has 3 navigation buttons on each and every page.Let the buttons be ―Cancel‖, ―Back‖ and ―Next‖. Now recording action on these buttonswould add 3 objects per page in the repository. For a 10 page flow this would mean 30objects which could have been represented just by using 3 objects. So instead of addingthese 30 objects to the repository we can just write 3 descriptions for the object and use iton any page.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 11
  12. 12. VLearn Technologies www.mysaptesting.com4. Modification to a test case is needed but the Object repository for the same is Readonly or in shared mode i.e. changes may affect other scripts as well.5. When you want to take action on similar type of object i.e. suppose we have 20textboxes on the page and there names are in the form txt_1, txt_2, txt_3 and so on. Nowadding all 20 the Object repository would not be a good programming approach.How to use Descriptive Programming?There are two ways in which descriptive programming can be used1. By creating properties collection object for the description.2. By giving the description in form of the string arguments.1. By creating properties collection object for the description.To use this method you need first to create an empty descriptionDim obj_Desc ‗Not necessary to declareSet obj_Desc = Description.CreateNow we have a blank description in ―obj_Desc‖. Each description has 3 properties―Name‖, ―Value‖ and ―RegularExpression‖.obj_Desc(―html tag‖).value= ―INPUT‖When you use a property name for the first time the property is added to the collectionand when you use it again the property is modified. By default each property that isdefined is a regular expression. Suppose if we have the following descriptionobj_Desc (―html tag‖).value= ―INPUT‖obj_Desc (―name‖).value= ―txt.*‖This would mean an object with html tag as INPUT and name starting with txt. Nowactually that ―.*‖ was considered as regular expression. So, if you want the property―name‖ not to be recognized as a regular expression then you need to set the ―regularexpression‖ property as FALSEobj_Desc(―html tag‖).value= ―INPUT‖obj_Desc(―name‖).value= ―txt.*‖obj_Desc(―name‖).regularexpression= ―txt.*‖This is how we create a description. Now below is the way we can use itBrowser(―Browser‖).Page(―Page‖).WebEdit(obj_Desc).set ―Test‖When we say .WebEdit(obj_Desc) we define one more property for our description thatName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 12
  13. 13. VLearn Technologies www.mysaptesting.comwas not earlier defined that is it‘s a text box (because QTPs WebEdit boxes map to textboxes in a web page).If we know that we have more than 1 element with same description on the page then wemust define ―index‖ property for the that descriptionNow the html code has two objects with same description. So distinguish between these 2objects we will use the ―index‖ property. Here is the description for both the objectFor 1st textbox:obj_Desc(―html tag‖).value= ―INPUT‖obj_Desc(―name‖).value= ―txt_Name‖obj_Desc(―index‖).value= ―0‖For 2nd textbox:obj_Desc(―html tag‖).value= ―INPUT‖obj_Desc(―name‖).value= ―txt_Name‖obj_Desc(―index‖).value= ―1‖We can use the same description for both the objects and still distinguish between both ofthemobj_Desc(―html tag‖).value= ―INPUT‖obj_Desc(―name‖).value= ―txt_Name‖When I want to refer to the textbox then I will use the inside a WebEdit object and torefer to the radio button I will use the description object with the WebRadioGroup object.Browser(―Browser‖).Page(―Page‖).WebEdit(obj_Desc).set ―Test‖ ‗Refers to the text boxBrowser(―Browser‖).Page(―Page‖).WebRadioGroup(obj_Desc).set ―Test‖ ‗Refers to theradio buttonBut if we use WebElement object for the description then we must define the ―index‖property because for a webelement the current description would return two objects.Hierarchy of test description:When using programmatic descriptions from a specific point within a test objecthierarchy, you must continue to use programmatic descriptionsfrom that point onward within the same statement. If you specify a test object by itsobject repository name after other objects in the hierarchy havebeen described using programmatic descriptions, QuickTest cannot identify the object.For example, you can use Browser(Desc1).Page(Desc1).Link(desc3), since it usesprogrammatic descriptions throughout the entire test object hierarchy.You can also use Browser("Index").Page(Desc1).Link(desc3), since it uses programmaticdescriptions from a certain point in the description (startingName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 13
  14. 14. VLearn Technologies www.mysaptesting.comfrom the Page object description).However, you cannot use Browser(Desc1).Page(Desc1).Link("Example1"), since it usesprogrammatic descriptions for the Browser and Page objects butthen attempts to use an object repository name for the Link test object (QuickTest tries tolocate the Link object based on its name, but cannotlocate it in the repository because the parent objects were specified using programmaticdescriptions).Getting Child Object:We can use description object to get all the objects on the page that matches that specificdescription. Suppose we have to check all the checkboxes present on a web page. So wewill first create an object description for a checkboxe and then get all the checkboxesfrom the pageDim obj_ChkDescSet obj_ChkDesc=Description.Createobj_ChkDesc(―html tag‖).value = ―INPUT‖obj_ChkDesc(―type‖).value = ―checkbox‖Dim allCheckboxes, singleCheckBoxSet allCheckboxes = Browse(―Browser‖).Page(―Page‖).ChildObjects(obj_ChkDesc)For each singleCheckBox in allCheckboxessingleCheckBox.Set ―ON‖NextThe above code will check all the check boxes present on the page. To get all the childobjects we need to specify an object description i.e. we can‘t use the string argumentsthat will be discussed later in the 2nd way of using the programming description.Possible Operation on Description ObjectConsider the below code for all the solutionsDim obj_ChkDescSet obj_ChkDesc=Description.Createobj_ChkDesc(―html tag‖).value = ―INPUT‖obj_ChkDesc(―type‖).value = ―checkbox‖Q: How to get the no. of description defined in a collectionA: obj_ChkDesc.Count ‗Will return 2 in our caseName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 14
  15. 15. VLearn Technologies www.mysaptesting.comQ: How to remove a description from the collectionA: obj_ChkDesc.remove ―html tag‖ ‗would delete the html tag property from thecollectionQ: How do I check if property exists or not in the collection?A: The answer is that it‘s not possible. Because whenever we try to access a propertywhich is not defined its automatically added to the collection. The only way to determineis to check its value that is use an if statement ―if obj_ChkDesc(―html tag‖).value =empty then‖.2. By giving the description in form of the string arguments.This is a more commonly used method for Descriptive Programming.You can describe an object directly in a statement by specifying property:=value pairsdescribing the object instead of specifying an object‘s name.The general syntax is:TestObject("PropertyName1:=PropertyValue1", "..." ,"PropertyNameX:=PropertyValueX")TestObject—the test object class could be WebEdit, WebRadioGroup etc….Browser(―Browser‖).Page(―Page‖).WebRadioGroup(―Name:=txt_Name‖,‖htmltag:=INPUT‖).set ―Test‖If we refer to them as a web element then we will have to distinguish between the 2 usingthe index propertyBrowser(―Browser‖).Page(―Page‖).WebElement(―Name:=txt_Name‖,‖htmltag:=INPUT‖,‖Index:=0‖).set ―Test‖ ‗ Refers to the textboxBrowser(―Browser‖).Page(―Page‖).WebElement(―Name:=txt_Name‖,‖htmltag:=INPUT‖,‖Index:=1‖).set ―Test‖ ‗ Refers to the radio buttonFour different ways to launch your application are mentioned below:SystemUtil.RunSystemUtil.Run ( FileName, Parameters, Path, Operation )FileName - The name of the file you want to run.Parameters - If the specified FileName is an executable file, use the Parametersargument to specify any parameters to be passed to the application.Path - The default directory of the application or file.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 15
  16. 16. VLearn Technologies www.mysaptesting.comOperation - The action to be performed. If this argument is blank (""), the openoperation is performed.The following operations can be specified for the operation argument of theSystemUtil.Run method:Example: SystemUtil.Run ―c:flight.exe‖InvokeApplicationInvokeApplication("Full URL as Parameter")Static and Dynamic Arrays:VBScript provides flexibility for declaring arrays as static or dynamic.A static array has a specific number of elements. The size of a static array cannot bealtered at run time.A dynamic array can be resized at any time. Dynamic arrays are useful when size of thearray cannot be determined. The array size can be changed at run time.Next we will deal with user defined procedures, functions and subroutines.I have seen an umpteen no of posts in every QTP group I visited asking about TestAutomation frameworks. Here I would like to collate the useful inputs i received fromvarious QTP groups and discussion forums.Data-driven Testing:Data-driven testing is a framework where test input and output values are read from datafiles (datapools, ODBC sources, csv files, Excel files, DAO objects, ADO objects, andsuch) and are loaded into variables in captured or manually coded scripts. In thisframework, variables are used for both input values and output verification values.Navigation through the program, reading of the data files, and logging of test status andinformation are all coded in the test scriptModularity-driven testingThe test script modularity framework requires the creation of small, independent scriptsthat represent modules, sections, and functions of the application-under-test. These smallscripts are then used in a hierarchical fashion to construct larger tests, realizing aparticular test case.##################################################### Descriptive Programming Objects##################################################### Modifications: Enter changes to the code in this spaceName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 16
  17. 17. VLearn Technologies www.mysaptesting.com##################################################### Public Sub WebTableLink (strWebLink)##################################################### Modifications: Enter changes to the code in this space####################################################Public Sub DPWebEdit (strWebEdit,strInValue) If strInValue <> "" Then Set obj_WebEdit = Description.Create obj_WebEdit ("Class Name").value = "WebEdit" obj_WebEdit ("name").value= strWebEdit Browser(strBrowser).page(strPage).Sync Browser(strBrowser).Page(strPage).WebEdit(obj_WebEdit).SetstrInValue End IfEnd Sub########################################################Public Sub DPWebEditSetSecure (strWebEdit,strInValue) If strInValue <> "" Then Set obj_WebEdit = Description.Create obj_WebEdit ("Class Name").value = "WebEdit" obj_WebEdit ("name").value= strWebEdit Browser(strBrowser).page(strPage).Sync Browser(strBrowser).Page(strPage).WebEdit(obj_WebEdit).SetSecurestrInValue End IfEnd Sub########################################################Public Sub DPWebList (strWebList,strInValue) If strInValue <> "" Then Set obj_WebList = Description.Create obj_WebList ("Class Name").value = "WebList" obj_WebList ("name").value= strWebList Reporter.Filter = 3 Turn Reporting of Call TestListValues (obj_WebList,strInValue) Check for valid item in listName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 17
  18. 18. VLearn Technologies www.mysaptesting.com Reporter.Filter = 0 Turn Reporting on Browser(strBrowser).page(strPage).Sync Browser(strBrowser).Page(strPage).WebList(obj_WebList).SelectstrInValue End IfEnd Sub########################################################Public Sub DPRadioGroup (strWebRadioGroup,strInValue) Set obj_WebRadioGroup = Description.Create obj_WebRadioGroup ("Class Name").value = "WebRadioGroup" obj_WebRadioGroup ("name").value= strWebRadioGroup Browser(strBrowser).page(strPage).Sync Browser(strBrowser).Page(strPage).WebRadioGroup(obj_WebRadioGroup).Select strInValueEnd Sub####################################################Public Sub DPWebImage (strImage) Set obj_Image = Description.Create obj_Image ("Class Name").value = "Image" obj_Image ("name").value= strImage Browser(strBrowser).page(strPage).Sync Browser(strBrowser).Page(strPage).Image(obj_Image).Click 6,7End Sub####################################################Public Sub DPWebCheckBox (strWebCheckBox,strInValue) Set obj_WebRadioGroup = Description.Create obj_WebCheckBox ("Class Name").value = "WebCheckBox" obj_WebCheckBox ("name").value= strWebRadioGroup Browser(strBrowser).page(strPage).Sync Browser(strBrowser).Page(strPage).WebCheckBox(obj_WebCheckBox).SelectstrInValueName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 18
  19. 19. VLearn Technologies www.mysaptesting.comEnd Sub####################################################Public Sub DPWebLink (strWebLink) Set obj_WebLink = Description.Create obj_WebLink ("Class Name").value = "Link" obj_WebLink ("name").value= strWebLink Count = 1 Do until Browser(strBrowser).Page(strPage).Link(obj_WebLink).Exist if Browser(strBrowser).Page(strPage).Link(obj_WebLink).Exist Then Exit Do End If Count = Count + 1 If Count = 20 Then Exit Do end if Loop Browser(strBrowser).Page(strPage).Link(obj_WebLink).ClickEnd Sub####################################################Public Sub DPWebButton (strWebButton) Set obj_WebButton = Description.Create obj_WebButton ("Class Name").value = "WebButton" obj_WebButton ("name").value= strWebButton Browser(strBrowser).page(strPage).Sync Browser(strBrowser).Page(strPage).WebButton(obj_WebButton).ClickEnd SubName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 19
  20. 20. VLearn Technologies www.mysaptesting.com#################################################### Close all opened browsers‗####################################################Public Function CloseBrowsers If Browser("micclass:=Browser").Exist (0) Then Browser("micclass:=Browser").Close End If While Browser("micclass:=Browser", "index:=1").Exist (0) Browser("index:=1").Close Wend If Browser("micclass:=Browser").Exist (0) Then Browser("micclass:=Browser").Close End IfEnd Function‗#####################################################Set myBrowser = Description.CreatemyBrowser("version").value = "internet explorer 7"Set eachBrowser = Desktop.ChildObjects(myBrowser) b= eachBrowser.count() msgbox "No of Windows Browsers Opened" & VBNewLine &bFor i = 1 to b - 1 msgbox "Browser Names" &eachBrowser(i).getroproperty("text") eachBrowser(i).closeNext‗####################################################‗ Launch Application returns - always returns true‗####################################################Public Function Launch (apptype, val) If "website" = apptype Then thirdlevel = "" Report micPass, "Initialize", "Initializing Framework" level = split(webLevels, leveldelimiter, -1, 1) desc = split(webLevelsDesc, leveldescdelimiter, -1, 1) object = split(objects, objectdelimiter, -1, 1) objectDescription = split(objectsDescription, objectsDescriptiondelimiter, -1, 1) CloseBrowsers Set IE = CreateObject("InternetExplorer.Application")Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 20
  21. 21. VLearn Technologies www.mysaptesting.com IE.visible = true IE.Navigate val While IE.Busy wait 1 Wend End If initialized = true Launch = trueEnd Function‗####################################################‗ WebElement Items‗####################################################Set oDesc = Description.Create()oDesc("Class Name").Value = "WebElement"oDesc("Class").Value = "hp_hclist_box"rc = Browser("WebMD - Better information.").Page("WebMD - Betterinformation.").WebElement(oDesc).GetROProperty("innertext")sp = Split(rc, " ")Msgbox sp(4)‗####################################################Set Desc= description.Create()desc("micclass").value ="WebCheckBox"Set data=Browser("name:=127.0.0.1").Page("title:=127.0.0.1").ChildObjects(desc)s=data.count()msgbox "Buttons" & VBNewLine &sFor i = 0 to s - 1 msgbox data(i).getroproperty("name")Next‗####################################################Set Desc= description.Create()desc("micclass").value ="WebEdit"Set data=Browser("name:=127.0.0.1").Page("title:=127.0.0.1").ChildObjects(desc)s=data.count()msgbox "Buttons" & VBNewLine &sName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 21
  22. 22. VLearn Technologies www.mysaptesting.comFor i = 0 to s - 1 msgbox data(i).getroproperty("name")Next‗####################################################Set Desc= description.Create()desc("micclass").value ="WebRadioButton"Set data=Browser("name:=127.0.0.1").Page("title:=127.0.0.1").ChildObjects(desc)s=data.count()msgbox "Buttons" & VBNewLine &sFor i = 0 to s - 1 msgbox data(i).getroproperty("name")Next‗####################################################Set Desc= description.Create()desc("micclass").value ="WebButton"Set data=Browser("name:=127.0.0.1").Page("title:=127.0.0.1").ChildObjects(desc)s=data.count()msgbox "Buttons" & VBNewLine &sFor i = 0 to s - 1 msgbox data(i).getroproperty("name")Next‗####################################################‗ Links and URL‘s‗####################################################Set oDesc = Description.Create()oDesc("html tag").Value = "A"Set rc = Browser("Google").Page("Google").ChildObjects(oDesc)num = rc.Count()For i=0 to num-1tag = rc(i).GetROProperty("innertext")href = rc(i).GetROProperty("href")Reporter.ReportEvent 0, "Links in Page", "name: " & tag &"; url:" & hrefNext‗####################################################‗ Automation Object ModelName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 22
  23. 23. VLearn Technologies www.mysaptesting.com‗####################################################Dim App As ApplicationSet App = CreateObject("QuickTest.Application")App.LaunchApp.Visible = TrueApp.Test.Settings.Launchers("Web").Active = FalseApp.Test.Settings.Launchers("Web").Browser = "IE"App.Test.Settings.Launchers("Web").Address = "http://newtours.mercury.com "App.Test.Settings.Launchers("Web").CloseOnExit = TrueApp.Test.Settings.Launchers("Windows Applications").Active = FalseApp.Test.Settings.Launchers("Windows Applications").Applications.RemoveAllApp.Test.Settings.Launchers("Windows Applications").RecordOnQTDescendants = TrueApp.Test.Settings.Launchers("Windows Applications").RecordOnExplorerDescendants =TrueApp.Test.Settings.Launchers("Windows Applications").RecordOnSpecifiedApplications= TrueApp.Test.Settings.Run.ObjectSyncTimeOut = 20000App.Test.Settings.Run.DisableSmartIdentification = FalseApp.Test.Settings.Run.OnError = "Dialog"App.Test.Settings.Resources.Libraries.RemoveAllApp.Test.Settings.Resources.Libraries.Add("E:childobject3.vbs")App.Test.Settings.Resources.Libraries.Add("E:WriteToexcel.vbs")App.Test.Settings.Resources.Libraries.Add("E:SugarCRM.vbs")App.Test.Settings.Web.BrowserNavigationTimeout = 60000App.Test.Settings.Web.ActiveScreenAccess.UserName = ""App.Test.Settings.Web.ActiveScreenAccess.Password = ""App.Test.Settings.Recovery.Enabled = TrueApp.Test.Settings.Recovery.SetActivationMode "OnError"App.Test.Settings.Recovery.Add "E:aaaa.qrs", "Recov_Popup", 1App.Test.Settings.Recovery.Item(1).Enabled = TrueApp.Test.Environment.LoadFromFile("E:InputDataSheet.ini") **************************************************Function Library‗******************************** Registering both functionsRegisterUserFunc "WebTable", "ObjectsByMicClass", "ObjectsByMicClass"Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 23
  24. 24. VLearn Technologies www.mysaptesting.comRegisterUserFunc "WebTable", "ItemByKeyColumn", "ItemByKeyColumn" Function: ObjectsByMicClass Description: Returns a collection of objects all the objects in a WebTable that have the specified MicClass Return Value: A Collection of Objects Arguments: Obj - Test Object (WebTable) micClass - The micClass of the objects to retrieve##################################################Function ObjectsByMicClass(Obj, micClass) Set Table = Obj Create a collection object to hold the items Set objCollection = CreateObject("Scripting.Dictionary") Go over all the cells in the table, and look for objects with the specified micClass For row=1 to Table.RowCount ColumnCount=Table.ColumnCount(row) For col=1 to ColumnCount For ItemIndex=0 to Table.ChildItemCount(row, col, micClass)-1 Set childItem=Nothing Set childItem = Table.ChildItem(row, col, micClass, ItemIndex) If Not childItem is Nothing Then If the cell contains a micClass object, add it to the collection ItemKey = objCollection.Count + 1 objCollection.Add ItemKey, childItem End if Next Next Next Set ObjectsbyMicClass = objCollectionEnd Function‗####################################################### Function: ItemByKeyColumn Description: Returns an item from a column, based on the value of a key column Return Value: Object Arguments: Obj - Test Object (WebTable) KeyColumnIndex - Index of the KeyColumn KeyColumnValue - Value to search for in the key column KeyItemIndex - Index of the value in the key column (if there is more than one). If 0, the first item will be used.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 24
  25. 25. VLearn Technologies www.mysaptesting.com TargetColumnIndex - Column from which to retrieve the target item micClass - The micClass of the target item TargetItemIndex - Index of the target item to retrieve (if there is more than one). If 0, the first item will be used.‗#######################################################Function ItemByKeyColumn(Obj, KeyColumnIndex, KeyColumnValue, KeyItemIndex,TargetColumnIndex, micClass, TargetItemIndex) Table = Obj rowCount = Table.RowCount if TargetItemIndex was not specified, use 1 as deafult If TargetItemIndex < 1 Then TargetItemIndex = 1 End If if KeyColumnIndex was not specified, use 1 as default If KeyItemIndex < 1 Then KeyItemIndex = 1 End If look for KeyColumnValue in the key column to determine which row to retrieve the targe item from Row = 0 foundIndex = 0 While Row <= RowCount And foundIndex < KeyItemIndex Row = Row + 1 CellData = Table.GetCellData(Row, KeyColumnIndex) If CellData = KeyColumnValue Then foundIndex = foundIndex + 1 End If Wend If foundIndex < KeyItemIndex Then Exit Function End If Now that we know the row, retrieve the item (according to its micClass) from the target column. ChildItemsCount = Table.ChildItemCount(Row, TargetColumnIndex, micClass) If ChildItemsCount > =1 And ChildItemsCount >= TargetItemIndex Then Set GetItemByKeyColumn = Table.ChildItem(Row, TargetColumnIndex,micClass, TargetItemIndex-1) End IfEnd FunctionName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 25
  26. 26. VLearn Technologies www.mysaptesting.com ************************************ Using the ItemByKeyColumn Function‗##################################################Set obj = Browser("Table with objects").Page("Itenerary: MercuryTours").WebTable("Acapulco toZurich").ItemByKeyColumn(1,"FLIGHT",2,3,"WebElement",1)msgbox obj.GetROProperty("innerhtml") Using the ObjectsByMicClass functionSet collection =Browser("Browser").Page("Page").WebTable("Table").ObjectsByMicClass("WebCheckBox")For i=1 to collection.count If collection(i).GetROProperty("checked") Then collection(i).Set "OFF" Else collection(i).Set "ON" End IfNext‗########################################## Example 1‗#############################################Function SendMail(SendTo, Subject, Body, Attachment) Set ol=CreateObject("Outlook.Application") Set Mail=ol.CreateItem(0) Mail.to=SendTo Mail.Subject=Subject Mail.Body=Body If (Attachment <> "") Then Mail.Attachments.Add(Attachment) End If Mail.Send ol.Quit Set Mail = Nothing Set ol = NothingEnd FunctionName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 26
  27. 27. VLearn Technologies www.mysaptesting.com‗################################################## Example 2‗###############################################Function SendMail(SendFrom, SendTo, Subject, Body) Set objMail=CreateObject("CDONTS.Newmail") ObjMail.From = SendFrom ObjMail.To = SendTo ObjMail.Subject = Subject ObjMail.Body = Body ObjMail.Send Set objMail = NothingEnd Function‗############################‗ InString‗############################Dim SearchString, SearchChar, MyPosSearchString ="XXpXXpXXPXXP" String to search in.SearchChar = "P" Search for "P".MyPos = Instr(4, SearchString, SearchChar,1) A textual comparison starting at position4. Returns 6.msgbox myposMyPos = Instr(1, SearchString, SearchChar, 0) A binary comparison starting atposition 1. Returns 9.msgbox myposMyPos = Instr(SearchString, SearchChar) Comparison is binary by default (lastargument is omitted). Returns 9.msgbox myposMyPos = Instr(1, SearchString, "W") A binary comparison starting at position 1.Returns 0 ("W" is not found).msgbox mypos‗######################################## QTP 10.0 Features1. QC integration – Which (mostly) down to Resource Management and SourceResource Management: Although you could keep saving your resources as attachments(for backward compatibility), you can upgrade to a new, fuller mode of work. Thisincludes a whole new Resource module in QC, and allows for some very neat tricks onFunction Libraries, Tests and Object Repositories etc.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 27
  28. 28. VLearn Technologies www.mysaptesting.comIt should be noted, though, that other types of files (external excel / XML files, forexample), remain as unmanaged attachments.Resources have full meta-data, and have a special view pane – you can view Object-Repositories, data-tables, and function libraries code right from QC. This looks quitenice; however, I missed the ability to open the resource for editing in QTP with a singleclick.Automatically updated path system – When moving a function library between folders,QC will automatically update all the tests which depend on it, so they will use it at itsnew location. This makes the once critical problem of hard-path-link a non-issue. Veryimpressive.A word about the user interface – when opening a QC resource / test from QTP, the filedialog shows the items with large, crisp icons, very similar to Word‘s save dialog.Everything is very clear and intuitive, as is the ability to revert back to saving / opening atest from the File-System.What about your existing projects? Well, when upgrading to QC 10, a wizard willautomatically transform all you unmanaged attachments to managed resources (if you‘dlike it to).Source Control: This includes a very rich line of features which are very well executed,and effectively allow you to manage a QTP project as any other code project:First, the basics – QTP and QC 10 introduce a new Check-in/Check-out ability. Itworks similar to what you‘d expect – a checked out item will be locked to all other users,and you can immediately know an item‘s status by looking at its icon (green/red locks).An interesting twist regards manner in which a test / resource is locked – it‘s at the userlevel (not the local machine level). This means that if you log into QC from a differentmachine, you‘ll have access to all your checked-out items, even if they were originallychecked-out on a different local machine. The ability is implemented very well, bothfrom QTP‘s end, as well as from QC‘s end.A major enabler for source control is the new versioning feature of QC. It manifestsboth with a kind of instant versioning for a single resource, and with a project-wide―base-line version‖, which allows you to revert your entire test framework to a previousversion. Both types of versioning are supported by a surprisingly robust comparisonmechanism. You can select two versions of a resource / test, a see a very detailedcomparison of their respective changes. For function libraries this amounts to a ―simple‖text comparison, but this feature truly shines in full test comparisons.It will present changes in the different actions and their resources (data-table, objectrepositories, inner code), as well as in the global test-settings, associated functionName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 28
  29. 29. VLearn Technologies www.mysaptesting.comlibraries, recovery scenarios, and pretty much anything you could think of. The ability todrill-down into the data is very impressive; and the effective, concise manner in whichthe data is presented in the top level view is downright unbelievable. A nice touch is asmall screen capture of the change, in case you don‘t remember what ―Run all rows –>Changed into-> Run a single iteration only‖ means (for example).Now to the versioning mechanism itself: Whenever you check and item in, a new―version‖ will be created, and you‘ll be able to revert back to it with ease. As this is aversion of a single, isolated resource, I found it better to refer to it as a SnapShot – myterminology, not HP‘s. The snapshots are visible both from QC and QTP, and you canvery easily choose which one to open. This allows you a kind of an instant undo to asingle file which worked in the past, but is broken in the present.The second mechanism presents the ability to select several folders, and create a fullblown ―base-line version‖ of them and everything they relate to. Defects, inner-connections, tests, history data, resources – all these and more will be ―frozen‖ andpreserved as a base-line. You can then choose to revert back to an old baseline, and trulyregain all the abilities that were present at that time. As all the resources, attachmentstests and reports will be restored, you don‘t have to worry about forgetting anything, orleaving some minor resource at the wrong version. This is versioning with a vengeance –it allows you to track the AUT‘s versions with your own automation versions, enabling,among other things, running automation efforts on several AUT versions at once.For conclusion – The new abilities inherit in the connection of QTP and QC Atlantis are(or at least seem to be) revolutionary. At last, QTP projects can be natively managed ascode projects; and some of the supporting infrastructure is surprisingly robust and useful.As a ―raving‖ anti-QC-ist, I must admit QC Atlantis seem tempting, and for me, that‘ssaying a lot!I must contrast these very positive impressions with some dire problems: The versioningfeature will put a stain on your storage capabilities (though less than creating a simplecopy the data); all these wonderful features are available only if both your QTP and QCare upgraded to Atlantis; and a critical issue – Previous versions of QTP will not workwith QC Atlantis. Yes, this is not a misunderstanding, there is no backwardcompatibility between QC to QTP (although QTP Atlantis will work with any version ofQC). On top of these, performance may become an issue, though we were unable toprecisely evaluate it, as our QC was installed on an already overtaxed personal computer.2. Report improvementsThe native QTP report includes several new improvements:Tracability: Selecting a report-node will automatically focus on the relevant code-line inthe script. This may sound like a cool feature at first, but a closer look revels that it onlyworks for actions (not functions); and that in any case, using a custom report function (asName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 29
  30. 30. VLearn Technologies www.mysaptesting.commost of us do) completely nullifies the feature (since you‘re always at the same code linewhen performing the report).Exporting: The report now has a two-click export feature, which comes with a built-inability to export to Word and PDF documents, as well as the ability to export through acustom XSL of your choosing. You can choose between Short and Long formats(corresponding to PShort.XSL and PDetails.XSL) to get a document relevant to yourneeds. This blessed feature has one major flaw – It has no API support. This means thatyou cannot export the results automatically at the end of a test run, which is quite a miss,to say the least.Resource Monitor: QTP can now hook onto the Windows Performance Monitor andpresent it as part of the test results. You can select several counters to monitor (e.g. GDIobjects, memory usage etc.), and the monitor output graph will be available in special tabin the result window. You can set up a ―checkpoint‖ for a counter (e.g. Fail the test ifthere are more than 500 GDI objects), facilitating a kind of a poor-man‘s version of load-testing.The fact that clicking the graph focuses on the relevant test step (as well as the other wayaround), provides an effective way to quickly locate problematic actions and resourceusage spikes. This feature is well executed, and HP has even went the extra mile andadded several unified counters that simplify monitoring the application. However, thefact that you can only monitor one process per test may leave the more advanced userswith their own implementation of a resource monitor.Considering the simple design and implementation of this feature, I believe it willbecome a popular tool in every automation project that uses QTP 10.Native image integration: This is a small, yet long-awaited feature. The ReportEventcommand now has a new optional parameter – you can specify a path to a picture file,and it will be attached to the report node of the current event. When used in conjunctionwith the CaptureBitmap method, this presents a technical, yet revolutionary upgrade tothe native QTP report. Finally, users can attach screenshots to their custom report eventswithout any special functions or frameworks.3. IDE improvementsIntellisense: Perhaps I‘m doing injustice to the other features, but the IDE improvements,and the new intellisense engine in particular, is what got me excited about QTP Atlantis.So I was pretty much on the edge of my seat when we‘ve gotten to this last part of thepresentation. I‘m very pleased to say that it was every bit what I imagined it to be, withthe exception of intellisense for VBScript classes, and intellisense in the debug viewer(both won‘t be implemented). Luckily, there are workarounds for both these issuesthrough the PDM hack (for debug intellisense), and WSC registration (for VBScriptClass intellisense through COM).Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 30
  31. 31. VLearn Technologies www.mysaptesting.comWe saw a demonstration of how creating an Excel COM object provided a fullintellisense for all its methods and properties, for as many levels as we‘d like. Everyvariable set to this object also presented the same intellisense, and the autocompletecaught every variable we‘ve defined or used (yes, there‘s autocomplete for variablenames!). The autocomplete and intellisense features worked smoothly, and presented noapparent performance issue. It‘s still left to be seen how it functions in a real script,with hundreds / thousands code lines.Tasks and Comment Pane: QTP has a new bottom pane which includes a run-of-the-mill implementation of tasks and comments. Double clicking a comment will take you tothe relevant code-line, though strangely enough, you cannot do this with a task (i.e.,tasks cannot be linked to specific code lines). It was mentioned that enabling thecomments feature for function libraries may sometimes cause performance issues.Dynamic code-zones: When standing inside a code block like If, While, Do, etc, the IDEwill mark the relevant block with blue lines, making it much more easy to make your wayinside nested blocks of this sort (somewhat like highlighting left-right bracket pairs).While it will surely make our life easier, a more robust mechanism like collapsible code-regions is still needed.Custom Toolbars: You can add your own buttons and commands to QTP toolbars andmenus. While this does not include inner-QTP macros, you can assign a program / Fileshortcut to your own button / menu item. It‘s nice, but i think it will only gain power onceQTP‘s inner mechanisms will be bindable to such buttons.4. Miscellaneous featuresGeneral look and feel: QTP has departed from the old Tab layout, and into the moremodern settings-tree layout (similar to Office, EMule, Adobe, and pretty much everyother program). It‘s nice, but nothing as groundbreaking as the transformation in QTP9.0.Bitmap Checkpoint improvements: These include presenting the size of the selectedarea when choosing to check only a part of an Image, as well as the ability to plug yourown custom DLL for comparing images. I suppose that there are some projects for whichthis can actually be quite revolutionary. Another great addition is the ability to see thedifference between the expected and actual bitmaps in a separate tab.API changes: QTP Automation API will receive several upgrades, the most noteworthyof which is the ability to read and write that code of the test you‘ve opened. Writing thecode will not effect an ongoing run-session (there goes my ambitious try-catchimplementation for QTP), but it still opens the door for some creative tweaks andhacks…Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 31
  32. 32. VLearn Technologies www.mysaptesting.comSaving a test with all linked resources: For those who‘re working with QC, this is a realblessing. Up until QTP 10, copying a QC saved test to your local system was a hellishprocedure of changing each and every resource and action reference to your local file-system. QTP and QC Atlantis offer a one-click solution for copying a test and all itsresources to your local file-system, and automatically changing all the referencesaccordingly.Dynamic Action Call: I‘ve saved the best for last. QTP 10 presents a new nativecommand – LoadAndRunAction. It allows you to load external actions during the run-session, without having to associate them with your test beforehand. All the run-timedebug abilities will be available for these dynamically added actions, so you‘re not givinganything up by using this feature. I think it‘s a long awaited feature, and a well executedone.What surprises are in store in QTP?1. Stronger than ever Quality Center integration.An external resources manager: No more hellish workarounds for saving resources asattachments (function libraries, shared OR etc.). From now on, an external resource willbecome a fully-fledged QC entity, with its own meta-data (which means it‘s searchable!),fields and versions.Versions: QTP tests and all the external resources will now have full versioning support.This will include reverting back to an old version (immediately, from the open file menuif you‘d wish), as well as comparing versions - from the attached resources of the tests,though the objects in the SOR, to the changed lines in the function library files.Versioning is available for manual tests as well, thus allowing for a very smoothintegration of automation with manual testing.I must say that this is one feature I would consider migrating my tests to Quality Centerfor.2. IntellisenseIt’s a known fact that the QTP intellisense popup can be quite annoying – just whenyou‘re dealing with a very complex .Net/Java object, the window proves to be too narrowto fully display the object‘s properties and methods. Tarun has continued his great workon providing productivity enhancing tools and code libraries, and has posted a resizer forthe intellisense popup window.COM objects intellisense - for example, if you‘d use an Excel.Application object, you‘dsee all its inner methods and properties, up to the N-th levelName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 32
  33. 33. VLearn Technologies www.mysaptesting.comVariable bridge intellisense - which means that if you‘d assign some object to avariable, the variable will have the same intellisense as the original objectThese three abilities present the bulk of abilities you would like to have in an intellisensesystem. It‘s not that there isn‘t room for more abilities, but these three are sure to makeworking with the new QTP an entirely different experience. It‘s unclear if this wouldinclude auto-complete for script variables, but my guess is that it will.I was told that all these intellisense features will not apply to VBScript classes, but onlyto COM objects and RO objects. As one who relays heavily on my own VBScript classes,I was very disappointed. However, it must be said that not a lot of QTP programmerswork with their own VBScript classes, so it‘s a shortcoming that only a handful of peopleshould mind.3. More IDE improvementsThese include the integration of a comment driven To-Do pane, as well as a jump-to-comment ability. Not anything out of the ordinary, but a blessed addition to the verylimited QTP IDE environment. Further more, and three versions too late – Toolbarcustomizations! You could rearrange existing icons, as well as add calls to externalcommands (e.g. launch the AUT) as separate icons.4. Reporter improvementsThe reporter will now be able to natively export the HTML to PDF (and perhaps someother formats).A completely new feature will be an integrated performance counter which wouldmonitor the computer resources throughout the test. This, combined with a new ability tojump to the relevant script live from the report will facilitate a whole new level of testing– almost like a poor-man‘s version of a load test.However, there‘s still no word on filtering, searching, and running several reportersconcurrently (although the infrastructure exists since QTP 8.2). Another overlooked issueis the report‘s availability in case of a mid-run crash.5. New checkpoint abilitiesYou could set up a whole new kind of checkpoint for the computed resources – forexample, fail the test if the application uses more than 500 GDI objects, and otherparameters. This ability is closely coupled with the new resource monitor report. Anotherwelcomed improvement is the ability to hook up your own algorithm for imagecomparison straight into QTP‘s native image checkpoint mechanism.6. New environmentsName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 33
  34. 34. VLearn Technologies www.mysaptesting.comIt will include at least: Windows XP SP3, Windows 2008, Windows Vista SP1, IE8,FireFox 3, the new cirtrix client.PRODUCT ENHANCEMENTSUpgrade from QuickTest 9.5 - If you have QTP 9.5 Installed on the system, you canchoose to upgrade to version 10.0. This will allow you to preserve some of theconfiguration settings and options that you already have set up.Improved IntelliSense Functionality - QTP now provides full IntelliSense for objectscreated by a step or function (i.e. objects created by Create Object method), variables towhich an object is assigned, reserved objects, COM objects and properties that returnobjects. In addition, Intellisense sentence completion now provides lists of localvariables.Added Control for Editing and Managing Actions in Automation Scripts - The QTPAutomation Object Model has a new set of objects and methods for manipulating testactions and action parameters. You can use automation scripts to create new actions,modify and validate the syntax of action scripts, create and modify action parameters, andmore.Improved Debugger Pane Design and Functionality - The Debug Viewer pan has anew look, including icons to help you identify the type of information displayed.New Object Identification Solutions in Maintenance Run Mode - In addition tohelping you update your steps and object repositories when objects in application change,the Maintenance Run Wizard can now help you solve problems dealing with test failuresdue to missing objects, or objects that can only be recognized via Smart Identification.Additional Configuration Settings for Text Recognition Mechanism - You can nowset all text recognition configuration settings from the QuickTest Options Dialog BoxNew Look for Options, Settings, and File Dialog Boxes - The QuickTest Options andSettings dialog boxes have changed from their former ta-based design to a more easilynavigable tree-based structure. The tree contains only the options relevant for the add-insthat are currently loaded.QuickTest Toolbar Customization Options - You can use the new Customize Dialogbox to customize the appearance of existing menus and toolbars, and to create your ownuser-defined menus, toolbar buttons, and shortcuts.Improved Web Extensibility - QTP Web Add-in Extensibility enables you to developpackages that provide high level support for thir-party and custom Web controls that arenot supported out-of-the-box by the Web Add-in.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 34
  35. 35. VLearn Technologies www.mysaptesting.comNET Add-in and Extensibility Improvements - The .NET Add-in has several newobjects and methods, including the SwfPropertyGrid test object (for working with .NETWindows Forms property grids), GetErrorProviderText method and ErrorProviderTextidentification property.New Terminal Emulator Configuration Validation - The new Terminal Emulator paneof the Options dialog box now includes a Validate button. When you click this button,QTP checks the current configurations of the selected emulator. If a problem is detected,a brief description is displayed in the pane.NEW SUPPORTED OPERATING SYSTEMS AND ENVIRONMENTS  Microsoft Windows 2008 Server 32-bit Edition  Microsoft Windows 2008 Server 64-bit Edition  Microsoft Windows Vista, Service Pack 1, 32-bit Edition  Microsoft Windows Vista, Service Pack 1, 64-bit Edition  Microsoft Windows XP Professional 32-bit Edition -- Service Pack 3  Citrix Presentation Server 4.5  Microsoft Internet Explorer 8, Beta 2  Mozilla firefox 3.0.x  Delphi: IDE, versions 6, 7, and 2007 (for controls based on the Win32 VCL library)  SAP: CRM 2007 (For controls that support test mode enhancements  Java: IBM 32-bit JDK 1.5.x, SWT toolkit version 3.4  Java Extensibility: Eclipse IDE 3.4NET: .NET Framework 3.5 -- Service Pack 1// ** TO Count Broken Links in Web Page Using VBScript1.Set obj=Browser(―name:=Blackboard.*‖).Page(―title:=Blackboard.*‖).Frame(―name:=main.*‖).object.all.tags(―IMG‖)Msgbox obj.lengthFor each element in objs1=element.namePropIf Browser().Page().Frame().Image(―filename:=―&s1,‖index:=0‖).exist(0) then If Browser().Page().Frame().Image(―filename:=―&s1,‖index:=0‖). Object.complete=―True‖ then Msgbox ―pass‖ Else Msgbox ―fail‖ End ifEnd ifNext// TO Count Broken Links in Web Page Using VBScriptName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 35
  36. 36. VLearn Technologies www.mysaptesting.comIf Browser(―my_web‖).Page(―GlobalPage‖).Link(―Logout‖).GetROProperty(―href‖)<>―javascript:__doPostBack(ctl00$lkLogout,Logout)‖ ThenReporter.ReportEvent micFail ,‖href‖,Browser(―my_web‖).Page(―GlobalPage‖).Link(―Logout‖).GetROProperty(―href‖)End If// // TO Count Broken Links in Web Page Using VBScriptVerify Broken Links using VBscript (without checkpoints)One of my friends just wanted to check for the broken links (both textlinks and imagelinks) on the page with VB script and not the checkpoints.Set obj=Browser("name:=Blackboard.*").Page("title:=Blackboard.*").Frame("name:=main.*").object.all.tags("IMG")Msgbox obj.lengthFor each element in objs1=element.namePropIf Browser().Page().Frame().Image("filename:="&s1,"index:=0").exist(0) thenIfBrowser().Page().Frame().Image("filename:="&s1,"index:=0").Object.complete="True"thenMsgbox "pass"ElseMsgbox "fail"End ifEnd ifNext// TO Count Broken Links in Web PageBroken Links also sometimes called as dead links are those links on the web which arepermanently unavailable. Commonly found, 404 error is one example of such link. Nowthe question is how can we identify broken links with the help of QTP during the runsession?There can be two ways to do this: 1. Using Automatic Page checkpoint. 2. By manually creating a Page checkpoint.Using Automatic Page checkpoint: Go to Tools > Options > Web > Advanced andcheck the two boxes labeled ―Create a checkpoint for each page while recording‖ and―Broken Links‖Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 36
  37. 37. VLearn Technologies www.mysaptesting.comNow every time you record a new page, QTP will automatically include a checkpoint forbroken links.By manually creating a Page checkpoint: QTP does not provide a direct menu optionto incorporate a page checkpoint. You need to take the help of standard checkpoint. Startrecording session > Insert > Checkpoint > Standard Checkpoint (OR press F12). Placeand click the hand pointer anywhere on your web page. Select Page (As shown in picturebelow) and Click OK.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 37
  38. 38. VLearn Technologies www.mysaptesting.comYou will get the following screen:Check ―Broken Link‖ checkbox down below and click OK.Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 38
  39. 39. VLearn Technologies www.mysaptesting.comNow, how will you verify page checkpoint and hence broken links?Run the above script. Go To Test Results > Your Check Point. Check the status of alllinks under ―Broken Links Result‖If you want to verify links pointing only to the current host check the box titled “BrokenLinks- check only links to current host” under Tools > Options > Web. Similarly ifyou want to verify links pointing to other hosts as well, uncheck it.// TO Count No of Links in Web PageHow to return the total number of links in a webpage and their names and URLsSolution: Use ChildObjects to get the link collection, then retrieve the properties Use the ChildObjects method to retrieve all the links on the specified webpage.Once you have the collection, you can use the GetROProperty method to retrieve theinnertext (name) and href (URL) values.object.ChildObjects (pDescription)Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 39
  40. 40. VLearn Technologies www.mysaptesting.comExample:‗ The sample was created against www.google.comSet oDesc = Description.Create()oDesc(―html tag‖).Value = ―A‖Set rc = Browser(―Google‖).Page(―Google‖).ChildObjects(oDesc)num = rc.Count()For i=0 to num-1 tag = rc(i).GetROProperty(―innertext‖) href = rc(i).GetROProperty(―href‖) Reporter.ReportEvent 0, ―Links in Page‖, ―name: ― & tag & ―; url: ― & hrefNext// TO Count No of Links in Web PageSimple Code To Check All LinksSet oDesc = Description.Create()oDesc(―html tag‖).Value = ―A‖Set rc = Browser(―title:=.*‖).Page(―title:=.*‖).ChildObjects(oDesc)num = rc.Count()For i=0 to num-1 Set rc = Browser(―title:=.*‖).Page(―title:=.*‖).ChildObjects(oDesc) ref = rc(i).GetROProperty(―href‖) Browser(―title:=.*‖).Page(―title:=.*‖).link(―text:=.*‖,‖index:=―&i).click Browser(―title:=.*‖).sync title1=Browser(―title:=.*‖).getRoproperty(―title‖) MsgBox title1 Browser(―title:=.*‖).navigate(ref)‘Navigates to the url taken from ―href‖ property Browser(―title:=.*‖).sync title2=Browser(―title:=.*‖).getRoproperty(―title‖)‘get the tile of the tNavigated page MsgBox title2 If title1=title2 Then‘condition to check for the targetted page and Navigated page Reporter.ReportEvent 0, ―Navigated To Correct Page‖,‖―&title1′Reports if correct else Reporter.ReportEvent 1,‖―&title1,‖―&title2 End If Browser(―title:=.*‖).back‘Navigates back to main page Browser(―title:=.*‖).syncNextName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 40
  41. 41. VLearn Technologies www.mysaptesting.com// Chaild ObjectsSet desc = Description.Create()Set col = Browser(―name:=Google‖).Page(―title:=Google‖).ChildObjects(desc)ct = col.Count()msgbox ctSet desc2 = Description.Create()desc2(―micclass‖).Value = ―WebElement‖Set col2 = Browser(―name:=Google‖).Page(―title:=Google‖).ChildObjects(desc)ct2 = col.Count()msgbox ct2Set desc3 = Description.Create()desc3(―html tag‖).Value = ―INPUT‖Set col3 = Browser(―name:=Google‖).Page(―title:=Google‖).ChildObjects(desc)ct3 = col.Count()msgbox ct3// Get Each Radio in RadioGroup And CheckSet opt=Description.Createopt(―html tag‖).value=―INPUT‖opt(―type‖).value = ―radio‖Dim allOptions,allSet allOptions=Browser(―a‖).Page(―b‖).Frame(―c‖).ChildObjects(opt)all=allOptions.countMsgBox all for i= 0 to alleName=allOptions(i).getROProperty(―name‖)noofradio=allOptions(i).getElementsByName(eName).lengthfor j= 0 to noofradio-1radioname=allOptions(i).object.document.getElementsByName(eName).item(j).GetAdjucentText(―afterend‖)allOptions(i).object.document.getElementsByName(eName).item(j).checked=truemsgbox radionamenextnext// Copy an excel sheet to another excelFollowing is the code to copy the conntents of a sheet in one excel to another excel sheetSet objExcel = CreateObject(―Excel.Application‖)objExcel.Visible = TrueName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 41
  42. 42. VLearn Technologies www.mysaptesting.comSet objWorkbook1= objExcel.Workbooks.Open(―C:Documents andSettingsmohan.kakarlaDesktop1.xls‖)Set objWorkbook2= objExcel.Workbooks.Open(―C:Documents andSettingsmohan.kakarlaDesktop2.xls‖)objWorkbook1.Worksheets(―Sheet1″).UsedRange.CopyobjWorkbook2.Worksheets(―Sheet1″).Range(―A1″).PasteSpecial Paste =xlValuesobjWorkbook1.saveobjWorkbook2.saveobjWorkbook1.closeobjWorkbook2.closeset objExcel=nothing//Compare 2 Excel sheets cell by cellThis code will open two excel sheet and compare each sheet cell by cell, if any changesthere in cells , it will highlight the cells in red color in the first sheet.Set objExcel = CreateObject(―Excel.Application‖)objExcel.Visible = TrueSet objWorkbook1= objExcel.Workbooks.Open(―C:DocumentsandSettingsmohan.kakarlaDesktopDocs1.xls‖)Set objWorkbook2= objExcel.Workbooks.Open(―C:Documents andSettingsmohan.kakarlaDesktopDocs2.xls‖)Set objWorksheet1= objWorkbook1.Worksheets(1)Set objWorksheet2= objWorkbook2.Worksheets(1) For Each cell In objWorksheet1.UsedRange If cell.Value <> objWorksheet2.Range(cell.Address).Value Then cell.Interior.ColorIndex = 3′Highlights in red color if any changes in cells Else cell.Interior.ColorIndex = 0 End If Nextset objExcel=nothing// Excel Sorting By Row:Const xlAscending = 1Const xlNo = 2Const xlSortRows = 2Set objExcel = CreateObject(―Excel.Application‖)objExcel.Visible = TrueSet objWorkbook = objExcel.Workbooks.Open(―C:Documents andSettingsmohan.kakarlaDesktopDocs1.xls‖)Set objWorksheet = objWorkbook.Worksheets(1)objWorksheet.Cells(1,1).activateName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 42
  43. 43. VLearn Technologies www.mysaptesting.comSet objRange = objExcel.ActiveCell.EntireRowobjRange.Sort objRange, xlAscending, , , , , , xlNo, , , xlSortRowsset objExcel=nothingExcel Sorting By Colum :Const xlAscending = 1′represents the sorting type 1 for Ascending 2 for DescConst xlYes = 1Set objExcel = CreateObject(―Excel.Application‖)‘Create the excel objectobjExcel.Visible = True‘Make excel visibleSet objWorkbook = _objExcel.Workbooks.Open(―C:Documents andSettingsmohan.kakarlaDesktopDocs1.xls‖)‘Open the documentSet objWorksheet = objWorkbook.Worksheets(1)‘select the sheet based on the index .. 1,2 ,3 …Set objRange = objWorksheet.UsedRange‘which select the range of the cells has some data other than blankSet objRange2 = objExcel.Range(―A1″)‘ select the column to sortobjRange.Sort objRange2, xlAscending, , , , , , xlYesset objExcel=nothing// DELETE ROWS FROM XL SHEET Public Function BIP_xlsDeleteRowRange (sSrcPath, sDestPath, sStartRow, sEndRow)‗Create Excel objectSet oExcel = CreateObject(―Excel.Application‖)‗Sets the application to raise no app alerts‗In this case it will allow a file overwrite w/o raising a ‗yes/no‘ dialogoExcel.DisplayAlerts = False‗Open Book in ExcelSet oBook = oExcel.Workbooks.Open(sSrcPath)‗Set ActivesheetSet oSheet = oExcel.Activesheet‗Delete row rangeoSheet.Rows(sStartRow +‖:‖+ sEndRow).Delete‗Save new book to Excel fileoBook.SaveAs (sDestPath)‗Close the xls fileoExcel.Workbooks.Close()Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 43
  44. 44. VLearn Technologies www.mysaptesting.comEnd Function// DELETE COLUMNS FROM XL SHEETPublic Function BIP_xlsDeleteColumnRange (sSrcPath, sDestPath, sStartCol, sEndCol)‗Create Excel objectSet oExcel = CreateObject(―Excel.Application‖)‗Sets the application to raise no app alerts‗In this case it will allow a file overwrite w/o raising a ‗yes/no‘ dialogoExcel.DisplayAlerts = False‗Open Book in ExcelSet oBook = oExcel.Workbooks.Open(sSrcPath)‗Set ActivesheetSet oSheet = oExcel.Activesheet‗Delete row rangeoSheet.Columns(sStartCol + ―:‖ + sEndCol).Delete‗Save new book to Excel fileoBook.SaveAs (sDestPath)‗Close the xls fileoExcel.Workbooks.Close()End Function// ADODB CONNECTION TO READ DATA FROM EXCEL SHEETFunction obj_UDF_getRecordset (strFileName, strSQLStatement)Dim objAdCon, objAdRsSet objAdCon = CreateObject(―ADODB.Connection‖)objAdCon.Open ―DRIVER={Microsoft Excel Driver (*.xls)};DBQ=―&strFileName &―;Readonly=True‖If Err <> 0 Then Reporter.ReportEvent micFail,‖Create Connection‖, ―[Connection] Error hasoccured. Error : ― & Err Set obj_UDF_getRecordset = Nothing Exit FunctionEnd IfSet objAdRs = CreateObject(―ADODB.Recordset‖)objAdRs.CursorLocation=3 ‗ set the cursor to use adUseClient -disconnected recordsetobjAdRs.Open strSQLStatement, objAdCon, 1, 3MsgBox objAdRs.fields(4).nameWhile objAdRs.EOF=false For i=0 to 4 varConcat= varConcat&‖ ―& objAdRs.fields(i)NextReporter.ReportEvent 0,‖Here is the Full Contents‖,‖―& varConcat varConcat=――Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 44
  45. 45. VLearn Technologies www.mysaptesting.comobjAdRs.moveNextWendIf Err<>0 Then Reporter.ReportEvent micFail,‖Open Recordset‖, ―Error has occured.Error Code : ―& Err Set obj_UDF_getRecordset = Nothing Exit FunctionEnd IfSet objAdRs.ActiveConnection = NothingobjAdCon.CloseSet objAdCon = NothingSet obj_UDF_getRecordset = objAdRsEnd FunctionSet rsAddin = obj_UDF_getRecordset(―C:Documents andSettingsmohankDesktopLogin.xls‖, ―Select * from [Login$]‖)//Use the CompareFiles functionThe following function can be used to check and compare the content of the two files.Note:This function is not part of QuickTest Professional/Astra QuickTest. It is not guaranteedto work and is not supported by Mercury Interactive Technical Support. You areresponsible for any and all modifications that may be required.CompareFiles (FilePath1,FilePath2)FilePath1 The path to the first file to compareFilePath2 The path to the second file to comparePublic Function CompareFiles (FilePath1, FilePath2)Dim FS, File1, File2Set FS = CreateObject(―Scripting.FileSystemObject‖)If FS.GetFile(FilePath1).Size <> FS.GetFile(FilePath2).Size ThenCompareFiles = TrueExit FunctionEnd IfSet File1 = FS.GetFile(FilePath1).OpenAsTextStream(1, 0)Set File2 = FS.GetFile(FilePath2).OpenAsTextStream(1, 0)CompareFiles = FalseDo While File1.AtEndOfStream = FalseStr1 = File1.Read(1000)Str2 = File2.Read(1000)CompareFiles = StrComp(Str1, Str2, 0)Name: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 45
  46. 46. VLearn Technologies www.mysaptesting.comIf CompareFiles <> 0 ThenCompareFiles = TrueExit DoEnd IfLoopFile1.Close()File2.Close()End FunctionReturn value:The function returns 0 or False if the two files are identical, otherwise True.Example:File1 = ―C:countriesapple1.jpg‖File2 = ―C:countriesapple3.jpg‖If CompareFiles(File1, File2) = False ThenMsgBox ―Files are identical.‖ElseMsgBox ―Files are different.‖End If// GET NAMES OF ALL OPEN BROWSERSSet browserDesc = Description.Create()browserDesc(―application version‖).Value = ―internet explorer 6″Set browserColl = DeskTop.ChildObjects(browserDesc)browserCnt = browserColl.CountMsgBox ―There are ―&browserCnt&‖ instances of a browser‖For i = 0 To (browserCnt -1)MsgBox ―Browser # ―&i&‖ has title = ―& browserColl(i).GetROProperty(―title‖)Next ‗ iSet browserColl = NothingSet browserDesc = Nothing// How to run the scripts in 8.2 those are recorded in 9.0 or higherStep 1: Delete the object repository of 9.0Step 2: open a Blank test in 8.2Step 3: Create the shared object repository in 8.2 that should contain all the objects in 9.0and save.Step 4: create the action structure in 8.2 should contain the same num of actions, samenames 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 scriptsStep 8: now u can run the scripts with little modifications if requireAutomated Test Script Creation ProcessName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 46
  47. 47. VLearn Technologies www.mysaptesting.com Debugging and troubleshooting test scripts becomes extremely tedious when thetest script has hundreds of lines of code, verification points, branching logic, errorhandling, parameters, and test correlation among various recorded business processes. Amore manageable approach to debugging complex and lengthy test scripts is to recordportions of the script and debug those portions individually before recording other partsof the test script. After testing individual portions, you can determine how one portion ofthe test script works with another portion and how data flows from one recorded processto the other. After all sections for a test script have been recorded, you can playback theentire test script and ensure that it properly plays back from the beginning to the end withone or more sets of data. Always create a test plan that will assist in the creation of the regression testscript. A test script is only as good as the planning that takes place before it is written.This saves time and organizes the process. Remember that all regression test scripts will be written to run in the QAenvironment as well as the production environment. The automated regression test usewill be a part of the production test used to determine if a build truly does function asexpected in production.To manage the creation and edit of our automated regression tests QA will createautomated tests in the following manner: 1. Record each individual process such as logging in and logging out. Save those recordings on your desktop. 2. Verify that the script will play back with no errors. 3. Continue recording and playing back throughout the test script creation process, verifying the script will play back with each step taken. 4. Add multiple sets of data driven tests for each individual portion of each test where that kind of test is applicable. 5. Verify the individual test scripts with multiple sets of data will play back with no errors. 6. Add various check points throughout the test. 7. Verify the individual test scripts with various check points will play back with no errors. 8. Now integrate all recorded processes into one large test script. 9. Verify the large test script will play back with no errors.The key here is to ensure that each recorded process plays back successfully beforeproceeding to record the remaining portions of the entire test script. Do not string theindividual tests together for playback without first verifying that all of the processescould play back successfully as individual processes.Lesson to be learned here is to never, EVER wait to debug a script until the entire testscript has been recorded.SynchronizationSince QTP can play back recorded test scripts much faster than an end-user‘s manualkeystrokes all tests must be synchronized. Introduce artificial wait times in the testscripts to make sure the script will run appropriately without errors unattended. Take intoName: Govind Mail ID: mysaptesting@gmail.comAddress: Namdev block, Plot No: 502, Prime Hospital Lane, Hyderabad Page 47

×