E N D
Introduction • What is Test Automation • History of Test Automation
Benefits • Fast • Reliable • Repeatable • Programmable • Comprehensive • Reusable
Manual Vs Automation • Pros of Test Automation • Effective solution for Test repeatability • Effective during Code changes • Can run parallel on multiple machines • Effective Test Coverage
Manual Vs Automation • Cons of Test Automation • Cost • Not effective against Visual reference • Maintenance may be an Issue
Selection Criteria • Functionality: Compatibility • Reliability : Tolerance & Recovery Capability • Usability • Efficiency: Time • Maintainability • Portability: Adaptability & Installation • Support: Support and Upgrades • Cost: License and Pricing
THE TEST OBJECTA quick understanding • The Test Object is the core of Test Automation • Test Object can represent any visual or virtual collection of properties • The are four types of Test Objects 1) Run time objects 2) Test objects 3) Utility objects 4) User defined objects
QTP Test Object Model Definition: The Test object model is a large set of object types or classes that QuickTest uses to represent the objects in your application. • TEST OBJECT • A test object is an object that QuickTest creates in the test to represent the actual object in your application, during the record session. (THE EXPECTED RESULT) • RUN TIME OBJECT • A run-time object is the actual object in your Web site or application on which methods/operations are performed during the run session (THE ACTUAL RESULT) “COMPARISION OF TEST OBJECT AGAINST THE RUN TIME OBJECT GENERATES THE RESULT OF THE TEST”
The Object Repository • Understanding the Physical and Logical Names • There are two types of repository available in QTP. • 1. Local repository (.MTR extension) • 2. Shared repository(.TSR extension)
Architecture of QTP • TITLE BAR • MENU BAR • TOOL BARS • TEST TAB • KEYWORD VIEW • EXPERT VIEW • DATA TABLE • ACTIVE SCREEN • INFORMATION PANE
Architecture of QTP • EXPERT VIEW
Stages of Automation • Planning • Recording • Enhancing • Debugging • Execution/Running • Analysis • Reporting
Anatomy of Object Recognition Logical Name Properties Physical/Descriptive Properties WinButton(“OK”).Click
The Active Screen • QTP captures every step detail as a bitmap image • The bitmap image is dynamic in nature • Active Screen allows QuickTest users to check property values, insert checkpoints and output values
The Data Table • A Data Table in an inbuild Data sheet within QuickTest • There are two types of Datasheets • Global Data Sheet • Local Data Sheet • Data table are available in two ways • 1. Design time data table (Attached with every test) • 2. Run time data table (Available in result window), Run time is a carbon copy of the design Data Table
Understanding QTP ScriptWindows Apps Object Window Button Text Box Radio Button Check Box Menu Combo Box Password QTP Object Type Window WinButton WinEdit WinRadioButton WinCheckbox WinMenu WinComboBox WinEdit Object Property Activate/Close Click Set/Type Set Set “ON”/”OFF” Select “S1;S2” Select “X1” SetSecure “encrpt”
Understanding QTP ScriptWeb Apps Object Button Text Box Radio Button Check Box Browser Menu Combo Box Hyperlink QTP Object Type WebButton WebEdit WebRadioGroup WebCheckbox WinMenu WebList Link Object Property Click Set/Type Set Set “ON”/”OFF” Select “S1;S2” Select “X1” Click
Remember the Syntax“The Easy Way” What Parent Window What Child Window What Object Type What Operation What Browser What Page What Object Type What Operation Examples: Window(“Register”).Dialog(“SCL”).WinEdit(“OK”).Click Browser(“SCL”).Page(“Register”).WebButton(‘OK”).Click
Script 1: Steps: Enter Date of Flight Select Fly From Select Fly To Click Flights Button Enter Name Select First Class Enter Tickets as 10 Insert Order Exit
Script 1 : Answer Window("Flight Reservation").Activate Window("Flight Reservation").WinComboBox("Fly From:").Select "London" Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles" Window("Flight Reservation").WinButton("FLIGHT").Click Window("Flight Reservation").WinEdit("Name:").Set "Srikkanth" Window("Flight Reservation").WinRadioButton("First").Set Window("Flight Reservation").WinEdit("Tickets:").Set "12" Window("Flight Reservation").WinButton("Insert Order").Click Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"
Script 2 : Steps: Enter First Name Enter Last Name Enter desired Login Click on Check Availability Choose password Re-enter password Stay Signed Set Google as Home page Select Write my own question Enter Answer Enter secondary email Select location as Canada Enter Verification Accept Terms
Script 2 : Answer Browser("Google Accounts").Page("Google Accounts").WebEdit("FirstName").Set "srikkan" Browser("Google Accounts").Page("Google Accounts").WebEdit("LastName").Set "danthala" Browser("Google Accounts").Page("Google Accounts").WebEdit("Email").Set "srikka" Browser("Google Accounts").Page("Google Accounts").WebButton("check availability!").Click Browser("Google Accounts").Page("Google Accounts").WebEdit("Passwd").SetSecure "4b51595c615a5953537" Browser("Google Accounts").Page("Google Accounts").WebEdit("PasswdAgain").SetSecure "4b51596475520a" Browser("Google Accounts").Page("Google Accounts").WebCheckBox("PersistentCookie").Set "ON" Browser("Google Accounts").Page("Google Accounts").WebCheckBox("smhck").Set "ON" Browser("Google Accounts").Page("Google Accounts").WebCheckBox("homepageSet").Set "ON" Browser("Google Accounts").Page("Google Accounts").WebList("selection").Select "Write my own question" Browser("Google Accounts").Page("Google Accounts").WebEdit("ownquestion").Set "my world" Browser("Google Accounts").Page("Google Accounts").WebEdit("IdentityAnswer").Set "QTP" Browser("Google Accounts").Page("Google Accounts").WebEdit("SecondaryEmail").Set "hello@hello.com" Browser("Google Accounts").Page("Google Accounts").WebList("loc").Select "Denmark (Danmark)" Browser("Google Accounts").Page("Google Accounts").WebEdit("newaccountcaptcha").Set "deconolin" Browser("Google Accounts").Page("Google Accounts").WebButton("I accept. Create my account.").Click
Recording Modes in QTP • Normal Recording - This is the default mode - Records all objects and Operation associated/performed with Object 2) Analog Recording - Generally used for Bitmap capturing • Analog mode recording is saved in a separate data-file • Analog mode data file can not be edited within QuickTest 3) Low Level Recording • Generally used to record objects that not recognised by QTP and also when exact coordinates are important for the test • Coordinates recorded can be edited as per the test requirements
Run Modes in QTP • Normal Run Mode • This is the Default Run Mode in QTP • Visually displays the steps executed within the script • User can customize execution times and delays • The Normal run mode option requires more system resources • Microsoft Script Debugger should be installed to enable this mode. • Fast Run Mode • Does not visually display the step execution • This option requires fewer system resources • When running a test set from Quality Center, tests are automatically run in Fast mode, even if Normal mode is selected in QuickTest
Understanding QTP Checkpoints Check points is a method which checks the content, image or a AUT(application under Test) scenario in QTP before or after any step. Types of check points:- • 1. Standard Check Point • 2. Bitmap Check Point • 3. Database Check Point • 4. Text Check Point • 5. Text Area Check Point • 6. Accessibility Check Point • 7. XML Check Point
Synchronization There are three methods to insert synchronization in QuickTest • Wait Example: Window(“Login”).WinEdit(“Username“).Set “user“ Wait (2) Window(“Login“).WinEdit(“’Password“).Set “password” • Sync Example: Window(“Login”).WinEdit(“Username“).Set “user“ Window(“Login”).WinEdit(“Password”).Sync Window(“Login“).WinEdit(“’Password“).Set “password” • Synchronization Point Example: Browser("Gmail").WaitProperty "name","Welcome to Gmail", 5000 • name - property name • Welcome to Gmail - property value • 5000 - number of milli seconds to wait
Methods in QuickTest Activate: Method: It activates the window/dialog Example:Dialog(“Login”).ActivateWindow(“Flight Reservation”).Activate Click Method: It clicks on an object (Buttons)Syntax: Object hierarchy. Example:Dialog(“Login”).Winbutton(“ok”).click Close Method: It closes the window Example:Window(“Flight Reservation”).CloseBrowser(“Browser”).Close Set Method: For setting the value of an edit box Example: Dialog (“Login”).WinEdit(“Agent Name”).Set “asdf” b. Selecting a Radio ButtonSyntax: Object Hierarchy. SetEx: Window("Flight Reservation").WinRadioButton("Business").Setc. Selecting/Deselecting check boxesSyntax:object Hierarchy.Set “ON/off” Ex: Window ("Flight Reservation"). Dialog("Open Order").WinCheckBox("OrderNo.").Set "ON"
Methods in QuickTest Select Method:It is used for selecting an item from a combo box or list box. Example: Window("Flight Reservation").WinComboBox("Fly From:").Select "London"B. Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "12572 GetVisibletext Method: It returns Text from the specified area. Example: x=Window("Flight Reservation").WinComboBox("Fly From:").GetVisibleText msgbox x GetRoproperty Method:It returns current object property value. It can be used for getting any object’s property Example: x=Window("Flight Reservation").WinEdit("Tickets:").GetROProperty ("width") msgbox x
Methods in QuickTest Navigate Method: It opens a specified URL in the Browser. Example: Browser("Yahoo!").Navigate "http://www.google.co.in" Getitemscount Method: It returns number of items in a combobox Example: x=Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount msgbox x Getcontent Method: It returns all items from a combobox. Example: x=Window("Flight Reservation").WinComboBox("Fly From:").GetContent msgbox x Exist Method: It checks whether the object is available or not. Ex: Window("Flight Reservation").Exist(5)
Output Value Output Value is a step by which one or more values can be captured during execution. • Types of Output Values: 1.Standard output value 2.Text output value 3.Text area output value 4.Database output value 5.XML output value
Data Driven Testing Data Driven Testing: Testing the Same operation with multiple sets of test data. Parameterization • Passing parameters, through this concept we can pass multiple values Types of Parameterization: 1. Through Loop Statements 2. Dynamic Test Data Submission 3. Through Data Table 4. Fetching Test Data directly from External files (Flat files & Spreadsheets) 5. Fetching Test Data directly from Databases (MSAcess, oracle etc). 6. Getting Test Data from front end objects.