SlideShare a Scribd company logo
1 of 34
QTP
Day3: Advanced Features

Parameterization
Step Generator
Adding conditional statements
Custom checkPoints
Parameterization

Types of parameterization:
We can parameterize tests in several ways in QTP.
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.
Parameterization
1. Through Loop Statements: We can use loop statements
for passing sequential numbers & Logical Numbers.
Note: We can’t generate Strings.
For orderno=1 to 10 step 1 ' for one increment step
keyword is not mandatory
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open
Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open
Order").WinEdit("Edit").Set orderno
Window("Flight Reservation").Dialog("Open
Order").WinButton("OK").Click
Next
Parameterization
2.Dynamic Test Data Submission: Through Loop Statements we can
give strings also but every time user has to enter data.
For x=1 to 3
Agent =inputbox("enter an Agent Name")
Password=inputbox("enter a password")
invokeapplication "C:Program FilesMercury InteractiveQuickTest
Professionalsamplesflightappflight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set Agent
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure password
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Next
Parameterization
3. Through Data Table: QTP adds one data table
(Spreadsheet) for every test, we can use Data
Table for Data Driven Testing.
It has 3 types of usage .
a. Entering test data directly into data table and use
b. Importing test data from external Flat files
c. Importing test data from external Spread sheets
d. Importing test data from Data bases.
Parameterization
a. Entering test data directly into data table and use.
Steps:
i) Generate the basic test>open data table
(View>Data Table)
ii) Click on column header>enter the name of the
field (like this we can create number of
columns) > Enter Data>connect the data to test
(variable=datatable(“column name”, Sheet id)
Example: agent=datatable(“agent”,1)
Pass parameters.)
iii) Run the test.
Parameterization
Example:
Agent = Datatable("Agent",1)
pwd=Datatable ("Password",1)
Invokeapplication "C:Program FilesMercury
InteractiveQuickTest
Professionalsamplesflightappflight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set Agent
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure pwd
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Parameterization

b. Importing test data from external files:
Open Data Table (view>Data table)>place
mouse pointer on data table and right
click>file>import from file>Click ok>Browsw
path of the file (it imports data from the flat file)
Connecting Test Data to QTP Test as above
and run the test.
Parameterization
c. Importing test data from external Spread
sheets:
Open Data Table (view>Data table)>place mouse
pointer on data table and right
click>file>import from file>Click ok>Browse path of
the excel sheet (it imports data from the excel
sheet)
Connecting Test Data to QTP Test as above and
run the test.
Parameterization
d. Importing test data from Data bases:
Through Data table we can import Test Data from Data
bases, but first we have to create /get the DSN(Data
source Name)& we have to use SQL Commands.
i) Creating a Test Database: open MS Access (or we can
use any other database).
ii) Start programs>MS Office>MS Access>file
>new>Select blank Database>enter name of the
database>Save with mdb extension.
iii) Creating Tables: Select Create table in design
view>Enter field name(Agent)and Select data type(text)
Like this we can create number of fields>save&enter
table name.
iv) Entering Data into Tables: Select table>enter the
data.
v) Creating DSN & importing data
Parameterization
Navigation:
view>data table>Place mouse pointer on Data
table>sheet>import>from
database(Database query wizard opens)>choose ‘specify
SQL statements manually>click
next >click create>click new>select driver type>click next
>browse path to store> enter
DSN Name>Click Save>click next>click
finish>select>browse the database& select>click
ok>click ok>select DSN>click ok>enter SQL statement
(select *from login)>click finish.
Note: DSN Creation is one time activity, by using the DSN
we can get data for number of
tests.
Parameterization

