How do you done Data-Driven Testing using MS-Word. What is
the script for that

Answers were Sorted based on User's Feedback



How do you done Data-Driven Testing using MS-Word. What is the script for that..

Answer / rajani

option explicit
dim fso,f,n
set fso=createobject("Scripting.filesystemobject")
set f=fso.opentextfile("path of the word document",1,false)

while(f.atendoflen<>true)'reading the word doc.
n=f.readline 'retrive the data from doc.line by line
wend.

Is This Answer Correct ?    3 Yes 2 No

How do you done Data-Driven Testing using MS-Word. What is the script for that..

Answer / prashanth chenna

Hai friends,
What is the script above is absolutly correct. in script,
in 4th line 1--> Read mode of file
2--> Write mode of file
8--> Append mode of file
True--> New file creation when specified file doesnot exist
False--> QTP is not responsible when specified file doesnot
exist
in 6th line
f.atendofline--> the end of file content

this script not only for MS.Word also for Notepad ie for
Flat files.

Is This Answer Correct ?    1 Yes 1 No

How do you done Data-Driven Testing using MS-Word. What is the script for that..

Answer / sunitha

Hi,

I tried the steps given above, but it displays only in
terms of ASCII. could you please give me the correction.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

Can anyone please tell me how to select next 5th business date from calendar using QTP/UFT ?

1 Answers   Cigniti Technologies,


can u explain the keyword driven framework with an example clearly how to create all the files and how to attach to main test.

2 Answers   AppLabs,


I have to automate webpage. If I click one hyperlink2 it will take 2 hrs to open. How to automate hyperlink2?

4 Answers   Cap Gemini, Polaris,


can we test an windows application using qtp

1 Answers  


How do you script a nested loop in QTP? I am showing a snipet of my code. Any suggestions to help me get this to work would be great appreciated! STEP A - Customer Number: No loop - ISBN: Loop STEP B - Customer Number: Loop - ISBN: Nested Loop Here is the code I am using now. I am using i for the loop and j for the nested loop in STEP B of my script. =========================================== 'CREATE AN ADDITIONAL CUSTOMER Dim myNum, RowNum, RowCnt2, val2, total, i DataTable.ImportSheet "C:\QOE Data - UAT1.xls" ,"Data" ,"Global" RowCnt2 = DataTable.GetRowCount i = 1 DataTable.SetCurrentRow(i) ' Set row to one Do while Not i > RowCnt2 i=i+1 DataTable.SetNextRow MsgBox Datatable.Value("Customer_Num") Msgbox i Msgbox RowCnt2 If Not i > RowCnt2 then val2=datatable.Value("Customer_Num","Global") OracleFormWindow("Sales Order").SelectMenu "File->New" OracleFormWindow("Sales Order").OracleTabbedRegion("Order Information").OracleTextField("Customer Number").SetFocus OracleFormWindow("Sales Order").OracleTabbedRegion("Order Information").OracleTextField("Customer Number").Enter val2 End If 'CREATE SECOND ISBN LIST DataTable.ImportSheet "C:\QOE Data - UAT1.xls" ,"Data" ,"Global" Dim j, RowCnt3, val3 RowCnt3 = DataTable.GetRowCount For j = 1 To RowCnt3 DataTable.SetCurrentRow(i) ' datatable.getSheet("DataTable").setNextRow If Trim(DataTable("ISBN",dtGlobalSheet)) = "" Then j = j - 1 Exit For End If Next 'Define ISBN rows If RowCnt3 <> j Then RowCnt3 = j End If 'Loop through ISBN rows For j = 1 To RowCnt3 DataTable.SetCurrentRow(i) val3 = Datatable.Value("ISBN","Global") msgbox j If j = 1 Then OracleFormWindow("Sales Order").OracleTabbedRegion("Line Items").OracleTextField("Ordered Item").SetFocus OracleFormWindow("Sales Order").OracleTabbedRegion("Line Items").OracleTextField("Ordered Item").Enter val3 else If j < 16 Then OracleFormWindow("Sales Order").OracleTabbedRegion("Line Items").OracleTextField("Ordered Item_"&i).SetFocus OracleFormWindow("Sales Order").OracleTabbedRegion("Line Items").OracleTextField("Ordered Item_"&i).Enter val3 else If RowCnt1 => 16 Then OracleFormWindow("Sales Order").OracleTabbedRegion("Line Items").OracleTextField("Ordered Item_15").SetFocus OracleFormWindow("Sales Order").OracleTabbedRegion("Line Items").OracleTextField("Ordered Item_15").InvokeSoftkey "DOWN" OracleFormWindow("Sales Order").OracleTabbedRegion("Line Items").OracleTextField("Ordered Item_15").SetFocus OracleFormWindow("Sales Order").OracleTabbedRegion("Line Items").OracleTextField("Ordered Item_15").Enter val3 end if end if End If Next 'EXIT APP msgbox i loop Browser("Browser").Page("Oracle Applications 11i").Sync Browser("Browser").Close ========================================== It isn't working correctly in my nested loop in STEP B (for ISBN). Any ideas?? Thanks! SBsteve

0 Answers  






To which environments does QTP supports ?

1 Answers  


How we can call the scripit from another scripit in QTP?,Not a call Action

12 Answers  


What is the Maximum syncronization timeout in seconds in QTP 9.5

5 Answers   Polaris,


How to connect to the Database from QTP?

10 Answers   DB, Thatavarti Technologies, Xchanging,


Can u call winRunner scripts from QTP?

4 Answers  


how do u handle an object without name using QTP 9.2?

0 Answers   CTS,


How can you quit from Action.

2 Answers  


Categories