SlideShare a Scribd company logo
QTP SCRIPTS
http://www.funandknowledge.blogspot.com/
QTP Script for connecting to database(MS Access)
                     Option Explicit
                       Dim con,rs
        Set con=createobject("adodb.connection")
         Set rs=createobject("adodb.recordset")

        con.provider="microsoft.jet.oledb.4.0"
              con.open"d:testdata.mdb"
            rs.open"select*from emp",con
                  Do while not rs.eof
  VbWindow("Form1").VbEdit("val1").Set rs.fields("v1")
  VbWindow("Form1").VbEdit("val2").Set rs.fields("v2")
     VbWindow("Form1").VbButton("ADD").Click
                     rs.movenext
                         Loop
Database we are using here is MS Access.before running this
             script create a table in MS Acess.

  In the above script i used table called "emp" and column
                  names as "v1" and "v2".

  "d:testdata.mdb" is path of the table which we created.

Main use of this application is to use testdata of table(which
             is in database) in the application.

    http://www.funandknowledge.blogspot.com/
DataDriven Testing using ExcelSheet instead of Datatable

            This is script for data driven using excel sheet.
 In this script we are not importing excel sheet to datatable.Directly
          values are supplied to application from excel sheet.

             Set ex= CreateObject("Excel.Application")
             Set a=ex.Workbooks.open("D:excel.xls")
                   Set b=a.worksheets("Sheet1")
                           dim login,pwd
                             for i=1 to 3
                     login=b.Cells(i,"A").value
                      pwd=b.Cells(i,"B").value
                           msgbox login
                           msgbox pwd
                                 next
"D:excel.xls" is path of excel sheet.

"sheet1"indicates sheet name in which values are present.
          A,B are column names in excel sheet.

we have excel sheet with values as shown below in d drive.

                           AB
                           12
                           34
                           56

   http://www.funandknowledge.blogspot.com/
Descriptive Programming to Create Folder in System


     Set obj=createobject ("scripting.filesystemobject")
          Set notepad=obj.createfolder("d:abc")

   this script will create a folder named "abc" in "d" drive.

    http://www.funandknowledge.blogspot.com/
Timeout for MessageBox

Script for MessageBox to disappear after particular time
        without clicking on ok button manually.

         Set a=createobject("wscript.shell")
msgbox_message="Message Box will close by itself in
       10seconds so dont click on OK button"
                msgbox_time="10"
              msgbox_title="Testing"
a.popup msgbox_message,msgbox_time,msgbox_title

               Where time is in seconds.

  http://www.funandknowledge.blogspot.com/
Descriptive Programming for Yahoo Login Page

 SystemUtil.Run"iexplore","http://www.yahoomail.com"
Set g=Browser("name:=Yahoo.*").Page("title:=Yahoo.*")
          g.WebEdit("name:=login").Set "aaa"
      g.WebEdit("name:=passwd").SetSecure "bbb"
          g.WebButton("name:=Sign In").Click
                 g.Link("name:=Inbox.*",
       "html id:=WelcomeInboxFolderLink").Click
             g.Link("name:=Sign Out").Click


  http://www.funandknowledge.blogspot.com/
SystemUtil.Run"iexplore","http://www.yahoomail.com"
          statement opens yahoo login page
                   aaa=username
                   bbb=password

             For more QTP Scripts

More Related Content

What's hot

Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code LabColin Su
 
Web2py tutorial to create db driven application.
Web2py tutorial to create db driven application.Web2py tutorial to create db driven application.
Web2py tutorial to create db driven application.fRui Apps
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
Amanda Gilmore
 
Store and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and CassandraStore and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and CassandraDeependra Ariyadewa
 
File System Operations
File System OperationsFile System Operations
File System Operations
G.C Reddy
 
Everyday's JS
Everyday's JSEveryday's JS
Everyday's JS
Adib Mehedi
 