4. Fetching Test Data directly from Flat files
Dim fso, myfile
Set fso=createobject("scripting.filesystemobject")
Set myfile=fso.opentextfile("d:trigun.txt",1)
myfile.skipline
While myfile.atendofline <> true
x=myfile.readline
S=split(x,"@")
Parameterization
SystemUtil.Run "C:Program FilesMercury
InteractiveQuickTest
Professionalsamplesflightappflight4a.exe","","C:Program
FilesMercury
InteractiveQuickTest
Professionalsamplesflightapp","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set s(0)
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure S(1)
Dialog("Login").WinEdit("Password:").Type micReturn
Window("Flight Reservation").Close
Wend
Parameterization
Fetching Test Data directly from Databases
Option explicit
Dim con,rs
Set con=createobject("adodb.connection")
Set rs=createobject("adodb.recordset")
con.provider=("microsoft.jet.oledb.4.0")
con.open "C:Documents and SettingspoojaMy
Documentstrigun.mdb"
rs.open "select * from login",con
do until rs.eof=true
Parameterization
SystemUtil.Run "C:Program FilesMercury
InteractiveQuickTest
Professionalsamplesflightappflight4a.exe","","C:Program
FilesMercury
InteractiveQuickTest
Professionalsamplesflightapp","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set rs.fields
("agent")
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure
rs.fields("password")
Dialog("Login").WinEdit("Password:").Type micReturn
Window("Flight Reservation").Close
rs.movenext
loop
Parameterization
Using Dictionary Object for Parameterization
Set inputdata=CreateObject("Scripting.Dictionary")
inputdata.Add "Agent","gcreddy"
inputdata.Add "Password","mercury"
SystemUtil.Run "C:Program FilesHPQuickTest
Professionalsamplesflightappflight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set
inputdata("Agent")
Dialog("Login").WinEdit("Password:").Set
inputdata("Password")
Dialog("Login").WinButton("OK").Click
Step Generator

The Step Generator enables to add steps
easily, by selecting from a range of context-
sensitive options and entering the required
values.
User familiar with VBScript, can add and
update statements and enhance the tests with
programming.
After the test or an Action is recorded, its
power and flexibility can be increased by
adding recordable and non- recordable
VBScript statements as required for tasks like
Checkpoints, Datatables etc.
Step Generator

These additional steps can be added either
manually or using Insert>Step >Step
Generator.
In the Step Generator dialog box steps can be
defined that use:
-Test object methods and properties.
-Utility object methods and properties.
-Calls to library functions, VBScript functions,
and internal script functions.
Step Generator
Adding conditional
         statements
Conditional statements enable you to control the flow of
your Test or component. You use the IF … THEN and
ELSE statement to incorporate decision-making in your
tests. The IF … THEN statement evaluates whether a
condition is true. If the condition is true, the statements
following IF … THEN are executed. If condition is not true,
the statements
following the ELSE are executed.
If [condition] Then
[statement]
Else
[else statement]
End If
Adding conditional
       statements
if...then...elseif statement
if fee="Cash" then
msgbox "pay cash!"
elseif fee="Visa" then
msgbox "pay with visa."
elseif fee="American Express" then
msgbox "pay with American Express."
else
msgbox "Unknown method of Payment."
end If
Custom checkPoints

QTP checkpoints are very limiting when it
comes to maintenance and transport of
the same across scripts. It is always best
to avoid QTP checkpoints whenever
possible and create your own checkpoint.
For doing the custom check points, we
use Reporter.ReportEvent method
Custom checkPoints

Syntax is: Reporter.ReportEvent EventStatus,
    ReportStepName, Details
There are 5 EventStatus.
micPass – used to display passed events.
micFail – used to display Failed events.
micDone – No event status
micWarning – used to display Warning events.
micInfo – used to display any information events.
Custom checkPoints
ReportStepName – Name/Text of node to
   be shown in the test results tree view
Details – Text to be shown in the detail
   column of the report
Custom checkPoints

Custom CheckPoints and the Exist Method
This is an extremely important concept, and it
    should serve as the base to all
    CheckPoints. It checks whether an object
    exists on the page or not, and before we
    can start verifying an object’s properties,
    it’s important that we check if it is even
    available to us to perform our
    verifications. Also, if the object is found in
    the applicantion, the Exist method returns
    true, else, it returns false.
Syntax:Object.Exist(Timeout)
Custom checkPoints
In this syntax, Timeout is the amount of time
     you would like QTP to wait for the object
     before it returns a boolean output.
Case where an object is found.
To check if the Text box exists, we can
     formulate the following code that will wait
     for a max of 5 seconds before the WebEdit
     appears on the page:
