QTP Script for Data Driven Testing using Notepad
67QTP Script
Script for data driven testing
Set f=createobject("scripting.filesystemobject")
Set f1=f.createtextfile("d://file1.txt")
f1.writeline"aaa bbb"
f1.writeline"ccc ddd"
f1.writeline"eee fff"
f1.writeline"ggg hhh"
f1.writeline"iii jjj"
The above script creates a notepad in "d" drive with name file1
aaa bbb
ccc ddd
eee fff
ggg hhh
iii jjj
values are stored in file1.txt.
Set f2=f.opentextfile("d://file1.txt")
While f2.atendofstream<>true
f3=f2.readline
x=split(f3," ")
msgbox x(0)
msgbox x(1)
Wend
The above script is used for data driven using notepad directly.here we are not importing data to excel sheet.
directly values are retreived from notepad.
we are using while loop and reading each line till the end.
split function splits the line where space(" ")occurs.
line is divided to 2 parts.one before space and other after space
for example we have 1st line in notepad as aaa bbb
here aaa is 1st part and bbb is 2nd part
x(0)=aaa
x(1)=bbb
all values are read this way using while loop.
One point to note here is if any line is empty in notepad datadriven testing is stopped before that line.
It will not proceed further.so we have to give values without any empty lines in notepad.
to make u more clear
suppose u have
aaa bbb
ccc ddd
datadriven is stopped at aaa and bbb only because next line is empty.datadriven is stopped after 1st line.
Hindi and Telugu Movie Songs Lyrics
Script for connecting to database
for more descriptive programs(qtp) check QTP Scripts
|
Metro Vacuum MDV-1BA DataVac 4.5-AMP Computer Vac/Blower
Price: $56.99
List Price: $96.50 |
|
Logitech ChillStream Gamepad for PC (963435-0403)
Price: $22.89
List Price: $39.99 |
|
Pelouze 4060 Heavy-Duty Electronic Utility Scale with PC Interface, 400-lb. Capacity
Price: $133.99
List Price: $239.00 |
|
Metra 99-6700 Dash Kit For Ford/Chry/Jeep 74-03
Price: $3.99
List Price: $12.99 |
|
12pc 1" Mini Metal Spring Clamps - Great for clipping everything!
Price: $5.99
List Price: $3.99 |
|
120mm Scythe S-Flex SFF21F 1600RPM 28dBA 63.7CFM Sony Dynamic Fluid Dynamic Bearing Ultra-Quiet PC Case Cooling Fan: SFF21F (120x120x25mm, 3/4 Pin, Retail)
Price: $11.75
|
QTP Scripts
|
Hatley Boys 2-7 Super Hero All Over Print Pajamas,Red,4T
Price: $30.00
List Price: $30.00 |
|
All
Price: $10.28
List Price: $16.98 |
|
7 For All Mankind Women's Rocker with Stone Squiggle, Vista Del Mar, 24
Price: $215.00
List Price: $215.00 |
|
All Small & Mighty, Triple Concentrated Liquid Laundry Detergent, Nine 32-Load Bottles (288-Loads)
Price: $55.24
List Price: $58.49 |
|
OGIO All Terrain Pack (Black)
Price: $39.95
List Price: $40.00 |
|
|
7 for all mankind Girls 2-6x Roxanne W Cuff Sm 610S,Manz,4
Price: $99.00
List Price: $99.00 |
|
Mass Nerder
Price: $8.10
List Price: $11.98 |
PrintShare it! — Rate it: up down flag this hub
Comments
Very good script. I a beginner. I have got more information from you.
No sumit they are not redirected to same page check them carefully.
Anyway if ur looking for other qtp scripts check this one
www.funandknowledge.blogspot.com











snigdha_123 says:
2 years ago
Thanx srinivas