2018年のXamarinの概要と活用方法
2018年のXamarinの概要と活用方法2018年のXamarinの概要と活用方法
2018年のXamarinの概要と活用方法
Yoshito Tabuchi
 
Excel Scripting
Excel Scripting Excel Scripting
Excel Scripting
G C Reddy Technologies
 
Using JSON/BSON types in your hybrid application environment
Using JSON/BSON types in your hybrid application environmentUsing JSON/BSON types in your hybrid application environment
Using JSON/BSON types in your hybrid application environment
Ajay Gupte
 
Entity Framework Core & Micro-Orms with Asp.Net Core
Entity Framework Core & Micro-Orms with Asp.Net CoreEntity Framework Core & Micro-Orms with Asp.Net Core
Entity Framework Core & Micro-Orms with Asp.Net Core
Stephane Belkheraz
 
ReactiveMongo - non blocking and asynchronous I/O operations
ReactiveMongo - non blocking and asynchronous I/O operationsReactiveMongo - non blocking and asynchronous I/O operations
ReactiveMongo - non blocking and asynchronous I/O operations
David Pichsenmeister
 
Excel to Use Rest API to communicate with a server
Excel to Use Rest API to communicate with a serverExcel to Use Rest API to communicate with a server
Excel to Use Rest API to communicate with a server
docuboy
 
History of jQuery
History of jQueryHistory of jQuery
History of jQuery
jeresig
 
Unit testing powershell
Unit testing powershellUnit testing powershell
Unit testing powershellMatt Wrock
 
Full compile invalid obje pl/sql
Full compile invalid obje pl/sqlFull compile invalid obje pl/sql
Full compile invalid obje pl/sqlAnar Godjaev
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
Scott Leberknight
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonML
Riza Fahmi
 
NoSQL - Hands on
NoSQL - Hands onNoSQL - Hands on
NoSQL - Hands on
Johannes Hoppe
 

What's hot (20)

Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code Lab
 
Web2py tutorial to create db driven application.
Web2py tutorial to create db driven application.Web2py tutorial to create db driven application.
Web2py tutorial to create db driven application.
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
 
Store and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and CassandraStore and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and Cassandra
 
File System Operations
File System OperationsFile System Operations
File System Operations
 
Everyday's JS
Everyday's JSEveryday's JS
Everyday's JS
 
2018年のXamarinの概要と活用方法
2018年のXamarinの概要と活用方法2018年のXamarinの概要と活用方法
2018年のXamarinの概要と活用方法
 
Excel Scripting
Excel Scripting Excel Scripting
Excel Scripting
 
Using JSON/BSON types in your hybrid application environment
Using JSON/BSON types in your hybrid application environmentUsing JSON/BSON types in your hybrid application environment
Using JSON/BSON types in your hybrid application environment
 
Entity Framework Core & Micro-Orms with Asp.Net Core
Entity Framework Core & Micro-Orms with Asp.Net CoreEntity Framework Core & Micro-Orms with Asp.Net Core
Entity Framework Core & Micro-Orms with Asp.Net Core
 
ReactiveMongo - non blocking and asynchronous I/O operations
ReactiveMongo - non blocking and asynchronous I/O operationsReactiveMongo - non blocking and asynchronous I/O operations
ReactiveMongo - non blocking and asynchronous I/O operations
 
Excel to Use Rest API to communicate with a server
Excel to Use Rest API to communicate with a serverExcel to Use Rest API to communicate with a server
Excel to Use Rest API to communicate with a server
 
History of jQuery
History of jQueryHistory of jQuery
History of jQuery
 
Unit testing powershell
Unit testing powershellUnit testing powershell
Unit testing powershell
 
Full compile invalid obje pl/sql
Full compile invalid obje pl/sqlFull compile invalid obje pl/sql
Full compile invalid obje pl/sql
 
Quanlycanbo
QuanlycanboQuanlycanbo
Quanlycanbo
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonML
 
