Saturday, November 14, 2015
Testing_Q&A
Monday, October 15, 2012
Got error while opening docx files using office 2003.
Solution: Copy below line without quotes, go to Start -> Run, paste and enter.
"regsvr32 %SystemRoot%\system32\ole32.dll"
You will get the message "DllRegisterServer in ole32.dll succeeded.", click OK
Note: You should be Administrator.
Solution: Copy below line without quotes, go to Start -> Run, paste and enter.
"regsvr32 %SystemRoot%\system32\ole32.dll"
You will get the message "DllRegisterServer in ole32.dll succeeded.", click OK
Note: You should be Administrator.
Thursday, March 17, 2011
My Fav. Firefox Addons
1. Design your Firefox using Themes:
Personalize
http://www.mozilla.com/en-US/firefox/customize/
Selenium
QuickProxy
Fire FTP
FireBug
AdBlock Plus:
Thursday, May 27, 2010
QTP VBScript tutorials
http://testersknowledge.wordpress.com/2010/01/25/advanced-qtp-tutorial-vbscript-orientation/
Friday, March 26, 2010
QTP Scripts - 4 - Ordinal Identifiers
An ordinal identifier assigns a numerical value to a test object that indicates its order or location relative to other objects with an otherwise identical description (objects that have the same values for all properties). This ordered value provides a backup mechanism that enables QuickTest to create a unique description to recognize an object when the defined properties are not sufficient to do so.
Location Ordinal Identifier
Index Ordinal Identifier
CreationTime Ordinal Identifier
Location Ordinal Identifier
Index Ordinal Identifier
CreationTime Ordinal Identifier
Thursday, March 25, 2010
QTP Scripts - 3
Parameterization
Passing parameters, through this we can pass multiple values.
We use parameterization in Data Driven Testing.
Data Driven Testing: Testing the Same operation with multiple sets of test data.
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.
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
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 Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.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
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.
A. Entering test data directly into data table and use.
Steps: Generate the basic test>open data table(View>Data Table)
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.)
Run the test.
Agent = Datatable("Agent",1)
pwd=Datatable ("Password",1)
invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.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
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.
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.
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.
1. Creating a Test Database: open MS Access (or we can use any other database).
Start programs>MS Office>MS Access>file >new>Select blank Database>enter name of the database>Save with mdb extension.
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.
Entering Data into Tables: Select table>enter the data.
Creating DSN & importing data
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.
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,"@")
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","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
Fetching Test Data directly from Excel Sheets
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 Settings\pooja\My Documents\trigun.mdb"
rs.open "select * from login",con
do until rs.eof=true
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","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
Passing parameters, through this we can pass multiple values.
We use parameterization in Data Driven Testing.
Data Driven Testing: Testing the Same operation with multiple sets of test data.
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.
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
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 Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.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
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.
A. Entering test data directly into data table and use.
Steps: Generate the basic test>open data table(View>Data Table)
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.)
Run the test.
Agent = Datatable("Agent",1)
pwd=Datatable ("Password",1)
invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.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
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.
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.
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.
1. Creating a Test Database: open MS Access (or we can use any other database).
Start programs>MS Office>MS Access>file >new>Select blank Database>enter name of the database>Save with mdb extension.
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.
Entering Data into Tables: Select table>enter the data.
Creating DSN & importing data
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.
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,"@")
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","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
Fetching Test Data directly from Excel Sheets
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 Settings\pooja\My Documents\trigun.mdb"
rs.open "select * from login",con
do until rs.eof=true
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","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
QTP Scripts - 2
1) Count all opened Browsers on desktop and close them all?
Set oDesc = Description.Create()
oDesc("micclass").Value = "Browser"
Set Browsers =Desktop.ChildObjects (oDesc)
NumberofBrowsers = Browsers.Count()
Reporter.ReportEvent 2,"Res","Number of Browsers are: "&NumberOfBrowsers
For Counter=0 to NumberofBrowsers-1
Browsers(Counter).Close
Next
2) Count, how many links available in Mercury Tours Home Page.
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Lists = Browser("Welcome: Mercury").Page("Welcome: Mercury").ChildObjects (oDesc)
NumberOfLinks = Lists.Count()
Reporter.ReportEvent 2,"Res","Number of Links are: "&NumberOfLinks
Set oDesc = Description.Create()
oDesc("micclass").Value = "Browser"
Set Browsers =Desktop.ChildObjects (oDesc)
NumberofBrowsers = Browsers.Count()
Reporter.ReportEvent 2,"Res","Number of Browsers are: "&NumberOfBrowsers
For Counter=0 to NumberofBrowsers-1
Browsers(Counter).Close
Next
2) Count, how many links available in Mercury Tours Home Page.
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Lists = Browser("Welcome: Mercury").Page("Welcome: Mercury").ChildObjects (oDesc)
NumberOfLinks = Lists.Count()
Reporter.ReportEvent 2,"Res","Number of Links are: "&NumberOfLinks
Subscribe to Posts [Atom]