MsgBox Browser("title:=.*Relevant
     Codes.*").Page("micclass:=Page")
.WebEdit("name:=txtExistTest").Exist(5)
Custom checkPoints
Case where an object is not found.
MsgBox Browser("title:=.*Relevant
   Codes.*").Page("micclass:=Page")
.WebEdit("name:=txtNotFound").
Exist(5) 'False
Custom checkPoints
Custom CheckPoints and the
   GetROProperty Method.
GetROProperty is short for Get-
   Runtime-Object-Property. In other
   words, this method can be used to
   retrieve the value that the object has,
   at present.
Note that, in some dynamic applications,
   runtime object properties can change
   on various factors.
Custom checkPoints
Also, with Descriptive Programming (DP),
    regardless of what property you retrieve, it
    will always be a runtime property.
If
Browser("title:=.*Relevant.*").WebEdit("name:=t
    xtMaxLen").GetROProperty("max
    length")=10 Then
Reporter.ReportEvent micPass, "WebEdit
    MaxLength Text", "Test Passed."
Else
Reporter.ReportEvent micFail, "WebEdit
    MaxLength Text", "Test Failed."
End If
Custom checkPoints
When you open your Test Results after the above
statement executes, you will notice that, the test failed.
It will always fail because the maxLength for our
WebEdit is not 10, but 9. When you you use Object spy
to retrieve the max length property,you will notice that
it is indeed not 10, but its 9. However, in the real-world,
we may not always know the properties these objects
will have at runtime, and most of the times you will
come to find of errors after your regression suites
complete their execution.
Custom checkPoints
Let’s create another CheckPoint, and verify if the Link has the correct
       color:
With Browser("title:=.*Relevant Codes.*").Link("text:=Relevant Codes:
       Test Color")
If .Exist(5) Then
If .GetROProperty("color") = "#0000ff" Then
Reporter.ReportEvent micPass, "RelevantCodes Link", "Correct color."
Else
Reporter.ReportEvent micFail, "RelevantCodes Link", "Incorrect color."
End If
Else
Reporter.ReportEvent micFail, "RelevantCodes Link", "Link was not
       found."
End If
End With
QTP Continued
               Day4:
Report and Comment
Splitting Action
Virtual object
QTP Continued
              Day5:
Recovery scenario
Optional steps
Framework Approach
Working with Dynamic Objects

More Related Content

What's hot

Converting Db Schema Into Uml Classes
Converting Db Schema Into Uml ClassesConverting Db Schema Into Uml Classes
Converting Db Schema Into Uml Classes
Kaniska Mandal
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
Darwin Durand
 
Testing for Pragmatic People
Testing for Pragmatic PeopleTesting for Pragmatic People
Testing for Pragmatic People
davismr
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
Richard Paul
 

What's hot (20)

JUnit Pioneer
JUnit PioneerJUnit Pioneer
JUnit Pioneer
 
Converting Db Schema Into Uml Classes
Converting Db Schema Into Uml ClassesConverting Db Schema Into Uml Classes
Converting Db Schema Into Uml Classes
 
Specs2
Specs2Specs2
Specs2
 
Testing And Mxunit In ColdFusion
Testing And Mxunit In ColdFusionTesting And Mxunit In ColdFusion
Testing And Mxunit In ColdFusion
 
JUnit & Mockito, first steps
JUnit & Mockito, first stepsJUnit & Mockito, first steps
JUnit & Mockito, first steps
 
SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
Sample Chapter of Practical Unit Testing with TestNG and Mockito
Sample Chapter of Practical Unit Testing with TestNG and MockitoSample Chapter of Practical Unit Testing with TestNG and Mockito
Sample Chapter of Practical Unit Testing with TestNG and Mockito
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012
 
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
 
Introduction to Software Testing
Introduction to Software TestingIntroduction to Software Testing
Introduction to Software Testing
 
xUnit Style Database Testing
xUnit Style Database TestingxUnit Style Database Testing
xUnit Style Database Testing
 
Testing for Pragmatic People
Testing for Pragmatic PeopleTesting for Pragmatic People
Testing for Pragmatic People
 
Windows controls in c
Windows controls in cWindows controls in c
Windows controls in c
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScript
 
Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent code
 
The Ring programming language version 1.8 book - Part 32 of 202
The Ring programming language version 1.8 book - Part 32 of 202The Ring programming language version 1.8 book - Part 32 of 202
The Ring programming language version 1.8 book - Part 32 of 202
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
 
Two Scoops of Django - Common Patterns for Forms
Two Scoops of Django - Common Patterns for FormsTwo Scoops of Django - Common Patterns for Forms
Two Scoops of Django - Common Patterns for Forms
 
Visual Studio.Net - Sql Server
Visual Studio.Net - Sql ServerVisual Studio.Net - Sql Server
Visual Studio.Net - Sql Server
 

Viewers also liked

Qtp 8.0 basic
Qtp 8.0 basicQtp 8.0 basic
Qtp 8.0 basic
medsherb
 
Hp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT MobileHp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT Mobile
Perfecto Mobile
 

Viewers also liked (20)

How to Test on the Right Mobile Platforms
How to Test on the Right Mobile PlatformsHow to Test on the Right Mobile Platforms
How to Test on the Right Mobile Platforms
 
Ten reasons why now is the perfect time to get serious about the mobile web
Ten reasons why now is the perfect time to get serious about the mobile webTen reasons why now is the perfect time to get serious about the mobile web
Ten reasons why now is the perfect time to get serious about the mobile web
 
TechTalk: Report Bugs Like a Boss
TechTalk: Report Bugs Like a BossTechTalk: Report Bugs Like a Boss
TechTalk: Report Bugs Like a Boss
 
Selenium Testing
Selenium Testing Selenium Testing
Selenium Testing
 
Webinar: Appium & Perfecto: A Perfect Match
Webinar: Appium & Perfecto: A Perfect MatchWebinar: Appium & Perfecto: A Perfect Match
Webinar: Appium & Perfecto: A Perfect Match
 
Qtp 80 Basics3561
Qtp 80 Basics3561Qtp 80 Basics3561
Qtp 80 Basics3561
 
Achieving a Winning Digital User Experience with Real World Testing
Achieving a Winning Digital User Experience with Real World TestingAchieving a Winning Digital User Experience with Real World Testing
Achieving a Winning Digital User Experience with Real World Testing
 
Qtp day 1
Qtp day 1Qtp day 1
Qtp day 1
 
QTP Automation Testing Tutorial 2
QTP Automation Testing Tutorial 2QTP Automation Testing Tutorial 2
QTP Automation Testing Tutorial 2
 
Qtp 8.0 basic
Qtp 8.0 basicQtp 8.0 basic
Qtp 8.0 basic
 
TechTalk: Taking the Mystery Out of Object ID Automation
TechTalk: Taking the Mystery Out of Object ID AutomationTechTalk: Taking the Mystery Out of Object ID Automation
TechTalk: Taking the Mystery Out of Object ID Automation
 
Hp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT MobileHp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT Mobile
 
Qtp object repository
Qtp object repositoryQtp object repository
Qtp object repository
 
Test Automation Tool comparison – HP UFT/QTP vs. Selenium
Test Automation Tool comparison –  HP UFT/QTP vs. SeleniumTest Automation Tool comparison –  HP UFT/QTP vs. Selenium
Test Automation Tool comparison – HP UFT/QTP vs. Selenium
 
10 reasons why now is the perfect time to get started with the mobile web
10 reasons why now is the perfect time to get started with the mobile web10 reasons why now is the perfect time to get started with the mobile web
10 reasons why now is the perfect time to get started with the mobile web
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing Tool
 
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar SldiesLaunch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
 
Testing Apps for Wearables
Testing Apps for WearablesTesting Apps for Wearables
Testing Apps for Wearables
 
iOS9 Launch - Mobile Dev & Test Implications
iOS9 Launch - Mobile Dev & Test ImplicationsiOS9 Launch - Mobile Dev & Test Implications
iOS9 Launch - Mobile Dev & Test Implications
 
7 Keys for Unattended Test AUtomation webinar deck
7 Keys for Unattended Test AUtomation webinar deck7 Keys for Unattended Test AUtomation webinar deck
7 Keys for Unattended Test AUtomation webinar deck
 

Similar to Qtp day 3

qtp 9.2 features
qtp 9.2 featuresqtp 9.2 features
qtp 9.2 features
krishna3032
 
Qtp 92 Tutorial Anil
Qtp 92 Tutorial AnilQtp 92 Tutorial Anil
Qtp 92 Tutorial Anil
guest3373d3
 
Qtp 9.2 Tutorial
Qtp 9.2 TutorialQtp 9.2 Tutorial
Qtp 9.2 Tutorial
guest37ae7f
 
Qtp Training
Qtp TrainingQtp Training
Qtp Training
mehramit
 
Qtp Presentation
Qtp PresentationQtp Presentation
Qtp Presentation
techgajanan
 
Cis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry universityCis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry university
lhkslkdh89009
 
Qtp interview questions3
Qtp interview questions3Qtp interview questions3
Qtp interview questions3
Ramu Palanki
 
Qtp interview questions3
Qtp interview questions3Qtp interview questions3
Qtp interview questions3
Ramu Palanki
 

Similar to Qtp day 3 (20)

Qtp 92 Tutorial769
Qtp 92 Tutorial769Qtp 92 Tutorial769
Qtp 92 Tutorial769
 
Qtp 92 Tutorial769
Qtp 92 Tutorial769Qtp 92 Tutorial769
Qtp 92 Tutorial769
 
qtp 9.2 features
qtp 9.2 featuresqtp 9.2 features
qtp 9.2 features
 
Qtp 92 Tutorial
Qtp 92 TutorialQtp 92 Tutorial
Qtp 92 Tutorial
 
Ppt Qtp
Ppt QtpPpt Qtp
Ppt Qtp
 
Qtp 92 Tutorial769
Qtp 92 Tutorial769Qtp 92 Tutorial769
Qtp 92 Tutorial769
 
Qtp 92 Tutorial Anil
Qtp 92 Tutorial AnilQtp 92 Tutorial Anil
Qtp 92 Tutorial Anil
 
Qtp 9.2 Tutorial
Qtp 9.2 TutorialQtp 9.2 Tutorial
Qtp 9.2 Tutorial
 
Qtp Training
Qtp TrainingQtp Training
Qtp Training
 
MT_01_unittest_python.pdf
MT_01_unittest_python.pdfMT_01_unittest_python.pdf
MT_01_unittest_python.pdf
 
Data driven testing
Data driven testingData driven testing
Data driven testing
 
Qtp Training
Qtp TrainingQtp Training
Qtp Training
 
Qtp Presentation
Qtp PresentationQtp Presentation
Qtp Presentation
 
Cis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry universityCis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry university
 
Rhino Mocks
Rhino MocksRhino Mocks
Rhino Mocks
 
Qtp interview questions3
Qtp interview questions3Qtp interview questions3
Qtp interview questions3
 
Qtp interview questions3
Qtp interview questions3Qtp interview questions3
Qtp interview questions3
 
Keyword driven testing in qtp
Keyword driven testing in qtpKeyword driven testing in qtp
Keyword driven testing in qtp
 
Php tests tips
Php tests tipsPhp tests tips
Php tests tips
 
XPages Workshop: Concepts And Exercises
XPages Workshop:   Concepts And ExercisesXPages Workshop:   Concepts And Exercises
XPages Workshop: Concepts And Exercises
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Qtp day 3

  • 1. QTP
  • 2. Day3: Advanced Features Parameterization Step Generator Adding conditional statements Custom checkPoints
  • 3. Parameterization Types of parameterization: We can parameterize tests in several ways in QTP. 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.
  • 4. Parameterization 1. Through Loop Statements: We can use loop statements for passing sequential numbers & Logical Numbers. Note: We can’t generate Strings. For orderno=1 to 10 step 1 ' for one increment step keyword is not mandatory Window("Flight Reservation").Activate Window("Flight Reservation").WinButton("Button").Click Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set orderno Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click Next
  • 5. Parameterization 2.Dynamic Test Data Submission: Through Loop Statements we can give strings also but every time user has to enter data. For x=1 to 3 Agent =inputbox("enter an Agent Name") Password=inputbox("enter a password") invokeapplication "C:Program FilesMercury InteractiveQuickTest Professionalsamplesflightappflight4a.exe" Dialog("Login").Activate Dialog("Login").WinEdit("Agent Name:").Set Agent Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure password Dialog("Login").WinButton("OK").Click Window("Flight Reservation").Close Next
  • 6. Parameterization 3. Through Data Table: QTP adds one data table (Spreadsheet) for every test, we can use Data Table for Data Driven Testing. It has 3 types of usage . a. Entering test data directly into data table and use b. Importing test data from external Flat files c. Importing test data from external Spread sheets d. Importing test data from Data bases.
  • 7. Parameterization a. Entering test data directly into data table and use. Steps: i) Generate the basic test>open data table (View>Data Table) ii) Click on column header>enter the name of the field (like this we can create number of columns) > Enter Data>connect the data to test (variable=datatable(“column name”, Sheet id) Example: agent=datatable(“agent”,1) Pass parameters.) iii) Run the test.
  • 8. Parameterization Example: Agent = Datatable("Agent",1) pwd=Datatable ("Password",1) Invokeapplication "C:Program FilesMercury InteractiveQuickTest Professionalsamplesflightappflight4a.exe" Dialog("Login").Activate Dialog("Login").WinEdit("Agent Name:").Set Agent Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure pwd Dialog("Login").WinButton("OK").Click Window("Flight Reservation").Close
  • 9. Parameterization b. Importing test data from external files: Open Data Table (view>Data table)>place mouse pointer on data table and right click>file>import from file>Click ok>Browsw path of the file (it imports data from the flat file) Connecting Test Data to QTP Test as above and run the test.
  • 10. Parameterization c. Importing test data from external Spread sheets: Open Data Table (view>Data table)>place mouse pointer on data table and right click>file>import from file>Click ok>Browse path of the excel sheet (it imports data from the excel sheet) Connecting Test Data to QTP Test as above and run the test.
  • 11. Parameterization d. Importing test data from Data bases: Through Data table we can import Test Data from Data bases, but first we have to create /get the DSN(Data source Name)& we have to use SQL Commands. i) Creating a Test Database: open MS Access (or we can use any other database). ii) Start programs>MS Office>MS Access>file >new>Select blank Database>enter name of the database>Save with mdb extension. iii) Creating Tables: Select Create table in design view>Enter field name(Agent)and Select data type(text) Like this we can create number of fields>save&enter table name. iv) Entering Data into Tables: Select table>enter the data. v) Creating DSN & importing data
  • 12. Parameterization Navigation: view>data table>Place mouse pointer on Data table>sheet>import>from database(Database query wizard opens)>choose ‘specify SQL statements manually>click next >click create>click new>select driver type>click next >browse path to store> enter DSN Name>Click Save>click next>click finish>select>browse the database& select>click ok>click ok>select DSN>click ok>enter SQL statement (select *from login)>click finish. Note: DSN Creation is one time activity, by using the DSN we can get data for number of tests.
  • 13. Parameterization 4. Fetching Test Data directly from Flat files Dim fso, myfile Set fso=createobject("scripting.filesystemobject") Set myfile=fso.opentextfile("d:trigun.txt",1) myfile.skipline While myfile.atendofline <> true x=myfile.readline S=split(x,"@")
  • 14. Parameterization SystemUtil.Run "C:Program FilesMercury InteractiveQuickTest Professionalsamplesflightappflight4a.exe","","C:Program FilesMercury InteractiveQuickTest Professionalsamplesflightapp","open" Dialog("Login").Activate Dialog("Login").WinEdit("Agent Name:").Set s(0) Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure S(1) Dialog("Login").WinEdit("Password:").Type micReturn Window("Flight Reservation").Close Wend
  • 15. Parameterization Fetching Test Data directly from Databases Option explicit Dim con,rs Set con=createobject("adodb.connection") Set rs=createobject("adodb.recordset") con.provider=("microsoft.jet.oledb.4.0") con.open "C:Documents and SettingspoojaMy Documentstrigun.mdb" rs.open "select * from login",con do until rs.eof=true
  • 16. Parameterization SystemUtil.Run "C:Program FilesMercury InteractiveQuickTest Professionalsamplesflightappflight4a.exe","","C:Program FilesMercury InteractiveQuickTest Professionalsamplesflightapp","open" Dialog("Login").Activate Dialog("Login").WinEdit("Agent Name:").Set rs.fields ("agent") Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure rs.fields("password") Dialog("Login").WinEdit("Password:").Type micReturn Window("Flight Reservation").Close rs.movenext loop
  • 17. Parameterization Using Dictionary Object for Parameterization Set inputdata=CreateObject("Scripting.Dictionary") inputdata.Add "Agent","gcreddy" inputdata.Add "Password","mercury" SystemUtil.Run "C:Program FilesHPQuickTest Professionalsamplesflightappflight4a.exe" Dialog("Login").Activate Dialog("Login").WinEdit("Agent Name:").Set inputdata("Agent") Dialog("Login").WinEdit("Password:").Set inputdata("Password") Dialog("Login").WinButton("OK").Click
  • 18. Step Generator The Step Generator enables to add steps easily, by selecting from a range of context- sensitive options and entering the required values. User familiar with VBScript, can add and update statements and enhance the tests with programming. After the test or an Action is recorded, its power and flexibility can be increased by adding recordable and non- recordable VBScript statements as required for tasks like Checkpoints, Datatables etc.
  • 19. Step Generator These additional steps can be added either manually or using Insert>Step >Step Generator. In the Step Generator dialog box steps can be defined that use: -Test object methods and properties. -Utility object methods and properties. -Calls to library functions, VBScript functions, and internal script functions.
  • 21. Adding conditional statements Conditional statements enable you to control the flow of your Test or component. You use the IF … THEN and ELSE statement to incorporate decision-making in your tests. The IF … THEN statement evaluates whether a condition is true. If the condition is true, the statements following IF … THEN are executed. If condition is not true, the statements following the ELSE are executed. If [condition] Then [statement] Else [else statement] End If
  • 22. Adding conditional statements if...then...elseif statement if fee="Cash" then msgbox "pay cash!" elseif fee="Visa" then msgbox "pay with visa." elseif fee="American Express" then msgbox "pay with American Express." else msgbox "Unknown method of Payment." end If
  • 23. Custom checkPoints QTP checkpoints are very limiting when it comes to maintenance and transport of the same across scripts. It is always best to avoid QTP checkpoints whenever possible and create your own checkpoint. For doing the custom check points, we use Reporter.ReportEvent method
  • 24. Custom checkPoints Syntax is: Reporter.ReportEvent EventStatus, ReportStepName, Details There are 5 EventStatus. micPass – used to display passed events. micFail – used to display Failed events. micDone – No event status micWarning – used to display Warning events. micInfo – used to display any information events.
  • 25. Custom checkPoints ReportStepName – Name/Text of node to be shown in the test results tree view Details – Text to be shown in the detail column of the report
  • 26. Custom checkPoints Custom CheckPoints and the Exist Method This is an extremely important concept, and it should serve as the base to all CheckPoints. It checks whether an object exists on the page or not, and before we can start verifying an object’s properties, it’s important that we check if it is even available to us to perform our verifications. Also, if the object is found in the applicantion, the Exist method returns true, else, it returns false. Syntax:Object.Exist(Timeout)
  • 27. Custom checkPoints In this syntax, Timeout is the amount of time you would like QTP to wait for the object before it returns a boolean output. Case where an object is found. To check if the Text box exists, we can formulate the following code that will wait for a max of 5 seconds before the WebEdit appears on the page: MsgBox Browser("title:=.*Relevant Codes.*").Page("micclass:=Page") .WebEdit("name:=txtExistTest").Exist(5)
  • 28. Custom checkPoints Case where an object is not found. MsgBox Browser("title:=.*Relevant Codes.*").Page("micclass:=Page") .WebEdit("name:=txtNotFound"). Exist(5) 'False
  • 29. Custom checkPoints Custom CheckPoints and the GetROProperty Method. GetROProperty is short for Get- Runtime-Object-Property. In other words, this method can be used to retrieve the value that the object has, at present. Note that, in some dynamic applications, runtime object properties can change on various factors.
  • 30. Custom checkPoints Also, with Descriptive Programming (DP), regardless of what property you retrieve, it will always be a runtime property. If Browser("title:=.*Relevant.*").WebEdit("name:=t xtMaxLen").GetROProperty("max length")=10 Then Reporter.ReportEvent micPass, "WebEdit MaxLength Text", "Test Passed." Else Reporter.ReportEvent micFail, "WebEdit MaxLength Text", "Test Failed." End If
  • 31. Custom checkPoints When you open your Test Results after the above statement executes, you will notice that, the test failed. It will always fail because the maxLength for our WebEdit is not 10, but 9. When you you use Object spy to retrieve the max length property,you will notice that it is indeed not 10, but its 9. However, in the real-world, we may not always know the properties these objects will have at runtime, and most of the times you will come to find of errors after your regression suites complete their execution.
  • 32. Custom checkPoints Let’s create another CheckPoint, and verify if the Link has the correct color: With Browser("title:=.*Relevant Codes.*").Link("text:=Relevant Codes: Test Color") If .Exist(5) Then If .GetROProperty("color") = "#0000ff" Then Reporter.ReportEvent micPass, "RelevantCodes Link", "Correct color." Else Reporter.ReportEvent micFail, "RelevantCodes Link", "Incorrect color." End If Else Reporter.ReportEvent micFail, "RelevantCodes Link", "Link was not found." End If End With
  • 33. QTP Continued Day4: Report and Comment Splitting Action Virtual object
  • 34. QTP Continued Day5: Recovery scenario Optional steps Framework Approach Working with Dynamic Objects