NoSQL - Hands on
NoSQL - Hands onNoSQL - Hands on
NoSQL - Hands on
 
Latinoware
LatinowareLatinoware
Latinoware
 

Viewers also liked

Qtp Training Deepti 3 Of 44256
Qtp Training Deepti 3 Of 44256Qtp Training Deepti 3 Of 44256
Qtp Training Deepti 3 Of 44256Azhar Satti
 
Qtp material for beginners
Qtp material for beginnersQtp material for beginners
Qtp material for beginnersRamu Palanki
 
QTP Descriptive programming Tutorial
QTP Descriptive programming TutorialQTP Descriptive programming Tutorial
QTP Descriptive programming Tutorial
Jim Orlando
 
Qtp Training Deepti 4 Of 4493
Qtp Training Deepti 4 Of 4493Qtp Training Deepti 4 Of 4493
Qtp Training Deepti 4 Of 4493Azhar Satti
 
Thomson reuters qtp training presentation
Thomson reuters qtp training presentationThomson reuters qtp training presentation
Thomson reuters qtp training presentation
Sravan Vasireddy
 
Qtp+real time+test+script
Qtp+real time+test+scriptQtp+real time+test+script
Qtp+real time+test+scriptRamu Palanki
 
Qtp realtime scripts
Qtp realtime scriptsQtp realtime scripts
Qtp realtime scriptsRamu Palanki
 
Qtp wsh scripts examples
Qtp wsh scripts examplesQtp wsh scripts examples
Qtp wsh scripts examplesRamu Palanki
 
And I thought I knew QTP - QTP Concepts Unplugged
And I thought I knew QTP - QTP Concepts UnpluggedAnd I thought I knew QTP - QTP Concepts Unplugged
And I thought I knew QTP - QTP Concepts Unplugged
Tarun Lalwani
 
Experitest & Tech Mahindra Co-Webinar
 Experitest & Tech Mahindra Co-Webinar Experitest & Tech Mahindra Co-Webinar
Experitest & Tech Mahindra Co-Webinar
Experitest
 
QTP Descriptive Programming Unplugged Book
QTP Descriptive Programming Unplugged BookQTP Descriptive Programming Unplugged Book
QTP Descriptive Programming Unplugged Book
Tarun Lalwani
 
UFT & QTP Interview Unplugged 2nd Ed
UFT & QTP Interview Unplugged 2nd EdUFT & QTP Interview Unplugged 2nd Ed
UFT & QTP Interview Unplugged 2nd EdTarun Lalwani
 
vbscripting
vbscriptingvbscripting
vbscripting
Anand Dhana
 
descriptive programming
descriptive programmingdescriptive programming
descriptive programming
Anand Dhana
 
Web service testing using QTP (UFT)
Web service testing using QTP (UFT)Web service testing using QTP (UFT)
Web service testing using QTP (UFT)
NaveenKumar Namachivayam
 

Viewers also liked (15)

Qtp Training Deepti 3 Of 44256
Qtp Training Deepti 3 Of 44256Qtp Training Deepti 3 Of 44256
Qtp Training Deepti 3 Of 44256
 
Qtp material for beginners
Qtp material for beginnersQtp material for beginners
Qtp material for beginners
 
QTP Descriptive programming Tutorial
QTP Descriptive programming TutorialQTP Descriptive programming Tutorial
QTP Descriptive programming Tutorial
 
Qtp Training Deepti 4 Of 4493
Qtp Training Deepti 4 Of 4493Qtp Training Deepti 4 Of 4493
Qtp Training Deepti 4 Of 4493
 
Thomson reuters qtp training presentation
Thomson reuters qtp training presentationThomson reuters qtp training presentation
Thomson reuters qtp training presentation
 
Qtp+real time+test+script
Qtp+real time+test+scriptQtp+real time+test+script
Qtp+real time+test+script
 
Qtp realtime scripts
Qtp realtime scriptsQtp realtime scripts
Qtp realtime scripts
 
