Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

pls tell me how will you write the vb script in QTP for
DataDriven test from Excel sheet for multiple userid and
password explain with example

Answer Posted / deven

'Data driven Frame work script
Option Explicit
'define constants for web URL and browser name
executefile "C:\TestAutomation\openTAPS\Lib\Constants.vbs"
executefile "C:\TestAutomation\Common\Lib\UtilityFunctions.v
bs"
executefile "C:\TestAutomation\Common\Lib\SendingEmail.vbs"
executefile "C:\TestAutomation\openTAPS\Classes\Functions.vb
s"
'declare variables
Dim iRowcount, i, Username, Password
'
datatable.AddSheet("dtInvalidLogin")
'ValidLogin is the sheet name
datatable.ImportSheet "C:\TestAutomation\openTAPS\Data\TestD
ata.xls", "InValidLogin", "dtInvalidLogin"

'Get row count from datatable
iRowcount = datatable.GetSheet("dtInvalidLogin").GetRowCount

For i = 1 to iRowcount

'functions
OpenApp()

'set username and password
Username = trim(datatable.Value
("Username", "dtInvalidLogin"))
Password = trim(datatable.Value
("Password", "dtInvalidLogin"))

Login Username, Password

'Verification: check username should display on home page
If Browser("opentaps CRM").Page("opentaps CRM").WebElement
("DemoCSR").GetROProperty("outertext")=Username Then
'object.method to report events in HP Run Results
Viewer that Login is successful or not
'EventStatus - micPass shows under Results
'StepName - ValidLogin shows under Object
'UserName Login Successful shows under Details
reporter.ReportEvent micPass, "ValidLogin",
Username& " Login not successful"
WriteToFile "C:\QTP\TestAutomation\openTAPS\Logs\Tes
tResults.txt", Username & " Login successful"
Else
reporter.ReportEvent micFail, "ValidLogin",
Username& " Login successful"
WriteToFile "C:\QTP\TestAutomation\openTAPS\Logs\Tes
tResults.txt", Username & " Login not successful"
End If

'Logout
Browser("My Home | opentaps CRM").Page("My Home | opentaps
CRM").Link("Logout").Click @@ hightlight id_;_Browser("My
Home | opentaps CRM").Page("My Home | opentaps CRM").Link
("Logout")_;_script infofile_;_ZIP::ssf1.xml_;_

'close app
CloseApp()

datatable.SetNextRow
Next
'Gmail
SendMail "21deven@gmail.com", "jinideveloper@gmail.com", "QT
PTest Results", "Please find my qtp test results"
'Outlook
'SendMail("21deven@gmail.com", "QTPTest Results", "Please
find my qtp test
results" , "C:\QTP\TestAutomation\openTAPS\Logs\TestResults.
txt")

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you brief the hurdles you faced during Automation testing?

985


how do u manipulating INI, DLL and / or registry files in support of your test environment? actually what do u mean by INI and DLL or registry files. plzzz its urgent do answer

1942


Can we access the java methods in qtp. Because my requirement is to access the swt(for eclipse an it is java code) methods in qtp is it possible?

1956


is it possible to add sheets to excel at runtime

3946


How to use the object spy in quicktest professional (qtp) 8.0 version?

900


How is test case write?

974


What are the two types of repositories available, explain them?

969


How can i use virtual objects? If have i created one new virtual object in a virtual object manager by following instructions.

1870


Hi am New to Automation Testing , any one can you help me what are the basic questiion are asked an interview?

1851


Can an action have 2 shared object repositories associated with them? In that case, if two of them contain the same object, which one will be considered?

1030


how to i add the values using the check points property?( i.e valid data(for valid data it's giving the footer message:value is added) and for invalid data: special chars, spaces,Duplicates and null values (in my page when ever we enter special chars, spaces and null values, it's giving the proper warning message and for Duplicates it's giving the footer message:"value already exists)?

1838


How to find the difference between 2 dates in qtp?

990


Analyzing the checpoint results?

978


Explain how you can find length of array in qtp?

1003


How do Parameterization and Data-Driving relate to each other in QTP?

1011