02 test automation functional testing (qtp)

5,073 views

Published on

Published in: Technology
3 Comments
4 Likes
Statistics
Notes
  • These books are very useful for beginners
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi,



    Technology Specific Guide for QTP is a new book that has got great feedback from all the readers. It will get you started on the path of automation, introducing solutions, roadblocks, patches and ideas that will give you a solid foundation in the field of automation. Everyone from a novice user to an automation expert will have something they would have never heard of or used.



    http://bluemagic-automation.blogspot.in/



    Best Regards,

    Aditya.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • its very use for me
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
5,073
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
596
Comments
3
Likes
4
Embeds 0
No embeds

No notes for slide

02 test automation functional testing (qtp)

  1. 1. TEST AUTOMATION_FUNCTIONAL TESTING PCSR Qtp INDEX: PAGE No: INTRODUCTION 5 WAYS OF TESTING MANUAL TESTING AUTOMATION TESTING DRAWBACKS OF MANUAL TESTING DRAWBACKS OF AUTOMATION TESTING INTRODUCTION TO AUTOMATION TESTING NEED OF AUTOMATION TESTING FRAMEWORK TO LEARN ANY AUTOMATED TOOL TYPES OF AUTOMATED TOOL HISTORY OF QTP BASICS OF QTP 7 ANATOMY OF QTP RECORD AND RUN SETTINGS RECORDINGS RECORDING MODES CONTEXT SENSITIVE ANALOG LOW LEVEL VB SCRIPT OBJECT REPOSITORY TYPES OF OBJECT REPOSITORIES LOCAL SHARED OPERATIONS ON OBJECT REPOSITORY OBJECT REPOSITORY MANAGER OPERATIONAL OVERVIEW OF RECORDING AND RUNNING OBJECT IDENTIFICATION SMART IDENTIFICATION OBJECT SPY TYPES OF OBJECTS RUN TIME OBJECTS TEST OBJECTS QTP LIFE CYCLE 17, 17, 17, 38, 29, 29 PHASE 1: TEST PLANNING PHASE 2: GENERATING THE BASIC TEST PHASE 3: ENHANCING THE TEST INSERTING THE CHECK POINTS INTRODUCTION OPERATIONAL OVERVIEW OF CHECK POINTS TYPES OF CHECK POINTS STANDARD BITMAP DATABASE TEXT TEXT AREA ACCESSIBILITY XML PAGE TABLE IMAGEPC SURENDRA REDD Y Page 1
  2. 2. TEST AUTOMATION_FUNCTIONAL TESTING PCSR SYNCHRONIZING TEXT EXECUTION DATA DRIVEN TESTING PARAMETERIZATION DIFFERENT WAYS OF PARAMETERIZATION INSERTING OUTPUT VALUES INTRODUCTION OPERATIONAL OVERVIEW TYPES OF OUTPUT VALUES STANDARD TEXT TEXTAREA DATABASE XML MEASURING TRANSACTIONS START TRANSACTION END TRANSACTION INSERTING THE PROGRAMATIC STATEMENTS OBJECT CALLS CONDITION STATEMENTS LOOPING STATEMENTS COMMENTS UTILITY OBJECT STATEMENTS DEVELOPING THE SCRIPT STATEMENTS MANUALLY FREQUENTLY USED METHODS REAL TIME SCENARIOS TO USE METHODS HOW TO DEVELOP SCRIPTS IN REAL TIME WORKING WITH DATA TABLES AVOIDING CHECKPOINTS IN REAL TIME AVOIDING OUTPUT VALUES IN REAL TIME CASE STUDIES PHASE 4: DEBUGGING THE TEST INTRODUCTION BREAK POINTS STEP INTO STEP OUT STEP OVER DEBUG FROM STEP RUN TO STEP DEBUG VIEWER PANE WATCH VARIABLES COMMAND PHASE 5: TEST EXECUTION NORMAL EXECUTION BATCH EXECUTION PHASE 6: RESULT ANALYSIS ANALYZING THE RESULTS IDENTIFYING THE DEFECTS REPORTING MT-Notes MANUAL DEFECT REPORTING BUG TRACKING TOOL ORIENTED DEFECT REPORTING INTEGRATION WITH QUALITY CENTERPC SURENDRA REDD Y Page 2
  3. 3. TEST AUTOMATION_FUNCTIONAL TESTING PCSR ACTIONS 33 INTRODUCTION TYPES OF ACTIONS NORMAL ACTIONS REUSABLE ACTIONS EXTERNAL ACTIONS CREATING NEW ACTIONS SPLITTING ACTIONS RENAMING ACTIONS WORKING WITH DATA TABLE ACTION SHEETS WORKING WITH INPUT AND OUTPUT PARAMETERS FUNCTIONS 32 NEED OF FUNCTIONS CREATING USER DEFINED FUNCTIONS WORKING WITH UDF’S LIBRARIES 36 INTRODUCTION CREATING LIBRARY FILES ASSOCIATING LIBRARY FILES ADDITIONAL CONCEPTS 59, 31, 59, 53 FILE SYSTEM OBJECT ENVIRONMENT VARIABLES DATABASE CONNECTIONS MS ACCESS SQL SERVER ORACLE CREATING LOG FILES VIRTUAL OBJECT CONFIGURATION 56 RECOVERY SCENARIO MANAGER 29 INTRODUCTION TYPES OF TRIGGER EVENTS CREATING THE RECOVERY FILES ASSOCIATING THE RECOVERY FILES ERROR HANDLING DESCRIPTIVE PROGRAMMING 60 INTRODUCTION CREATING DESCRIPTIVE SCRIPTS ADVANTAGES REGULAR EXPRESSIONS 56 INTRODUCTION ADVANTAGES OF REGULAR EXPRESSIONS AUTOMATION OBJECT MODEL 58 INTRODUCTION WORKING WITH AOM OBJECTS ADVANTAGESPC SURENDRA REDD Y Page 3
  4. 4. TEST AUTOMATION_FUNCTIONAL TESTING PCSR DYNAMIC HANDLING OF OBJECT REPOSITORIES 58 FRAMEWORK IMPLIMENTATION 32 LINEAR MODULAR KEYWORD DRIVEN HYBRID DATA DRIVEN FEATURES IN LATEST VERSION 61 WORKING WITH QUALITY CENTER QC-Notes VB SCRIPT 38 VB SCRIPT LANGUAGE OVERVIEW VARIABLES CONSTRANTS DATA TYPES ARRAYS STATEMENTS CONDITIONAL STATEMENT IF……..THEN SELECT CASE LOOPING STATEMENTS FOR………..NEXT DO…………WHILE DO………….UNTIL WHILE…...WEND OTHER STATEMENTS CALL DIM EXIT WAIT EXECUTE OPTION EXPLICIT SET WITH OPERATORS ARTHEMATIC COMPARISION CONCATINATION LOGICAL PROCEDURES SUB PROCEDURES FUNCTION PROCEDURES PRE DEFINED FUNCTIONS DATA AND TIME STRING CONVERSION TRIMMING OTHER FUNCTIONS PREPARED BY 62 PC SURENDRA REDDYPC SURENDRA REDD Y Page 4
  5. 5. TEST AUTOMATION_FUNCTIONAL TESTING PCSR QTP WAYS OF TESTING: There are 2 ways of Testing: 1.MANUAL TESTING 2.AUTOMATION TESTING 1. MANUAL TESTING: Manual Testing is a process, in which all the phases of STLC (Software Testing Life Cycle) like Test planning, Test development, Test execution, Result analysis, Bug tracking and Reporting are accomplished successfully and manually with Human efforts. DRAWBACKS: 1. More no of human resources are required. 2. Time consuming. 3. Less accuracy. 4. Tiredness. 5. Simultaneous actions are almost impossible. 6. Repeating the same task again and again in same fashion is almost impossible. 2. AUTOMATION TESTING: Automation Testing is a process, in which all the drawbacks of Manual Testing are addressed properly and provides speed and accuracy to the existing testing process. DRAWBACKS: 1. Automated tools are expensive. 2. All the areas of the application can’t be tested successfully with the automated tools. 3. Lack of automation Testing experts. Note: Automation Testing is not a replacement for Manual Testing, it is just continuation for Manual Testing. Note: Automation Testing is recommended to be implemented only after the application has come to a stable stage. AUTOMATED TOOLS: Automated tool is defined as an assistant of test engineer, which works based on the instructions and information given by us and finally shows the result. General framework to learn any automated tool: 1. How to give the instructions? 2. How to give the information? 3. How to use its recording facility? 4. How to use its replay facility (or) play facility? 5. How to use analyze facility?PC SURENDRA REDD Y Page 5
  6. 6. TEST AUTOMATION_FUNCTIONAL TESTING PCSR TYPES OF AUTOMATED TOOLS: There are 2 types of BLACK BOX TESTING Automated Tools: 1. FUNCTIONAL TOOL (QTP) 2. PERFORMANCE TOOL (LOAD RUNNER) Apart from these 2 tools the test engineer will use MANAGEMENT TOOL (QUALITY CENTER) for managing the testing process. QTP: QUICK TEST PROFESSIONAL. Introduction of QTP: Type of the Tool : Functional tool. Company : Introduced by INTERACTIVE IN CORP. & taken over by HP in the year 2002. Script language : VB Script (It can understand other scripting languages also). Versions : VERSION YEAR OF RELEASED ASTRA 1998 5.0 2000 5.5 2001 6.0 2002 6.5 2003 8.0 2004 8.2 2005 9.0 2006 FEB 9.1 2007 JAN 9.2 2007 FEB 9.5 2008 JANPC SURENDRA REDD Y Page 6
  7. 7. TEST AUTOMATION_FUNCTIONAL TESTING PCSR QTP taken by HP in the year 2002 from Mercury interactive in corporation. WINRUNNER was the first tool of Mercury interactive in corp., all the objects of WINRUNNER are developed by structured programming language. The script language used is the text Script Language. To test the functionality of the application we use QTP. TEST PANE – SCRIPT AREA. FUNCTIONALITY TESTING: It is a type of testing in which one will perform testing the functionality of an application, functionality means behavior of the application. ANATOMY OF QTP: VB SCRIPT: Syntax: Complete HIERARCHY.OPERATION.”VALUE” CLASS NAME(“OBJECT NAME”).-------------------.OERATION.”VALUE” VbWindow(“emp”)VbEdit(“ename”).set”SURI” VbWindow(“emp”)VbEdit(“eage”).set”26” VbWindow(“emp”)VbEdit(“esal”).set”40,000” VbWindow(“emp”)VbEdit(“edesig”).set”SE” VbWindow(“emp”)VbButton(“submit”).CLICK VB Script for standard Windows application: Window(“emp”)WinEdit(“ename”).set”SURI” Window(“emp”)WinEdit(“eage”).set”26” Window(“emp”)WinEdit(“esal”).set”40,000” Window(“emp”)WinEdit(“edesig”).set”SE” Window(“emp”)WinButton(“submit”).CLICK VB Script for Java application: JavaWindow(“emp”)JavaEdit(“ename”).set”SURI” JavaWindow(“emp”)JavaEdit(“eage”).set”26” JavaWindow(“emp”)JavaEdit(“esal”).set”40,000” JavaWindow(“emp”)JavaEdit(“edesig”).set”SE” JavaWindow(“emp”)JavaButton(“submit”).CLICKPC SURENDRA REDD Y Page 7
  8. 8. TEST AUTOMATION_FUNCTIONAL TESTING PCSR VB Script for .NET application: SWFWindow(“emp”)SWFEdit(“ename”).set”SURI” SWFWindow(“emp”)SWFEdit(“eage”).set”26” SWFWindow(“emp”)SWFEdit(“esal”).set”40,000” SWFWindow(“emp”)SWFEdit(“edesig”).set”SE” SWFWindow(“emp”)SWFButton(“submit”).CLICK VB Script for WEB application: Browser(“ie”)Page(“yahoo”).WebEdit(“user name”).set”SURI” Browser(“ie”)Page(“yahoo”).WebEdit(“password”).set”surendra” Browser(“ie”)Page(“yahool”).Webbutton(“login”).CLICK Browser(“ie”)Page(“emp”).WebEdit(“ename”).set”SURI” Browser(“ie”)Page(“emp”).WebEdit(“eage”).set”26” Browser(“ie”)Page(“emp”).WebEdit(“esal”).set”40,000” Browser(“ie”)Page(“emp”).WebEdit(“edesig”).set”SE” Browser(“ie”)Page(“emp”).WebButton(“submit”).CLICKPC SURENDRA REDD Y Page 8
  9. 9. TEST AUTOMATION_FUNCTIONAL TESTING PCSR ADD INN MANAGER: Add inn manager is a feature provided by the QTP, which is used for making the QTP, compatible with the desired environments. Add inn manager will show the list of all available add inn’s, while opening the QTP, so that one can select the desired add inn’s and make the QTP compatible with those environments. With the default purchase of QTP, 3 built in add inn’s will be provided: 1. ACTIVE X 2. VISUAL BASIC 3. WEB By default QTP will be always compatible with standard windows environment. Apart from the above add inn’s any other add inn’s are required, one need to purchase them separately. Note: HP people also provides single license for all the add inn’s. PARTS OF QTP: 1.TEST PANE 2.ACTIVE SCREEN 3.DATA TABLE 4.DEBUG VIEWER PANE 5.INFORMATION PANE 6.MISSING RESOURCES PANE 7.TOOL OPTIONS 1. TEST PANE: Test pane is an area provided by the QTP, which is used for developing, viewing, and modifying the test script. Test pane shows the script in 2 views: 1. EXPERT VIEW 2. KEYWORD VIEW 1. EXPERT VIEW: Expert view shows the script in VB script format. 2. KEYWORD VIEW: Keyword view shows the script in graphical user interface, which is further divided into 4 parts: 1. ITEM 2. OPERATION 3. VALUE 4. DOCUMENTATION Note: Any modifications done in one view will be reflected in the other view. 2. ACTIVE SCREEN: Active screen is an a area provided by QTP, which holds the snapshots related to each and every recorded scripts statements and used for easily understanding and enhancing the scripts.PC SURENDRA REDD Y Page 9
  10. 10. TEST AUTOMATION_FUNCTIONAL TESTING PCSR RECORDING AND RUNNING: OPERATIONAL OVERVIEW OF RECORDING: DURING RECORDING QTP WILL DO THE FOLLOWING: 1. It will generate the corresponding script statements related to the user actions. 2. It will store the required and related objects information in the object repository. OPERATIONAL OVER VIEW OF RUNNING: DURING RUNNING QTP WILL DO THE FOLLOWING: 1. It will read the instruction (script statement) and understands, what action to be performed on which object. 2. It realizes that it needs some information to identify the object. 3. It will go for object repository and search for required information. 4. If at all the information is available, using that information, it will try to identify the object. 5. If at all the object is identified then it will perform action on it. RECORD AND RUN SETTINGS: It is a feature provided by QTP, which is used for making the QTP understand what exactly it need to do, and how exactly it should behave during recording and running. NAVIGATION: a. Activate the menu item Automation. b. Select the option RECORD and RUN settings. c. Select the desired Environment tab. d. Select the required Option. e. Click on Apply and OK. RECORDING MODES: There are 3 types of Recording Modes: 1. NORMAL/CONTEXT SENSITIVE RECODING MODE. 2. ANALOG RECORDING MODE. 3. LOW LEVEL RECORDING MODE. 1. NORMAL RECORDING MODE: It is used for recording the operations performed on the standard GUI objects in different contexts. 2. ANALOG RECORDING MODE: This recording mode is used for recording continuous operations. NAVIGATION: a) Keep the tool under normal recording mode. b) Activate the menu item automation. c) Select the option analog recording. d) Select one of the following options: o Record relative to the screen. o Record relative to the following window. If at all second option is selected, specify the window title with the help of hand icon, click on start analog record button.PC SURENDRA REDD Y Page 10
  11. 11. TEST AUTOMATION_FUNCTIONAL TESTING PCSR Ex: Following Script will be produced for Paint Brush depending upon the above Option selected: Record relative to the screen: Desktop.Runanalog’Track1’ Record relative to the following window: Window(‘PAINT’).Runanalog’Track1’ Where as Track1 is the internal file used for recording the actions performed by the user. 3. LOW LEVEL RECORDING MODE: It is a special recording mode provided by the QTP, which is used for recording at least some operations on the non supported environments also. Usually people avoid this mode, due to the following reasons: a. All the operations can’t be recorded. b. The script is not easily understandable and enhance able. OBJECT REPOSITORY: It is a storage place, where one can store the object information and it is also acts as an interface between the Test Script and AUT (Application Under Test), In order to identify the objects during execution. TYPES OF OBJECT REPOSITORY: There are 2 types of Object Repositories: 1. LOCAL 2. SHARED LOCAL REPOSITORY: For each and every action in a Test (SCRIPT FILE). One separate local repository will be created and managed by QTP automatically. The information present in the local repository can be used by that action. SHARED REPOSITORY: Whenever we feel that same common objects information need to shared by so many actions present in the different Tests (SCRIPT FILE), then it is suggested to create a shared repository with that common information and associate it to all required actions. By doing like this the advantage is, if any modifications are required in future than it is very easy. Note: We can associate one (or) more shared repositories to an action apart from its local repository. NAVIGATION FOR CREATING SHARED REPOSITORY: Activate the Menu item Resources. Select the option Object Repository Manager. Add the required objects information. Click on SAVE. Browse the desired location and SAVE with .TSR extension. NAVIGATION FOR CREATING SHARED REPOSITORY WHENEVER THE INFORMATION ALREADY AVAILABLE IN THE LOCAL REPOSITORY: Open the Object Repository. Activate the Menu item File in Object Repository. Select the option Export Local Objects. Browse the desired location and SAVE with .TSR extension. NAVIGATION FOR ASSOCIATING THE SHARED REPOSITORY TO AN ACTION: Activate the Menu item Resources.PC SURENDRA REDD Y Page 11
  12. 12. TEST AUTOMATION_FUNCTIONAL TESTING PCSR Select the option Associate Repositories. Add the required Repositories to the list. Select the desired Repository in the list. Select the desired Action. Click on the Associate Button. Click on OK. NAVIGATION FOR MODIFYING THE INFORMATION IN THE SHARED REPOSITORY: Activate the Menu item Resources. Select the option Object Repository Manager. Open the required Object Repository. Do the required Modifications. Click on SAVE. Can you convert Local to Shared Repository? A: It’s not converting from Local to Shared Repository, Its Copying of the objects from Local to Shared Repository through Export Object Data from Object Repository File menu. OPERATIONS ON OBJECT REPOSITORY: 1. NAVIGATION FOR ADDING THE OBJECTS: Activate the Menu item Resources. Select the option Object repository. Click on Add Objects to Local. Click on the title bar of the window. Click on OK. Select one of the following Options: o Select objects only o Default objects only o All object types o Selected object types If at all the 4th option is selected, then select the desired types of objects, using select button. Click on OK button. 2. NAVIGATION FOR DELETING THE OBJECTS: Right click on the desired object in the Object Repository. Select the option Delete by right clicking on it. Confirm the deletion by clicking on YES. 3. NAVIGATION FOR RENAMING THE OBJECTS: Right click on the desired object in the Object Repository. Select the option Rename. Specify the desired Name.PC SURENDRA REDD Y Page 12
  13. 13. TEST AUTOMATION_FUNCTIONAL TESTING PCSR 4. NAVIGATION FOR UPDATING THE PROPERTIES LIST: Select the desired object in the Object Repository. Click on Add button. Select the desired properties in the list. Click on OK. Select the desired properties in the list, which are to be removed. Click on the Remove button. 5. NAVIGATION FOR UPDATING PROPERTIES VALUE: Select the desired object in the Object Repository. Select the desired property in the properties list. Click on the ‘Configure the Value’ button. Specify the desired Value. Click on OK. HIGHLIGHTING THE APPLICATION: This option is used for highlighting the corresponding object in the application, upon selecting the object name in the Object Repository. LOCATING THE REPOSITORY: This option is used for locating the object name in the Object Repository, upon specifying the corresponding object in the application. OBJECT IDENTIFICATION: The object identification concept is based on 4 types of properties and an Ordinal Identifier. One can specify a list of properties under Mandatory section, list of properties under Assistive section, list of properties under the Base Filter section, list of properties under the Optional Filter section and an Ordinal Identifier. QTP WILL LEARN THE INFORMATION IN THE FOLLOWING WAY, INCASE OF ONLY NORMAL IDENTIFICATION: First of all QTP will learn all the Mandatory properties, it will think whether those properties are sufficient or not, if it feels not sufficient, then it will learn 1st Assistive property, and then once again think whether all those properties are sufficient for identifying the object uniquely, if it feels not sufficient it will nd learn the 2 Assistive property and once again think whether they are sufficient or not, if not sufficient then it will repeat the same process by learning the next Assistive properties one by one till it feels satisfy, if not all the Assistive properties are learned, still QTP not satisfy then finally it will learn the Ordinal Identifier, whatever learned during the above process will be stored in the object repository. QTP WILL LEARN THE INFORMATION IN THE FOLLOWING WAY, INCASE OF SMART IDENTIFICATION ALSO: QTP will learn all the Mandatory properties, all the Base Filter properties, all the Optional Filter properties at a time, stores the Base Filter properties and Optional Filter properties in a secrete place and will not think about them. It will think whether the Mandatory properties are sufficient for identifying the object uniquely, if it feels not sufficient, it will learn the first Assistive property and continues the process same as above.PC SURENDRA REDD Y Page 13
  14. 14. TEST AUTOMATION_FUNCTIONAL TESTING PCSR Ex: OR: OBJECT REPOSITORY. QTP WILL LEARN THE INFORMATION IN THE FOLLOWING WAY DURING THE IDENTIFICATION: First of all it will use all the properties present in the object repository and will try to identify the object, if it fails then it will use Smart Identification mechanism and will try to identify the object finally as follows: First it will use all the Base Filter properties and will try to identify the object, if at all more then one objects are found, it will consider those objects and filters all the remaining objects. It will take the first Optional Filter property and will try to identify the object in the considered objects, if at all more than one matches are found then it will consider only those objects and filters the remaining objects, then it will take the second Optional Filter property and repeats the same process till it finds exactly one match or one object. In case all the Optional Filter properties are used but still QTP is unable to find exactly one match, then it will go to Object Repository and check whether the Ordinal Identifier is available or not, if it is available using that it will roughly identify the object otherwise hands up. Ex: While learning the properties it will stops still it satisfies that it is enough for identifying the objects and stores the information in the Normal Identification, then what the use of Smart Identification? DISABLE E While learning for example in the Login screen first LOGIN and CLEAR buttons are DISABLED.PC SURENDRA REDD Y Page 14
  15. 15. TEST AUTOMATION_FUNCTIONAL TESTING PCSR ENABLE While identifying the objects, suppose user enters UN and PW, then the LOGIN and CLEAR buttons are ENABLED. So the properties of LOGIN and CLEAR buttons are varying, so it is difficult to identify the objects with the learned properties in the Normal Identification, so it will go for Smart Identification for identifying the objects. Ex: Why can’t we specify object name as the property for identifying the objects very easily? Suppose the application has dynamic button, then it will change its behavior depending upon the user action. BEFORE AFTER DYNAMIC BUTTON So it is difficult for identifying the object with the object name property.PC SURENDRA REDD Y Page 15
  16. 16. TEST AUTOMATION_FUNCTIONAL TESTING PCSR Ex: Configuration of the objects that are identified should not change, it will affect the remaining objects, in case if any object is not identified, then try to change the properties of those objects in the object repository. ORDINAL IDENTIFIER: There are 3 types of Ordinal Identifier’s: 1.LOCATION 2.INDEX 3.CREATION TIME 1. LOCATION: Whenever the Location is selected as an Ordinal Identifier. QTP will generate some numbers like 0, 1, 2, 3………. based on the sequence of the objects located in the application. 2. INDEX: Whenever the Index is selected as an Ordinal Identifier. QTP will generate some numbers like 0, 1, 2, 3………. based on the index of the pages related to those objects. 3. CREATION TIME (FOR BROWSER OBJECT IN WEB ENVIRONMENT ONLY): Whenever the Creation Time is selected as an Ordinal Identifier. QTP will generate some numbers like 0, 1, 2, 3………. based on the loading time of the objects in the browser. NAVIGATION FOR OBJECT IDENTIFICATION CONFIGURATION: Activate the menu item Tool. Select the option Object Identification. Select the desired Environment. Select the desired class of the Object. Specify the required properties in the mandatory list and Assistive list. Select an Ordinal Identifier. If at all the Smart Identification is also required then, select the checkbox enabled Smart Identification. Click on configure button. Specify the required Base Filter and Optional Filter properties. Click on OK. OBJECT SPY: It is a handy feature provided by the QTP, which shows complete object information like list of object properties and values, list of methods, syntax of methods, description of methods of both the Test objects and Run Time objects then and there on the spot immediately. NAVIGATION: Activate the menu item Tools. Select the option Object Spy. Specify the desired object in the application with the help of handy icon. TYPES OF OBJECTS: There are 2 types of objects: 1. RUN TIME OBJECTS 2.TEST OBJECTS.PC SURENDRA REDD Y Page 16
  17. 17. TEST AUTOMATION_FUNCTIONAL TESTING PCSR 1. RUN TIME OBJECTS: All the original objects present in the application are known as Run Time objects. 2. TEST OBJECTS: The reference objects for the original objects present in the object repository are known as Test objects. QTP LIFE CYCLE: QTP LIFE CYCLE CONTAINS 6 PHASES: 1.TEST PLANNING 2.GENERATING THE BASIC TEST 3.ENHANCING THE TEST 4.DEBUGING THE TEST 5.EXECUTING THE TEST 6.ANALYZING THE RESULTS 1. TEST PLANNING: In this phase the Automation Test Lead will do the following: He will understand the Requirements. He will identify the area to be Automated. He will analyze the dynamism of the application and based on that he will do all the pre configurational settings to that tool, in such a way that it will be compatible to that application. He will do the Resource planning (Who has to do what?). He will do the Scheduling. He will prepare the Automation Test Plan document with all the above analyzed information. 2. GENERATING THE BASIC TEST: Script related to basic operation done in the application called Basic Script. In this phase one will generate the basic script for both the positive and negative flow of the application. 3. ENHANCING THE TEST: Adding something to the Basic Script called enhancing the test. One can enhance the test in the following ways: Inserting the check point statement. Synchronizing the test by inserting the synchronization point statements. Parameterizing the test (Data Driven Testing-DDT). Inserting the output value statements. Measuring the transactions by inserting transactional point statement. Inserting the programmatic statements. Inserting the comments. Inserting the script statements manually. CHECK POINT: Check point is a feature provided by the QTP, which is used for checking something during the execution, at any point of time. OPERATIONAL OVERVIEW OF CHECK POINT: CHECK POINT works in 2 phases: 1. PRE EXECUTION PHASE 2. WHILE EXECUTION PHASEPC SURENDRA REDD Y Page 17
  18. 18. TEST AUTOMATION_FUNCTIONAL TESTING PCSR 1. PRE EXECUTION PHASE: In this phase it will do the following:  It will capture the expected value.  It will generate the corresponding script statement. 2. WHILE EXECUTION PHASE: In this phase it will do the following:  It will capture the required Actual value.  It will compare the Actual value with the Expected value.  Finally it will show the result as PASS (or) FAIL. TYPES OF CHECKPOINTS: 1.STANDARD CHECKPOINT 2.BITMAP CHECKPOINT 3.TEXT CHECKPOINT 4.TEXT AREA CHECKPOINT 5.DATABASE CHECKPOINT 6. XML CHECKPOINT (FROM RESOURCE) 7.PAGE CHECKPOINT 8.TABLE CHECKPOINT 9.IMAGE CHECKPOINT 10. ACCESSIBILITY CHECKPOINT Note: PAGE, TABLE and IMAGE are hidden WEB Checkpoints. Note: XML, DATABASE CheckPoints are enabled in the menu INSERT because they are not related to application. 1. STANDARD CHECKPOINT: It is used for checking the standard GUI objects properties values. It can be inserted in 2 ways: 1. Through Application 2. Through Active Screen NAVIGATION THROUGH APPLICATION: Keep the cursor in the desired location. Keep the tool under Recording Mode. Activate the menu item Insert. Go to Checkpoint. Select the option standard Check Point. Specify the desired object in the application. Click on OK. Select the desired properties to be checked and specify the desired expected value. Click on OK. Stop Recording.PC SURENDRA REDD Y Page 18
  19. 19. TEST AUTOMATION_FUNCTIONAL TESTING PCSR NAVIGATION THROUGH ACTIVE SCREEN: Keep the cursor on the desired statement. So that the corresponding Snapshot will be available in the Active Screen. Go to Active Screen. Right click on the desired object. Select the option insert Standard CheckPoint. Click on OK. Select the desired properties to be checked. Select the desired Expected values. Select one of the following options: o Before current step o After current step. Click on OK. BITMAP CHECKPOINT: It is used for checking the expected pixels are present in the selected area of the application (or) not. It is also used for checking the complete Bitmap (or) a part of the Bitmap. One can insert the Bitmap check point through Application (or) Active screen NAVIGATION THROUGH APPLICATION: Keep the cursor in the desired location. Keep the tool under Recording Mode. Activate the menu item Insert. Go to Check Point. Select the option Bitmap CheckPoint. Specify the desired Bitmap in the Application. Click on OK. If required select the desired part of the Bitmap using select area button. Select the Checkbox, save only selected area. Click on OK. Stop Recording. NAVIGATION THROUGH ACTIVE SCREEN:  Keep the cursor on the desired statement, so the corresponding Snapshot is available in the Active Screen.  Go to the Active Screen, right click on the Bitmap.  Select the option, insert Bitmap CheckPoint.  Click on Ok.  If required select the desired part of the Bitmap using select area button.  Select the Checkbox, save only selected area.  Select any one of the following option: o Before current step o After current step  Click on OK. BITMAP: It is a particular area, where it stores some pixels, we can’t do any actions on it. IMAGE: We can do some actions on it, we can use it as a Hyperlink/Object.PC SURENDRA REDD Y Page 19
  20. 20. TEST AUTOMATION_FUNCTIONAL TESTING PCSR TEXT CHECKPOINT: It is used for checking the text present on the specified objects, it can be inserted through Application as well as through Active Screen. NAVIGATION THROUGH APPLICATION:  Keep the cursor in the desired location.  Keep the tool under Recording.  Activate the menu item Insert.  Go to the CheckPoint.  Select the option Text CheckPoint.  Specify the desired object by using hand icon.  Click on OK.  Specify the desired expected text in the Application.  Select the Required option: Match case Ignore spaces Exact match Text not displayed  Click on OK.  Stop Recording. NAVIGATION THROUGH ACTIVE SCREEN:  Keep the cursor in the desired statement, so the corresponding Snapshot is available in the Active screen.  Go to the Active screen.  Right click on the desired object.  Select the option insert CheckPoint.  Click on OK.  Specify the desired expected Text.  Select the Required option: Match case Ignore spaces Exact match Text not displayed  Select on of the following option: o Before current step o After current step.  Click on OK. TEXT AREA CHECKPOINT: It is used for checking the text present in a specified area of the application, it can be inserted only through application. NAVIGATION THROUGH APPLICATION:  Keep the cursor in the desired location.  Keep the tool under Recording.  Activate the menu item Insert.  Go to the CheckPoint.  Select the option Text area CheckPoint.  Specify the desired area in the Application  Specify the desired expected object Text.  Select the Required option:PC SURENDRA REDD Y Page 20
  21. 21. TEST AUTOMATION_FUNCTIONAL TESTING PCSR Match case Ignore spaces Exact match Text not displayed  Click on OK.  Stop Recording. WIZARD: It is a group of windows, which accepts some information from the user and accomplishes the task in a complex way. DATABASE CHECKPOINT: It is used for checking the contents of a database. DATABASE: it is a Base (or) a Place, where one can store and retrieve Data. There are 3 types of Database Testing: 1. Store and Retrieval Database Testing 2. Database Design Testing 3. Database Content Testing Create a Database and a Table in Access. NAVIGATION FOR CREATING DATABASE CHECK POINT:  Activate the menu item Insert.  Go to Checkpoint.  Select the option Database CheckPoint.  Select the option-specify SQL statement manually.  Click on Next.  Click on Create.  Click on New.  Specify the desired Driver/Provider from the list.  Click on Next  Specify the Data Source Name (DSN).  Click on Next.  Click on Finish.  Click on Select.  Browse the desired Database.  Click on OK.  Click on OK.  Click on OK.  Specify the required SQL statements  Click on Finish.  Select one of the following options: o Before current step o After current step  Click on OK. XML CHECKPOINT: It is used for checking the contents of a XML file. XML: It is a universal understandable language used for Data Transformation.PC SURENDRA REDD Y Page 21
  22. 22. TEST AUTOMATION_FUNCTIONAL TESTING PCSR Ex: Create a file with .XML with the help of notepad as follows: <ENVIRONMENT> <VARIABLE> <VAR> <NAME> SURI </NAME> </VAR> </VARIABLE> <VARIABLE> <VAR> <NAME> RAVI </NAME> </VAR> </VARIABLE> </ENVIRONMENT> DATABASE--------> INFO File: NAME SALARY SURI 45000 RAVI 52000 MANJU 22000 GOPI 33000 NAVIGATION FOR CREATING XML CHECKPOINT:  Activate the menu item Insert.  Go to CheckPoint.  Select the option XML CheckPoint.  Browse the desired XML file.  Click on OK.  Select the desired contents to be checked and Specify the requested expected values.  Select one of the following options: o Before current step o After current step  Click on OK. PAGE CHECKPOINT: It is used for checking the properties of a Page. NAVIGATION: Keep the cursor on the desired statement. Go to Active Screen. Right click on the screen. Select the option insert Standard CheckPoint. Select the page in the Hierarchy. Click on OK. Select the desired properties to be checked. Select one of the following options: o Before current step o After current step Click on OK.PC SURENDRA REDD Y Page 22
  23. 23. TEST AUTOMATION_FUNCTIONAL TESTING PCSR TABLE CHECKPOINT: It is used for checking the contents of a Table. NAVIGATION:  Keep the cursor on the desired statement.  Go to Active Screen.  Right click on the screen.  Select the option insert Standard CheckPoint.  Select the page in the Hierarchy.  Click on OK.  Select the desired properties to be checked.  Select one of the following options: oBefore current step oAfter current step  Click on OK. IMAGE CHECKPOINT: It is used for checking the properties of an Image. NAVIGATION:  Keep the cursor on the desired statement.  Go to Active Screen.  Right click on the screen.  Select the option insert Standard CheckPoint.  Select the page in the Hierarchy.  Click on OK.  Select the desired properties to be checked.  Select one of the following options: oBefore current step oAfter current step  Click on OK. WEB CHECK POINTS: PAGE, TABLE AND IMAGE CHECK POINTS ARE HIDDEN CHECK POINTS, WE CAN USE ONLY THROUGH STANDARD CHECK POINT. ACCESSABILITY CHECKPOINT: It is used for checking whether the page is developed according to the WORLD WIDE WEB CONSORTIUM (W3C) standards or not. With the help of these checkpoints one can confirm whether that page can be accessible all over the world comfortably or not. NAVIGATION:  Keep the cursor on the desired statement.  Go to Active Screen.  Right click on the page.  Select the option insert Accessibility CheckPoint.  Select one of the following options: oBefore current step oAfter current step  Click on OK.PC SURENDRA REDD Y Page 23
  24. 24. TEST AUTOMATION_FUNCTIONAL TESTING PCSR SYNCHRONIZATION: It is a process of matching the speeds of both the tool and the application in order to keep them in sync with each other, in order to obtain proper Testing results. Here the main concept is making the tool to wait, till the application finishes its work, to do the same we can follow any one of the following way: 1. Inserting the synchronization point statement. 2. Increasing the default time. 3. Inserting the wait statement. Note: Synchronization point statement affects only one statement, it adds the time specified with the default time. NAVIGATION FOR INSERTING THE SYNCHRONIZATION POINT:  Keep the cursor in the desired location.  Keep the tool under Recording mode.  Activate the menu item Insert.  Select the option Synchronization point.  Specify the desired object in the application.  Click on OK.  Select the desired property name.  Specify the desired property value.  Specify the extra time in milliseconds.  Click on OK.  Stop Recording. To avoid the above navigation, one can directly insert the following statement: SYNTAX: HIERARCHY.WAITPROPERTY”PROPETY NAME”, PROPERTY VALUE, EXTRA TIME IN MILLISECONDS Ex: WINDOW(“FLIGHT RESERVATION”).WINBUTTON(“DELETE ORDER”).WAITPROPERTY”ENABLED”, TRUE, 14000 NAVIGATION FOR MODIFYING DEFAULT TIME: Activate the menu item File. Select the option settings. Specify the desired Time in object Synchronization Time Out field. Click on OK. Note: It effects all the script statements in the script area. SYNTAX FOR WAIT STATEMENT: WAIT(TIME IN SECONDS) Note: It effects only one statement, but it will wait till the time is finished, even though the action is completed. VARIABLE: It is a name given to the memory location, which can hold some value, it can change values in any number of times if required. FLAT FILE: The file without any specific format.PC SURENDRA REDD Y Page 24
  25. 25. TEST AUTOMATION_FUNCTIONAL TESTING PCSR PARAMETRIZATION: It is a process of replacing the constant values with variables in order to increase the scope of test. MAINLY WE FOLLOW 5 STEPS IN RETESTING (MANUAL TESTING): 1. REQUIREMENTS 2. TEST CASES 3. OPTIMIZATION 4. EXECUTION 5. RESULT ANALYSIS MAINLY WE FOLLOW 5 STEPS IN DATA DRIVEN TESTING (QTP): 1. DATA TABLE 2. SCRIPT STATEMENTS 3. OPTIMIZATION 4. EXECUTION 5. RESULT ANALYSIS DATA DRIVEN TESTING: It is a concept introduced in automation in order to implement Retesting. Steps to follow to perform DDT: 1. Collect data into Data Table. 2. Generate the basic Test. 3. Do the required Enhancements and parameterize the test. 4. Execute the list. 5. Analyze the Result PARAMETRIZATION: It is a process of replacing the constant values with variables or parameters, in order to increase the scope of test. Parameterization can be done in 3 ways: 1.DATA DRIVEN WIZARD 2.KEYWORD VIEW 3.MANUALLY NAVIGATION THROUGH DATA DRIVEN WIZARD: Activate the menu item tools. Select the option Data Driver. Select the desired constant value in the list. Click on Parameterized button. Next. Click on Parameterized options button. Select the desired column name. Click on OK. Click on Finish and then OK. NAVIGATION THROUGH KEYWORD VIEW: Go to Keyword view. Select the desired constant value to be parameterized. Click on configure the button. Select the option parameter. Select the desired column name. Click on OK.PC SURENDRA REDD Y Page 25
  26. 26. TEST AUTOMATION_FUNCTIONAL TESTING PCSR TO AVOID THE ABOVE NAVIGATION, PARAMETERIZATION CAN BE DONE MANUALLY IN THE FOLLOWING WAY: Ex: X=DATA TABLE(“V1”,I) VBWINDOW(“CALCULATOR”).VBEDIT(“VALUE1”).SET X VBWINDOW(“CALCULATOR”).VBEDIT(“VALUE2”).SET DATATABLE(“V2”,I) VBWINDOW(“CALCULATOR”).VBEDIT(“ADD”).CLICK NAVIGATION FOR PARAMETERIZING THE CHECKPOINT:  Right click on the CheckPoint statement.  Select the option CheckPoint properties.  Select the option Parameter.  Click on Parameter options button.  Select the desired column name.  Click on OK.  Click on OK. OUTPUT VALUES: It is a feature provided by the QTP, which is used for capturing a value from an application (or) from a Data Base (or) from a XML files and stores it under a desired column in the Runtime Data table. TYPES OF OUTPUT VALUES: 1. STANDARD OUTPUT VALUE: It is used for capturing the standard GUI objects properties values, it can be perform through an Application or Active screen. 2. TEXT OUTPUT VALUE: It is used for capturing the text present on the objects. 3. TEXT AREA OUTPUT VALUE: It is used for capturing the text present in the specified area. 4. DATABASE OUTPUT VALUE: It is used for capturing a value from Database. 5. XML OUTPUT VALUE: It is used for capturing a value from XML file. NAVIGATION FOR STANDARD OUTPUT VALUE THROUGH APPLICATION: Keep the cursor in desired location. Keep the tool under Recording mode. Activate the menu item insert. Go to OutPut value. Select the desired object in the Application. Click on OK. Select the desired properties to be captured. Modify the name if required. Click on OK. Stop Recording. NAVIGATION THROUGH ACTIVE SCREEN: Keep the cursor on desired statement, so that the corresponding Snapshot is available in Active Screen. Go to Active Screen. Right click on desired object. Select the object, Insert OutPut value. Click on OK. Select the desired property to be captured. Modify the name if required. Select one of the following option:PC SURENDRA REDD Y Page 26
  27. 27. TEST AUTOMATION_FUNCTIONAL TESTING PCSR o Before current step o After current step Click on OK. MEASURING TRANSACTIONS: It is a concept provided in QTP used for calculating the Time taken by an Application approximately to perform a Task. (Or) Execution Time of block of script statements, to do the same QTP has introduced START TRANSACTION & END TRANSACTION POINTS. NAVIGATION FOR START TRANSACTION:  Keep the cursor in desired location.  Activate the menu item insert.  Select the option START TRANSACTION.  Specify the desired Transaction name.  Select one of the following options: o Before current step o After current step  Click on OK. NAVIGATION FOR END TRANSACTION:  Keep the cursor in desired location.  Activate the menu item insert.  Select the option END TRANSACTION.  Specify the desired Transaction name.  Select one of the following options: o Before current step o After current step  Click on OK. Ex: SERVICES. START TRANSACTION <TRANSACTION NAME> ----------------------------- ------------------------------- ------------------------- SCRIPT STATEMENTS --------------------------- --------------------------------- -------------------------------- SERVICES. END TRANSACTION <TRANSACTION NAME> INSERTING THE PROGRAMMATIC STATEMENTS: Any VB Script contains the following types of Programmatic Statements: 1.NORMAL STATEMENTS (or) OBJECT CALLS 2.CONDITIONAL STATEMENTS 3.LOOPING STATEMENTS 4.UTILITY STATEMENTS Apart from the above Programmatic statements Comments also will be available in a program.PC SURENDRA REDD Y Page 27
  28. 28. TEST AUTOMATION_FUNCTIONAL TESTING PCSR COMMENTS: Comments are used for increasing the readability of the script. It starts with single quote (‘). Ex: ‘This Program is for Normal Recording. SYSTEM UTIL UTILITY OBJECT: This utility object is mainly used for invoking the Application with the help of Run method. Syntax: SYSTEMUTIL.RUN “PATH” Note: One can even invoke the application with the help of invoke application statement. Syntax: INVOKEAPPLICATION “PATH” REPORTER UTILITY OBJECT: It is used fro sending an extra result step to the result window. Syntax: REPORTER.REPORTEVENT STATUS, “STEPNAME”, “DETAILS/MSG” Ex: REPORTER.REPORTEVENT MICDONE, “MYREP”, “ADD IS SUCCESSFUL” (Or) REPORTER.REPORTEVENT 0, “MYREP”, “ADD IS SUCCESSFUL” Note: MIC-MICROSOFT INTEGER CONVERSION. STATUS: 0-PASS 1-FAILED 2-DONE 3-WARNING 4. DEBUGGING THE TEST: It is a process of executing the script in a user desired passion with some temporary breaks, in order to identify the Errors. To do the same QTP has provided Breakpoint feature and Step commands. BREAKPOINT: It is a feature provided by QTP which is used for breaking the execution temporarily. STEP COMMANDS: 1. STEP INTO: It is used for executing a single step, if that step is a functional call step then it will make the pointer step into the function and breaks the execution at the first statement. 2. STEP OUT: It is used only after entering into the function, it will execute all the remaining statements inside the function from the position of the pointer and breaks the execution after stepping out of the function. 3. STEP OVER: This statement is used for executing any step until it is finished, for example if it is a functional call statement it will execute all the statements inside the function and then breaks the execution. 4. RUN TO STEP: This is used for executing all the statements up to the before statement, where the cursor is available. 5. DEBUG FROM STEP: This is used for bringing the pointer to a desired statement without executing any of the previous statements.PC SURENDRA REDD Y Page 28
  29. 29. TEST AUTOMATION_FUNCTIONAL TESTING PCSR Ex: FUNCTION MYFUNC() MSGBOX “HAI” MSGBOX “HELLO” MSGBOX “BYE” END FUNCTION ‘ MAIN PROGRAM MSGBOX “WELCOME” CALL MYFUNC() MSGBOX “SEE U” MYFUNC() MSGBOX “TA TA” MYFUNC() MSGBOX “TAKE CARE” MSGBOX “HAPPY WEEKEND” 4. DEBUG VIEWER PANE: It is an area provided by the QTP, which is used for Viewing, Modifying (or) Setting the current values of variables (or) expressions during the execution break with the help of 3 tabs by name WATCH, VARIABLES & COMMAND. WATCH: Quick result search. VARIABLES: List of variables COMMAND: To modify the values. Ex: DIM A, B A=10 B=20 MSGBOX A ---------------10_______COMMAND A=40 MSGBOX A ----------------40_______WATCH A*B MSGBOX A ----------------800 5. EXECUTING THE TEST: In this phase one will execute the Test. 6. ANALYZING THE RESULT: In this phase one will analyze the Result. RECOVERY SCENARIOS: During the execution sometimes QTP may face some problematic statements, where in it need to recover by itself and should continue the execution, to do the same the test engineer need to define a solution well in advance and attach it to the corresponding test before starting the execution. Usually QTP may face the following types of problems: 1. Problems related to POP UP WINDOWS. 2. Problems related to OBJECT STATE. 3. Problems related to TEST SCRIPT EXECUTION. 4. Problems related to APPLICATION CRASH.PC SURENDRA REDD Y Page 29
  30. 30. TEST AUTOMATION_FUNCTIONAL TESTING PCSR To define the solutions for above problems QTP has provided 4 Trigger Events: 1. POP UP WINDOW 2. OBJECT STATE 3. TEST RUN ERROR 4. APPLICATION CRASH NAVIGATION FOR OBJECT STATE PROBLEM:  Activate the menu item resources.  Select the option Recovery Scenario Manager.  Click on new scenario button.  Click on next.  Select the Trigger event as Object State.  Click on next.  Specify the desired object in the application.  Click on Ok.  Click on next.  Specify the required properties.  Click on next.  Click on next.  Specify the recovery operation as function call.  Click on next.  Browse the desired library file.  Specify the desired function name.  Write the required script inside the function.  Click on next.  Remove the check box (Add another recovery operations)  Click on next.  Specify the scenario name.  Click on next.  Select the required check boxes: o Add scenario to current test o Add scenario to default test settings  Click on finish  Save the file with .qrs extension  Click on close. Note: .QRS-QUICK RECOVERY SCENARIO. NAVIGATION FOR ASSOCIATING THE EXISTING RECOVERY SCENARIO TO THE CURRENT TEST: Activate the menu item file. Select the option settings. Select the recovery tab. Click on add button. Browse the desired recovery scenario. Click on add scenario Click on apply. OK.PC SURENDRA REDD Y Page 30
  31. 31. TEST AUTOMATION_FUNCTIONAL TESTING PCSR ENVIRONMENT VARIABLES: Whenever some common values need to be used in multiple scripts then it is suggested not to declare the local variables in all tests individually, it is better to declare all the common variables in a separate environment file, attach it to all the required tests and use those variables inside those test. By doing this the advantage is in future if the environment is changed and some of the values of those variables need to be updated in order to make the scripts compatible with that environment, then with minimum efforts, we can update the values in the environment file instead of updating all the script files. There are 2 types of Environment Variables: 1. BUILT IN VARIABLES 2. USER DEFINED VARIABLES 1. BUILT IN VARIABLES: These variables by default will be available with every new test, so any one can use them directly in any test using the following syntax: Syntax: ENVIRONMENT.VALUE(“BUILT IN VARIABLE NAME”) Ex: MSGBOX ENVIRONMENT.VALUE(“ProductName”)&(ENVIRONMENT(“ProductVer”) 2. USER DEFINED VARIABLES: Whenever we feel that we no need some common variables, to develop number of scripts depending upon our application, then we must declare the user defined variables in a separate environment file, attach that file to the required test and use those variables inside those tests. NAVIGATION FOR CREATING AN ENVIRONMENT FILE WITH ENVIRONMENT VARIABLES: Activate the menu item File. Select the option settings. Select the Environment tab. Select the variable type as User Define. Add all the required variables and values. Click on Export. Browse the desired location and save with .XML extension. To avoid the above navigation one can directly develop the environment file as follows:  Open the Notepad  Develop the script as follows and Save the file with .XML extension. <ENVIRONMENT> <VARIABLE> <NAME>A</NAME> <VALUE>10</VALUE> </VARIABLE> <VARIABLE> <NAME>PATH</NAME> <VALUE>”C:CAL.EXE”</VALUE> </VARIABLE> </ENVIRONMENT>PC SURENDRA REDD Y Page 31
  32. 32. TEST AUTOMATION_FUNCTIONAL TESTING PCSR NAVIGATION FOR ASSOCIATIONG AN ENVIRONMENT FILE TO THE REQUIRED TEST:  Activate the menu item File.  Select the option settings.  Select the Environment tab.  Select the variable type as User Define.  Select the check box load variables and values from external file.  Browse the desired Environment file.  Click on apply and OK. To avoid the above navigation one can directly write the script statements with following syntax: ENVIRONMENT.LOADFROMFILE”PATH OF ENVIRONMENT FILE” Ex: ENVIRONMENT.LOADFROMFILE”E:envfile.xml” PATH=ENVIRONMENT.VALUE(“PATH”) X=ENVIRONMENT(“A”) Y=ENVIRONMENT(“B”) SYSTEMUTIL.RUN PATH VBWINDOW(“CALCULATOR”).VBEDIT(“VALUE1”).SET X VBWINDOW(“CALCULATOR”).VBEDIT(“VALUE2”).SET Y VBWINDOW(“CALCULATOR”).VBBUTTON(“SUB”).CLICK Ex: DEBUG FROM TEST : FUNCTION MYFUNC() MSGBOX “HELLO” MSGBOX “HAI” END FUNCTION MSGBOX “WELCOME” MYFUNC() MSGBOX “BYE” FRAMEWORK: It is defined as a generic work or a set of guidelines to perform a task in an effective, efficient and optimized way. Types of Frameworks: 1.LINEAR FRAMEWORK 2.MODULAR FRAMEWORK 3.KEYWORD DRIVEN FRAMEWORK 4.HYBRID FRAMEWORK 5.DATA DRIVEN FRAMEWORK 1. LINEAR FRAMEWORK: Generate the basic script for the required end to end scenario. Enhance the script. Debug the script. Execute the script. Analyze the script.PC SURENDRA REDD Y Page 32
  33. 33. TEST AUTOMATION_FUNCTIONAL TESTING PCSR 2. MODULAR FRAMEWORK: Develop the individual components for the tasks which need to be repeatedly perform. Make them as reusable components. Prepare the driver scripts for the end to end scenarios. Execute the driver scripts. Analyze the results. ACTION: it is a set of instructions to perform a specific task. Types of Actions: 1. NORMAL 2. REUSABLE Reusable Actions called in another test are known as External Actions. External Actions are non editable. NAVIGATION FOR INSERTING NEW ACTION: Activate the menu item Insert. Select the option Call to New Action. Specify the desired Action name. Select one of the following options: o At the end of the test o After the current step Click on OK. NAVIGATION FOR SPLITTING AN ACTION INTO 2 ACTIONS:  Save the Action.  Keep the cursor on the first line of the second part.  Activate the menu item Edit.  Go to Action.  Select the option Split Action.  Select one of the following options: o Independent of each other o Nested  Specify the desired names for the Actions.  Click on OK. NAVIGATION FOR RENAMING ACTION:  Activate the menu item Edit.  Go to Action.  Select the option rename Action.  Specify the desired name.  Click on OK.PC SURENDRA REDD Y Page 33
  34. 34. TEST AUTOMATION_FUNCTIONAL TESTING PCSR NAVIGATION FOR MAKING AN ACTION AS REUSABLE ACTION:  Activate the menu item Edit.  Go to Action.  Select the option Action properties.  Select the checkbox Reusable Action.  Click on OK. NAVIGATION FOR CALLING AN EXISTING ACTION:  Activate the menu item Insert.  Select the option Call to Existing Action.  Browse the desired test.  Select the desired Action.  Select one of the following options: oAt the end of the test oAfter the current step  Click on OK. Ex: Record the Flight reservation application. Split the script as Action1 (LOGIN), Action2 (INSERT ORDER), Action3 (OPEN ORDER), Action4 (LOGOUT). Save the script. Open a new file. Call the existing Actions. Enhance the script if necessary. Run the script. Difference between Functions and Actions: 1. We can use Actions with in QTP where as we can use functions anywhere (i.e. outside QTP also). 2. We can call Functions with in Actions but we cant call Actions with in Functions. 3. Generally Functions are saved with ".vbs" extension, where as Actions will save with ".mts". 3. AUTOMATION TESTING PROCESS WITH KEYWORD DRIVEN FRAMEWORK: Q: What is Automation Testing process? A: Create the Folder structure as follows:PC SURENDRA REDD Y Page 34
  35. 35. TEST AUTOMATION_FUNCTIONAL TESTING PCSR PROJECT NAME_AUTOMATION TD REP LIB REC ENV TEST LOG TD-TEST DATA REP-REPOSITORY LIB-LIBRARY REC-RECOVERY ENV-ENVIRONMENT TEST-SCRIPT FILES LOG-HIGH LEVEL RESULT FILES TEST LOG: It is a chronological record of all relevant details about the execution of a Test. NAVIGATION:  Develop the required Test Data Files, Repository Files, Library Files, Recovery Files and Environment Files and save them in corresponding folders.  Open the main Test and associate all the required resources.  Develop the script in such a way that it is executed based on the keywords specified in the Data Table.  Save the script in the corresponding folder.  Whenever required open the script.  Specify the desired keywords.  Execute the script and analyze the result.  Add objects information in the object repository through Add Objects to Local or through Shared Repository.  For invoking the application we use SYSTEMUTIL.RUN statement.  Create a library file with .VBS extension through notepad as follows: FUNCTION LOGIN() Dialog("Login").Activate Dialog("Login").WinEdit("Agent Name:").Set "suri" Dialog("Login").WinEdit("Password:").SetSecure "4b55acb065483d2d7c0ba692c91a3baabd597428" Dialog("Login").WinButton("OK").Click END FUNCTION FUNCTION INSORD() Window("Flight Reservation").WinButton("Button").Click Window("Flight Reservation").ActiveX("MaskEdBox").Type "111111" Window("Flight Reservation").WinComboBox("Fly From:").Select "Denver"PC SURENDRA REDD Y Page 35
  36. 36. TEST AUTOMATION_FUNCTIONAL TESTING PCSR Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles" Window("Flight Reservation").WinButton("FLIGHT").Click Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "6252 DEN 12:48 PM LAX 03:48 PM AA $100.80" Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click Window("Flight Reservation").WinEdit("Name:").Set "suri" Window("Flight Reservation").WinButton("Insert Order").Click END FUNCTION FUNCTION OPNORD() Window("Flight Reservation").WinButton("Button_2").Click Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "5" Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click END FUNCTION FUNCTION LOGOUT() Window("Flight Reservation").WinMenu("Menu").Select "File;Exit" END FUNCTION  Write the script in QTP Test Pane as follows: SYSTEMUTIL.RUN "C:PROGRAM FILESMERCURY INTERACTIVEQUICKTEST PROFESSIONALSAMPLESFLIGHTAPPFLIGHT4A.EXE" VAR=DATATABLE("KEYS",1) SELECT CASE VAR CASE "L1" CALL LOGIN() CASE "L2" CALL INSORD() CASE "L3" CALL OPNORD() CASE "L4" CALL LOGOUT() END SELECT 4. HYBRID FRAME WORK: It is a mixture of two or more frameworks is known as Hybrid Framework. 5. DATA DRIVEN FRAME WORK: DATA DRIVEN TESTING. LIBRARY FILES: It is an area provided by QTP, where one can develop and store the user define functions. NAVIGATION FOR CREATING THE LIBRARY FILES:  Open the Notepad  Develop all the required Functions in it.  Save it with .VBS (VISUAL BASIC SCRIPT) extension. Activate the menu item New. Select the option Function Library Develop all the required Functions Save it with .QFL (QUICK FUNCTION LIBRARIES) or .VBS extension.PC SURENDRA REDD Y Page 36
  37. 37. TEST AUTOMATION_FUNCTIONAL TESTING PCSR NAVIGATION FOR ASSOCIATING THE LIBRARY FILE TO THE REQUIRED TEST:  Activate the menu item File.  Select the option Settings  Select the Resource tab.  Click on add button.  Browse the desired Library file.  Click on Apply and OK DIFFERENCES: a) Win runner is a Functional testing tool b) Load runner is Performance tool c) Test director is Management tool d) Silk test is a Functional testing tool a) Win runner: 1. You can record the script automatically or manually you can write scripts. 2. This is mainly use for Regression testing. b) Load runner: 1. This tool is mainly used for Performance testing. 2. We can also use this tool for Load testing and Stress Testing c) Test director: 1. This is a Management tool. 2. Test director tool contains: a. Test Plan b. Test Cases c. Time estimation d. Schedule documents e. Bug Lists d) Silk test: 1. Silk Test is a tool specifically designed for doing Regression and Functionality testing. 2. It is developed by Segue Software Inc. 3. Silk Test is the industry’s leading functional testing product for e-business applications, whether Window based, Web, Java, or traditional client/server-based. 4. Silk Test also offers test planning, management, direct database access and validation, the flexible and robust for Test scripting language. 5. A built in recovery system for unattended testing, and the ability to test across multiple platforms, browsers and technologies.PC SURENDRA REDD Y Page 37
  38. 38. TEST AUTOMATION_FUNCTIONAL TESTING PCSR VB SCRIPT VARIABLE: It is a name given to a memory location, which can hold a value and that can be changed any number of times in future if required. Naming conventions of a Variable:  Variable name should be a meaningful name.  Variable name should always start with an Alphabet.  It should not exceed 255 characters long.  It should not include periods (.).  It should not be same as Keywords or Reserved words. Declaration of a Variable: One can declare the Variables in VB Script using the following Keywords: DIM PRIVATE PUBLIC DIM X : By default it is PRIVATE PRIVATE X : This Variable scope is limited to particular block PUBLIC X : we can use Variable in any block, this scope is Global. Option EXPLICIT: Option EXPLICIT statement restricts the usage of new variables in the program without declaration. Whenever a new variable is found during the execution immediately an error will be shown, if at all the option Explicit statement is not used any misspelled variable name also will be treated as new variable. Ex: Option Explicit Dim apppath Apppath=”d:........................” ------------ appapth ------------ ------------ appath It shows error ------------ ------------ apppath If we don’t use option Explicit, it will not show any Error. CONSTANT: It is a name given to a memory location , which can hold a value that can’t be changed in future. Ex: CONST pi=3.15 ARRAY: It is a special type of variable, which can hold many values. There are 2 types of Arrays: 1.Single dimension array 2.Multi dimension array Arrays can declared as fixed length arrays as well as dynamic arrays.PC SURENDRA REDD Y Page 38
  39. 39. TEST AUTOMATION_FUNCTIONAL TESTING PCSR Ex: Fixed length Arrays: DIM a(10) ----------------- ------------------ a(0)=’---------` a(1)=’---------‘ --------- ----------- a(9)=’-----------` a(10)=’------------` Ex: Dynamic Arrays: Dim a() -------------- ---------------- REDIM a(20) ----------------- -------------- REDIM PRSERVE a(30) -------------- Note: Dynamic arrays can be resized any no of times, while resizing if at all we want to preserve the previous locations, than we need to use PRESERVE keyword along with REDIM keyword. OPERATORS: 1. ARTHIMATIC OPERATORS: + Ex: a+b - Ex: a-b * Ex: a*b MOD Ex: 20 MOD 7=6 ^ Ex: 10 ^ 2=100 2. ASSIGNMENT OPERATOR: = Ex: a=10 3. CONCATINATION OPERATOR: & Ex: var=”Suri” Msgbox ‘My name is:”& var 4. COMPARISION OPERATORS: < > <= >= = <>PC SURENDRA REDD Y Page 39
  40. 40. TEST AUTOMATION_FUNCTIONAL TESTING PCSR 5. LOGICAL OPERATORS: AND OR XOR NOT TRUTH TABLES: AND EXP1 EXP2 RESULT T T T T F F F T F F F F OR EXP1 EXP2 RESULT T T T T F T F T T F F F XOR EXP1 EXP2 RESULT T T F T F T F T T F F F NOT EXP RESULT T F F T CONDITIONAL STATEMENTS: 1. IF---THEN---ELSE: It is used for executing either TRUE block or FALSE block of statements based on the condition. Syntax: IF <CONDITION> THEN --------------------- ------------------- ELSE ---------------- ------------------ ENDIFPC SURENDRA REDD Y Page 40
  41. 41. TEST AUTOMATION_FUNCTIONAL TESTING PCSR 2. SELECT-CASE STATEMENT: Whenever we want to execute a particular block of statements among many blocks then we will choose select case statement. Syntax: SELECT CASE var CASE1 ----------- --------- CASE2 --------- ---------- ELSE CASE ---------- ---------- END SELECT LOOPING STATEMENTS: Looping statements are used for executing a certain block of statements repeatedly and continuously for some number of times. 1. FOR---NEXT: It is used for executing a block of statements repeatedly for certain number of times. Syntax: FOR I=1 TO 10 STEP 1 ---------------- ------------- NEXT 2. WHILE-----WEND: It is used for executing a block of statements repeatedly as long as the condition is being satisfied. Syntax: WHILE <CONDITION> ------------ ------------ WEND 3. DO WHILE---LOOP: It is used for executing a block of statements repeatedly as long as the condition is being satisfied. Syntax: DO WHILE <CONDITION> ---------------- -------------- LOOP 4. DO-----LOOP WHILE: It is used for executing a block of statements repeatedly as long as the condition is being satisfied, but first time execution will be done without checking the condition. Syntax: DO ------------- -------------- LOOP WHILE <CONDITION>PC SURENDRA REDD Y Page 41
  42. 42. TEST AUTOMATION_FUNCTIONAL TESTING PCSR 5. DO UNTIL----LOOP: This loop is used for executing the block of statements repeatedly as long as the condition is not being satisfied. Syntax: DO UNTIL <CONDITION> ------------ ----------- LOOP 6. DO----LOOP UNTIL: This loop is used for executing the block of statements repeatedly as long as the condition is not being satisfied, but first time execution will be done without checking the condition. Syntax: DO ----------- ------------ LOOP UNTIL <CONDITION> PROCEDURES: Procedures are used for reusability, whenever we want a task need to be performed again and again many number of times in different situations and also may be in different programs then we will prepare one procedure for that task and call that procedure any number of times in any number of programs. There are 2 types of PROCEDURES: 1. FUNCTION PROCEDURES 2. SUB PROCEDURES 1. Function Procedures can return a value, but Sub Procedures can’t returns a value. 2. Sub Procedures will be executed more faster then Function Procedures, so whenever we no need to return any value, it is better to use Sub Procedure. Ex: Function Procedure: FUNCTION ADD(a,b) RESULT=A+B ADD=RESULT END FUNCTION MAIN PRG: VAR=ADD(10,20) -------------- --------------- VAR1=ADD(20,30) --------------- ------------------ Ex: Sub Procedure: SUB LOGIN(UN,PW) ------------- SET UN ------------- SET PW ------------- LOGIN, CLICK END SUBPC SURENDRA REDD Y Page 42
  43. 43. TEST AUTOMATION_FUNCTIONAL TESTING PCSR MAIN PRG: --------------------- ------------------ LOGIN(“SURI”,”TESTING”) ---------------- ---------------------- LOGIN(“RAVI”,”ENG”) -------------- ----------------- Difference between Functions and Procedures: 1. Function returns a value, but a procedure may return or may not return a value. 2. Function can take only input arguments, but procedure may take both input and out put parameters. REAL TIME SCENARIO WITH METHODS: 1. CAPTURE BITMAP: It is a method used for capturing the snapshot of any object and storing it in the desired location during the execution. Syntax: OBJECT HIERARCHY.CAPTURE BITMAP ”PATH OF THE LOCATION WITH FILE NAME.BMP EXTENSION” Ex: WINDOW(“FLIGHT RESERVATION”)DIALOG(“OPEN ORDER”)WINBUTTON(“OK”).CAPTUREBITMAP “D:SURIDEFECT.BMP” 2. EXIST: It is a method used for checking whether the object is existing or not, if at all the object is existing than it will return a value TRUE otherwise it will make the QTP wait till the object exists, soon after the object exists it will return a value TRUE and allows the QTP for further execution. In case the object doesn’t exist till the maximum time (Default time + Extra time) specified than finally it will return FALSE and allows the QTP for further execution. Syntax: VAR=OBJECT HIERARCHY.EXIST[(TIME IN SECONDS)] Ex: VAR=OBJECT HIERARCHY.EXIST(15) 3. WAIT PROPERTY: It is a method used for making the tool to wait based on the objects properties value or up to the maximum time. Syntax: OBJECT HIERARCHY.WAIT PEOPERTY ”PROPERTYNAME” Ex: WINDOW(“FLIGHT RESERVATION”).WINBUTTON(“DELETE ORDER”).WAIT PROPERTY “ENABLED”,TRUE,1400 4. WAIT: It is a method used for making the tool to wait till the specified time is elapsed. Syntax: WAIT(TIME IN SECONDS) 5. CLICK: It is a method used for clicking on a desired object. Syntax: OBJECT HIERARCHY.CLICK [X,Y,[BUTTON]] 0-LEFT 1-RIGHT 2-CENTRE 6. DBL CLICK: It is a method used for double clicking on a desired object. Syntax: OBJECT HIERARCHY.DBLCLICK[X,Y,[BUTTON] 0-LEFT 1-RIGHT 2-CENTREPC SURENDRA REDD Y Page 43
  44. 44. TEST AUTOMATION_FUNCTIONAL TESTING PCSR 7. SET: It is a method used for performing operations on the following objects: 1. EDIT BOX 2. CHECK BOX 3. RADIO BUTTON EDIT BOX: It is a method used for setting any value into the edit box. Syntax: OBJECT HIERARCHY.SET “VALUE” Ex: SURENDRA CHECK BOX: It is a method used for selecting or deselecting the check box. Syntax: OBJECT HIERARCHY.SET “ON/OFF” Ex: RADIOBUTTON: It is a method used for selecting a radio button in a group of radio buttons. Syntax: OBJECT HIERARCHY.SET Ex: CASE STUDY 1: Develop the script for entering CID, CNAME, CAGE, CPHNO and click on SUBMIT. VBWINDOW(“CUST”).VBEDIT(“CID”).SET “001” VBWINDOW(“CUST”).VBEDIT(“CNAME”).SET “SURI” VBWINDOW(“CUST”).VBEDIT(“CAGE”).SET “26” VBWINDOW(“CUST”).VBEDIT(“CPHNO”).SET “9985621122” VBWINDOW(“CUST”).VBBUTTON(“SUBMIT”).CLICK CASE STUDY 2: Develop the script for selecting the STE, ISTQB, and SQL SERVER check boxes and clicking on NEXT button.PC SURENDRA REDD Y Page 44
  45. 45. TEST AUTOMATION_FUNCTIONAL TESTING PCSR SRSS: STE QTP LR LIVE PROJECT ISTQB SQL SERVER NEXT VBWINDOW(“SRSS”).VBCHECKBOX(“STE”).SET “ON” VBWINDOW(“SRSS”).VBCHECKBOX(“ISTQB”).SET “ON” VBWINDOW(“SRSS”).VBCHECKBOX(“SQL SERVER”).SET “ON” VBWINDOW(“SRSS”).VBCHECKBOX(“NEXT”).SET “ON” CASE STUDY 3: Develop the script for deselecting the STE check box, selecting the QTP and LIVE PROJECT check boxes and clicking on NEXT button. SRSS: STE QTP LR LIVE PROJECT ISTQB SQL SERVER NEXT VBWINDOW(“SRSS”).VBCHECKBOX(“STE”).SET “OFF” VBWINDOW(“SRSS”).VBCHECKBOX(“ISTQB”).SET “ON” VBWINDOW(“SRSS”).VBCHECKBOX(“SQL SERVER”).SET “ON” VBWINDOW(“SRSS”).VBCHECKBOX(“NEXT”).SET “ON” CASE STUDY 4: Develop the script for entering the COUNTRY, AGE, GENDER, selecting the check box PHOTO PROFILES ONLY and clicking on SEARCH button.PC SURENDRA REDD Y Page 45
  46. 46. TEST AUTOMATION_FUNCTIONAL TESTING PCSR MATRIMONY: COUNTRY: AGE: MALE FEMALE PHOTO PROCESS ONLY SEARCH VBWINDOW(“MATRIMONY”).VBEDIT(“COUNTRY”).SET “INDIA” VBWINDOW(“MATRIMONY”).VBEDIT(“AGE”).SET “26” VBWINDOW(“MATRIMONY”).VBRADIOBUTTON(“FEMALE”).SET VBWINDOW(“MATRIMONY”).VBCHECKBOX(“PHOTO PROCESS ONLY).SET “ON” VBWINDOW(“MATRIMONY”).VBBUTTON(“SEARCH”).CLICK 8. SELECT: It is a method used for selecting an item from a combo box or list box. Syntax: OBJECT HIERARCHY.SELECT “ITEM” CASE STUDY 5: Develop the script for entering TRAIN NO, TRAIN NAME, and selecting the STARTING POINT and DESTINATION, entering the DOJ, selecting the CLASS, BIRTH, selecting the BREAKFAST, LUNCH, or DINNER checkboxes and clicking on NEXT. RESERVATION: TRAIN NO: TRAIN NAME: FROM: TO: DOJ: FIRST A/C UB SECOND A/C MB SLEEPER LB BREAKFAST LUNCH DINNER SEARCH VBWINDOW(“RESERVETION”).VBEDIT(“TRAIN NO”).SET “1234” VBWINDOW(“RESERVETION”).VBEDIT(“TRAIN NAME”).SET “RAYALASEEMA” VBWINDOW(“RESERVETION”).VBCOMBOBOX(“FROM”).SELECT “HYD” VBWINDOW(“RESERVETION”).VBCOMBOBOX(“TO”).SELECTT “KMP” VBWINDOW(“RESERVETION”).VBEDIT(“DOJ”).SET “121210”PC SURENDRA REDD Y Page 46
  47. 47. TEST AUTOMATION_FUNCTIONAL TESTING PCSR VBWINDOW(“RESERVETION”).VBRADIOBUTTON(“FIRST A/C”).SET VBWINDOW(“RESERVETION”).VBRADIOBUTTON(“UB”).SET VBWINDOW(“RESERVETION”).VBCHECKBOX(“BREAKFAST”).SET “ON” VBWINDOW(“RESERVETION”).VBCHECKBOX(“LUNCH”).SET “ON” VBWINDOW(“RESERVETION”).VBCHECKBOX(“DINNER”).SET “ON” VBWINDOW(“RESERVETION”).VBBUTTON(“NEXT”).CLICK 9. ACTIVATE: It is a method used for activating a dialog or a window. Syntax: OBJECT HIERARCHY.ACTIVATE 10. CLOSE: It is a method used for closing a window. Syntax: OBJECT HIERARCHY.CLOSE 11. TYPE: It is a method used for performing the keyboard related operations Syntax: OBJECT HIERARCHY.TYPE “KEY VALUE” Ex: OBJECT HIERARCHY.TYPE MICTAB 12. SET SECURE: It is a method used for setting the encrypted data into the edit box. Syntax: OBJECT HIERARCHY.SET SECURE “ENCRYPTED STRING” NOTE: To generate the encrypted string QTP has provided special tool by name PASSWORD ENCODER. NAVIGATION: START------>PROGRAMS-------->QTP-----TOOLS----------->PASSWORD ENCODER. 13. GET RO PROPERTY: It is A method used for getting the run time objects properties value during the execution. Syntax: VAR=OBJECT HIERARCHY.GETROPROPERTY (“PROPERTY NAME”) 14. GET TO PROPERY: It is a method used for getting the test objects properties value. Syntax: OBJECT HIERARCHY.GETTOPROPERTY (“PROPERTY NAME”) CASE STUDY 6: Develop the script for clicking on OK button, if it is existing and enabled. FORM: OKPC SURENDRA REDD Y Page 47

×