Qtp wsh scripts examples
Qtp wsh scripts examplesQtp wsh scripts examples
Qtp wsh scripts examples
 
And I thought I knew QTP - QTP Concepts Unplugged
And I thought I knew QTP - QTP Concepts UnpluggedAnd I thought I knew QTP - QTP Concepts Unplugged
And I thought I knew QTP - QTP Concepts Unplugged
 
Experitest & Tech Mahindra Co-Webinar
 Experitest & Tech Mahindra Co-Webinar Experitest & Tech Mahindra Co-Webinar
Experitest & Tech Mahindra Co-Webinar
 
QTP Descriptive Programming Unplugged Book
QTP Descriptive Programming Unplugged BookQTP Descriptive Programming Unplugged Book
QTP Descriptive Programming Unplugged Book
 
UFT & QTP Interview Unplugged 2nd Ed
UFT & QTP Interview Unplugged 2nd EdUFT & QTP Interview Unplugged 2nd Ed
UFT & QTP Interview Unplugged 2nd Ed
 
vbscripting
vbscriptingvbscripting
vbscripting
 
descriptive programming
descriptive programmingdescriptive programming
descriptive programming
 
Web service testing using QTP (UFT)
Web service testing using QTP (UFT)Web service testing using QTP (UFT)
Web service testing using QTP (UFT)
 

Similar to QTP

Nosql hands on handout 04
Nosql hands on handout 04Nosql hands on handout 04
Nosql hands on handout 04Krishna Sankar
 
EPiServer report generation
EPiServer report generationEPiServer report generation
EPiServer report generation
Paul Graham
 
Db connection to qtp
Db connection to qtpDb connection to qtp
Db connection to qtp
siva1991
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important Parts
Sergey Bolshchikov
 
Jdbc example program with access and MySql
Jdbc example program with access and MySqlJdbc example program with access and MySql
Jdbc example program with access and MySql
kamal kotecha
 
ES3-2020-P3 TDD Calculator
ES3-2020-P3 TDD CalculatorES3-2020-P3 TDD Calculator
ES3-2020-P3 TDD Calculator
David Rodenas
 
Ruby and Rails by example
Ruby and Rails by exampleRuby and Rails by example
Ruby and Rails by example
bryanbibat
 
Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)Leonardo Soto
 
Spsl vi unit final
Spsl vi unit finalSpsl vi unit final
Spsl vi unit final
Sasidhar Kothuru
 
Spsl v unit - final
Spsl v unit - finalSpsl v unit - final
Spsl v unit - final
Sasidhar Kothuru
 
Specs2
Specs2Specs2
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard LibraryHidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Library
doughellmann
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
UC San Diego
 
Introduction tomongodb
Introduction tomongodbIntroduction tomongodb
Introduction tomongodbLee Theobald
 
Building Your First Big Data Application on AWS
Building Your First Big Data Application on AWSBuilding Your First Big Data Application on AWS
Building Your First Big Data Application on AWS
Amazon Web Services
 

Similar to QTP (20)

Python database access
Python database accessPython database access
Python database access
 
Nosql hands on handout 04
Nosql hands on handout 04Nosql hands on handout 04
Nosql hands on handout 04
 
Polyglot Persistence
Polyglot PersistencePolyglot Persistence
Polyglot Persistence
 
EPiServer report generation
EPiServer report generationEPiServer report generation
EPiServer report generation
 
Db connection to qtp
Db connection to qtpDb connection to qtp
Db connection to qtp
 
Examplecode
ExamplecodeExamplecode
Examplecode
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important Parts
 
Jdbc example program with access and MySql
Jdbc example program with access and MySqlJdbc example program with access and MySql
Jdbc example program with access and MySql
 
lab56_db
lab56_dblab56_db
lab56_db
 
lab56_db
lab56_dblab56_db
lab56_db
 
