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
How to automate a script in mainframes environment? I have the terminal emulator Add in. Describe in detail.
For which type of projects the iterative model is not suitable?
Explain the types of object repository?
Hoe can we do retesting using functions please give the code for it using login page
if numbers are always changing write a script for that
describe some problems that u had with automating testing tool?
How can I change object description or check point values in qtp?
If I change the property value at runtime is it effect is object repository?
What is the script for database check point, bitmapchek point, regular expression ?
1.How to record ,capture and also script to capture the close buttons. 2.How to record ,capture and also script to capture the options ---File ->save and File ->close in a browser and PDF files. 3.How to compare the Excel sheet values in a report using QTP scripting. 4.How to compare 2 PDf reports using QTP scripts as well reording. 5.How to compare 2 Excel reports using QTP scripts as well reording. 6.How to save a PDF report to a folder and then translate the report to an Excel type of report and compare that Excel Report with an other excel report. Please clarify me
How you know that a test case is a regression test case
What is Test Fusion Report in QTP?
Tell some commonly used Excel VBA functions?
Does quicktest professional (qtp) is unicode compatible?
Explain quicktest professional testing process?