ES3-2020-P3 TDD Calculator
ES3-2020-P3 TDD CalculatorES3-2020-P3 TDD Calculator
ES3-2020-P3 TDD Calculator
 
Ruby and Rails by example
Ruby and Rails by exampleRuby and Rails by example
Ruby and Rails by example
 
Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)Jython: Python para la plataforma Java (EL2009)
Jython: Python para la plataforma Java (EL2009)
 
Spsl vi unit final
Spsl vi unit finalSpsl vi unit final
Spsl vi unit final
 
Spsl v unit - final
Spsl v unit - finalSpsl v unit - final
Spsl v unit - final
 
Specs2
Specs2Specs2
Specs2
 
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard LibraryHidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Library
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Introduction tomongodb
Introduction tomongodbIntroduction tomongodb
Introduction tomongodb
 
Building Your First Big Data Application on AWS
Building Your First Big Data Application on AWSBuilding Your First Big Data Application on AWS
Building Your First Big Data Application on AWS
 

QTP

  • 2. QTP Script for connecting to database(MS Access) Option Explicit Dim con,rs Set con=createobject("adodb.connection") Set rs=createobject("adodb.recordset") con.provider="microsoft.jet.oledb.4.0" con.open"d:testdata.mdb" rs.open"select*from emp",con Do while not rs.eof VbWindow("Form1").VbEdit("val1").Set rs.fields("v1") VbWindow("Form1").VbEdit("val2").Set rs.fields("v2") VbWindow("Form1").VbButton("ADD").Click rs.movenext Loop
  • 3. Database we are using here is MS Access.before running this script create a table in MS Acess. In the above script i used table called "emp" and column names as "v1" and "v2". "d:testdata.mdb" is path of the table which we created. Main use of this application is to use testdata of table(which is in database) in the application. http://www.funandknowledge.blogspot.com/
  • 4. DataDriven Testing using ExcelSheet instead of Datatable This is script for data driven using excel sheet. In this script we are not importing excel sheet to datatable.Directly values are supplied to application from excel sheet. Set ex= CreateObject("Excel.Application") Set a=ex.Workbooks.open("D:excel.xls") Set b=a.worksheets("Sheet1") dim login,pwd for i=1 to 3 login=b.Cells(i,"A").value pwd=b.Cells(i,"B").value msgbox login msgbox pwd next
  • 5. "D:excel.xls" is path of excel sheet. "sheet1"indicates sheet name in which values are present. A,B are column names in excel sheet. we have excel sheet with values as shown below in d drive. AB 12 34 56 http://www.funandknowledge.blogspot.com/
  • 6. Descriptive Programming to Create Folder in System Set obj=createobject ("scripting.filesystemobject") Set notepad=obj.createfolder("d:abc") this script will create a folder named "abc" in "d" drive. http://www.funandknowledge.blogspot.com/
  • 7. Timeout for MessageBox Script for MessageBox to disappear after particular time without clicking on ok button manually. Set a=createobject("wscript.shell") msgbox_message="Message Box will close by itself in 10seconds so dont click on OK button" msgbox_time="10" msgbox_title="Testing" a.popup msgbox_message,msgbox_time,msgbox_title Where time is in seconds. http://www.funandknowledge.blogspot.com/
  • 8. Descriptive Programming for Yahoo Login Page SystemUtil.Run"iexplore","http://www.yahoomail.com" Set g=Browser("name:=Yahoo.*").Page("title:=Yahoo.*") g.WebEdit("name:=login").Set "aaa" g.WebEdit("name:=passwd").SetSecure "bbb" g.WebButton("name:=Sign In").Click g.Link("name:=Inbox.*", "html id:=WelcomeInboxFolderLink").Click g.Link("name:=Sign Out").Click http://www.funandknowledge.blogspot.com/
  • 9. SystemUtil.Run"iexplore","http://www.yahoomail.com" statement opens yahoo login page aaa=username bbb=password For more QTP Scripts