Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
For more QTP Real time scripts, visit www.ramupalanki.com                           QTP Scripts###########################...
For more QTP Real time scripts, visit www.ramupalanki.com#################################################################...
For more QTP Real time scripts, visit www.ramupalanki.comscomputername=wshnetwork.computernameset wshnetwork=nothingstrSer...
For more QTP Real time scripts, visit www.ramupalanki.comClear the cookies and temp filesCall ClearCookies________________...
For more QTP Real time scripts, visit www.ramupalanki.comrecordset.CursorType = 0 Execute the queryrecordset.Open sql, dbc...
For more QTP Real time scripts, visit www.ramupalanki.com     state = recordset.Fields("state")&""     msgbox state     cr...
For more QTP Real time scripts, visit www.ramupalanki.com Date and Start Time of the test runstrDate = datestrStartTime = ...
For more QTP Real time scripts, visit www.ramupalanki.comstrGarageCheck = Instr(strPropInfo, "Lot size is 100 or more acre...
For more QTP Real time scripts, visit www.ramupalanki.comBrowser("Real Estate Listings,_5").Page("Real EstateListings,").W...
For more QTP Real time scripts, visit www.ramupalanki.comBrowser("Real Estate Listings,_5").Page("Real EstateListings,").W...
For more QTP Real time scripts, visit www.ramupalanki.comBrowser("Real Estate Listings,_5").Page("Real EstateListings,").W...
For more QTP Real time scripts, visit www.ramupalanki.comBrowser("Real Estate Listings,_5").Page("Real EstateListings,").W...
For more QTP Real time scripts, visit www.ramupalanki.comodesc("html tag").value="DIV"odesc("class").value="listingData"Se...
For more QTP Real time scripts, visit www.ramupalanki.comodesc("html tag").value="DIV"odesc("class").value="listingData"Se...
For more QTP Real time scripts, visit www.ramupalanki.comBrowser("Real Estate Listings,_5").Page("Real EstateListings,").W...
For more QTP Real time scripts, visit www.ramupalanki.com         Else                strFail = 1End IfIf strFail= 0 Then ...
For more QTP Real time scripts, visit www.ramupalanki.com_________________________________________________________________...
Upcoming SlideShare
Loading in …5
×

Qtp+real time+test+script

5,536 views

Published on

  • Be the first to comment

Qtp+real time+test+script

  1. 1. For more QTP Real time scripts, visit www.ramupalanki.com QTP Scripts####################################################################################################################################### Test Name: 2Step_1orMoreAcres_Attribute_145_100orMoreAcres# ## Created by: Sam Harris### Purpose: Verify the 145 Lot Size is 100 or More Acres atttribute in the 1 or MoreAcres Scenario### Creation Date: 1/11/2010www.ramupalanki.com
  2. 2. For more QTP Real time scripts, visit www.ramupalanki.com####################################################################################################################################======================= SETUP=======================____________________________________________________________________________________________________________________________________Dim objNetDim strInfo____________________________________________________________________________________________________________________________________Set the initial value of the variablesi=1msgnum = 0strFail = 1strTestName = "2Step_1orMoreAcres_Attribute_145_100orMoreAcres"____________________________________________________________________________________________________________________________________Function to open a brower and go to a specified URLFunction OpenBrowser (browser, URL) systemUtil.Run browser, URLEnd Function____________________________________________________________________________________________________________________________________Get Computer Nameset wshnetwork=createobject("wscript.network")www.ramupalanki.com
  3. 3. For more QTP Real time scripts, visit www.ramupalanki.comscomputername=wshnetwork.computernameset wshnetwork=nothingstrServ = scomputernamemsgbox strServ____________________________________________________________________________________________________________________________________Turn off the report filterCurrentMode = Reporter.FilterReporter.Filter = rfDisableAll____________________________________________________________________________________________________________________________________Get username from the local boxSet objNet = CreateObject("WScript.NetWork")strInfo = objNet.UserNamemsgbox strInfo____________________________________________________________________________________________________________________________________Create a unique name for the results file each time the test is executed.mypath ="taz02mon901MercuryQTP_Test_Results2Step_1orMoreAcres_Attribute_145_100orMoreAcres.html" Call CreateFiles()____________________________________________________________________________________________________________________________________ Set Excel File to be appencedstrDataSheet = "taz02mon901MercuryMercury_QTP_TestRealtor2-Step2STEP_ATTRIBUTES_FAILURE_LOG_QA.xls"____________________________________________________________________________________________________________________________________www.ramupalanki.com
  4. 4. For more QTP Real time scripts, visit www.ramupalanki.comClear the cookies and temp filesCall ClearCookies____________________________________________________________________________________________________________________________________======================= MAIN=======================____________________________________________________________________________________________________________________________________Database query Connect to the Realtor databaseSet dbconn = CreateObject("ADODB.Connection")Set recordset = CreateObject("ADODB.recordset")MS SQL Server DSNless connectiondbconn.Open("Driver={SQL Server};Server=TAZ02SQL832 ;Database=XProperty;Uid=admin;Pwd=admin")dbconn.Open("Driver={SQL Server};Server=TAZ02SQL832;Database=XProperty")dbconn.commandTimeout = 300 Specify the querysql = "select top 1l.listingid,l.postalcode,l.marketingtypeid,l.listingtypeid,l.bedrooms,l.bathrooms,l.listingsqft,l.price,l.address,l.city,l.state,l.createdate,l.geoapproximation from xproperty.dbo.listing(nolock) l join xproperty.dbo.LISTING_ATTRIBUTE (nolock) la1 on l.listingid = la1.listingidleft join xproperty.dbo.LISTING_ATTRIBUTE (nolock) la2 on l.listingid = la2.listingid andla2.attributeid in (144,146,147,150,152,154,159,161,166) where l.status = a andl.agentid is not null and l.postalcode is not null and l.postalcode <> and l.country = usaand la1.attributeid = 145 and l.geoapproximation = 1 and l.DataSourceID not in (selectdatasourceid from xproperty.dbo.DATA_SOURCE_ATTRIBUTE where attributeid in (27,31))and la2.ListingID is null and l.createdate < getdate() - 2 order by l.createdate desc" Set the recordset cursor typewww.ramupalanki.com
  5. 5. For more QTP Real time scripts, visit www.ramupalanki.comrecordset.CursorType = 0 Execute the queryrecordset.Open sql, dbconn listingid = recordset.Fields("listingid")&"" listingid = Trim(listingid) msgbox listingid postalcode = recordset.Fields("postalcode")&"" msgbox postalcode marketingtypeid = recordset.Fields("marketingtypeid")&"" msgbox marketingtypeid listingtypeid = recordset.Fields("listingtypeid")&"" msgbox listingtypeid bedrooms = recordset.Fields("bedrooms")&"" msgbox bedrooms bathrooms = recordset.Fields("bathrooms")&"" msgbox bathrooms listingsqft = recordset.Fields("listingsqft")&"" msgbox listingsqft price = recordset.Fields("price")&"" msgbox price address = recordset.Fields("address")&"" msgbox address city = recordset.Fields("city")&"" msgbox citywww.ramupalanki.com
  6. 6. For more QTP Real time scripts, visit www.ramupalanki.com state = recordset.Fields("state")&"" msgbox state createdate = recordset.Fields("createdate")&"" msgbox createdateIf bedrooms = "" Then Do Nothing Else If bedrooms >5 Then bedrooms = 5 End IfEnd Ifbathrooms = fix(bathrooms)If bathrooms = "" Then Do Nothing Else If bedrooms >5 Then bedrooms = 5 End IfEnd IfIf listingtypeid = 6 Then bedrooms = "" bathrooms = ""End If____________________________________________________________________________________________________________________________________www.ramupalanki.com
  7. 7. For more QTP Real time scripts, visit www.ramupalanki.com Date and Start Time of the test runstrDate = datestrStartTime = time____________________________________________________________________________________________________________________________________Open a browser to the REALTOR.com homepageOpenBrowser "iexplore.exe", "http://qap.www.realtor.com/"wait (3)____________________________________________________________________________________________________________________________________Find the listingBrowser("Real Estate Listings,").WinEdit("Edit").Check CheckPoint("Edit_8")Browser("Real Estate Listings,").Navigate ("http://qap.www.realtor.com/prop/"&listingid)Browser("Real Estate Listings,").SyncstrView = "LDP"____________________________________________________________________________________________________________________________________Check for the text office on the LDPBrowser("Real Estate Listings,_5").Page("2275 Youngman AveUnit:").WebElement("Property Information for").Check CheckPoint("Property Informationfor 2275 Youngman Ave Unit: 108W Save Listing Property FeaturesCondo/Townhome/RowHome/Co-OpStatus: Active Area: SP-Highland Area County: RAMSEYYear Built: 1980 1total bedroom(s) 2 total bath(s) Approximately 1130 sq. ft.Style: High Rise (4+ Levels)Office 1 car garage School District: St. Paul Exterior FeaturesHeated garage ListingInformationRefreshed at 9:35 AM PT (19 days ago)Added on Jun 29, 2004 (1940 daysago) To access this page directly, usehttp://qap.www.realtor.com/realestateandhomes-detail/2275-Youngman-Ave-Unit-108W_St-Paul_MN_55116_1038274619 This listing isbrokered byEdina Realty, Inc.Office: (651)698-2434")strPropInfo = Browser("Real Estate Listings,_5").Page("2275 Youngman AveUnit:").WebElement("Property Information for").GetROProperty("innertext")msgbox strPropInfowww.ramupalanki.com
  8. 8. For more QTP Real time scripts, visit www.ramupalanki.comstrGarageCheck = Instr(strPropInfo, "Lot size is 100 or more acres")msgbox strGarageCheckIf strGarageCheck <> 0 Then msgbox "Pass" Else msgbox "Fail" strEndTime = time Call AppendXL msgnum = msgnum+1 Browser("Real Estate Listings,_5").Page("2275 Youngman AveUnit:").Sync Browser("Real Estate Listings,_5").Close Call SendMail ExitTestEnd If____________________________________________________________________________________________________________________________________Close the browserBrowser("Real Estate Listings,_5").Page("2275 Youngman Ave Unit:").SyncBrowser("Real Estate Listings,_5").Close____________________________________________________________________________________________________________________________________Open a browser to the REALTOR.com homepageOpenBrowser "iexplore.exe", "http://qap.www.realtor.com/"wait (3)___________________________________________________________________________________________________________________________________www.ramupalanki.com
  9. 9. For more QTP Real time scripts, visit www.ramupalanki.comBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebEdit("srchHomeLocation").Set postalcodeBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebRadioGroup("ctl00$cphC$MainSearch$ccBuyRen").Select marketingtypeidBrowser("Real Estate Listings,_5").Page("Real Estate Listings,").WebElement("MoreSearch Options").FireEvent "onmouseover"Browser("Real Estate Listings,_5").Page("Real Estate Listings,").WebElement("MoreSearch Options").ClickBrowser("Real Estate Listings,_5").Page("Real Estate Listings,").WebEdit("tbMinPrice").SetpriceBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebEdit("tbMaxPrice").Set priceBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebList("ctl00$cphC$AdvancedSearchPage$_2").Select bedrooms&"+"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebList("ctl00$cphC$AdvancedSearchPage$_3").Select bathrooms&"+"If marketingtypeid = 2 ThenBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebElement("WebElement").FireEvent "onmouseover"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebRadioGroup("ctl00$cphC$AdvancedSearchPage$").FireEvent"onmouseover"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebRadioGroup("ctl00$cphC$AdvancedSearchPage$").Select "2"wait (3)End IfIf listingtypeid = 1 ThenBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$").Set "ON"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_2").Set "OFF"www.ramupalanki.com
  10. 10. For more QTP Real time scripts, visit www.ramupalanki.comBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_4").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_5").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_6").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_7").Set "OFF"ElseIf listingtypeid = 2 ThenBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_2").Set "ON"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_4").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_5").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_6").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_7").Set "OFF"ElseIf listingtypeid = 4 ThenBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_2").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_4").Set "ON"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_5").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_6").Set "OFF"www.ramupalanki.com
  11. 11. For more QTP Real time scripts, visit www.ramupalanki.comBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_7").Set "OFF"ElseIf listingtypeid = 3 ThenBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_2").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_4").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_5").Set "ON"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_6").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_7").Set "OFF"ElseIf listingtypeid = 5 ThenBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_2").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_4").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_5").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_6").Set "ON"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_7").Set "OFF"ElseIf listingtypeid = 6 ThenBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$").Set "OFF"www.ramupalanki.com
  12. 12. For more QTP Real time scripts, visit www.ramupalanki.comBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_2").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_4").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_5").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_6").Set "OFF"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebCheckBox("ctl00$cphC$AdvancedSearchPage$_7").Set "ON"End IfBrowser("Real Estate Listings,").Page("Real Estate Listings,_3").Link("Lot &Community").FireEvent "onmouseover"Browser("Real Estate Listings,").Page("Real Estate Listings,_3").Link("Lot &Community").ClickBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebList("ctl00$cphC$AdvancedSearchPage$_5").FireEvent "onmouseover"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebList("ctl00$cphC$AdvancedSearchPage$_5").ClickBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebList("ctl00$cphC$AdvancedSearchPage$_5").Select "1 or More Acres"Browser("Real Estate Listings,_5").Page("Real Estate Listings,").Link("Search").ClickBrowser("Real Estate Listings,_5").Sync___________________________________________________________________________________________________________________________________Select ListviewBrowser("Real Estate Listings,_5").Page("55116 real estate &55116").WebElement("WebElement_2").ClickstrView = "List"Set odesc=description.Create()odesc("micclass").value="WebElement"www.ramupalanki.com
  13. 13. For more QTP Real time scripts, visit www.ramupalanki.comodesc("html tag").value="DIV"odesc("class").value="listingData"Set childObjs= Browser("Real Estate Listings,").Page("55116 real estate &55116").ChildObjects(odesc)strResults = childObjs.countmsgbox strResultsIf strResults <> 0 Then Call Listcheck Else strFail = 1End IfIf strFail= 0 Then Do Nothing Else strEndTime = time Call AppendXL msgnum = msgnum+1End If___________________________________________________________________________________________________________________________________Select GalleryviewBrowser("Real Estate Listings,_5").Page("55116 real estate &55116").WebElement("WebElement_4").ClickstrView = "Gallery"Set odesc=description.Create()odesc("micclass").value="WebElement"www.ramupalanki.com
  14. 14. For more QTP Real time scripts, visit www.ramupalanki.comodesc("html tag").value="DIV"odesc("class").value="listingData"Set childObjs= Browser("Real Estate Listings,").Page("55116 real estate &55116").ChildObjects(odesc)strResults = childObjs.countmsgbox strResultsIf strResults <> 0 Then Call Gallerycheck Else strFail = 1End IfIf strFail= 0 Then Do Nothing Else strEndTime = time Call AppendXL msgnum = msgnum+1End If___________________________________________________________________________________________________________________________________Select MapviewBrowser("Real Estate Listings,").Page("55116 real estate &55116").Image("REALTOR.com® - Official").ClickBrowser("Real Estate Listings,").SyncBrowser("Real Estate Listings,").Page("Real Estate Listings,_3").WebElement("MoreSearch Options").ClickIf marketingtypeid = 2 Thenwww.ramupalanki.com
  15. 15. For more QTP Real time scripts, visit www.ramupalanki.comBrowser("Real Estate Listings,_5").Page("Real EstateListings,").WebElement("WebElement").FireEvent "onmouseover"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebRadioGroup("ctl00$cphC$AdvancedSearchPage$").FireEvent"onmouseover"Browser("Real Estate Listings,_5").Page("Real EstateListings,").WebRadioGroup("ctl00$cphC$AdvancedSearchPage$").Select "2"wait (3)End IfBrowser("Real Estate Listings,").Page("Real Estate Listings,_3").Link("DisplayOptions").ClickBrowser("Real Estate Listings,").Page("Real EstateListings,_3").WebRadioGroup("ccViewResults").Select "map"Browser("Real Estate Listings,").Page("Real Estate Listings,_3").Link("Search").ClickBrowser("Real Estate Listings,").Syncwait (10)strView = "Map"Browser("Real Estate Listings,").Page("55116 real estate &55116").WebElement("WebElement_3").Check CheckPoint("WebElement_2")Set odesc=description.Create()odesc("micclass").value="WebElement"odesc("html tag").value="DIV"odesc("class").value="listingData"Set childObjs= Browser("Real Estate Listings,").Page("55116 real estate &55116").ChildObjects(odesc)strResults = childObjs.countmsgbox strResultsIf strResults <> 0 Then Call Mapcheckwww.ramupalanki.com
  16. 16. For more QTP Real time scripts, visit www.ramupalanki.com Else strFail = 1End IfIf strFail= 0 Then Do Nothing Else strEndTime = time Call AppendXL msgnum = msgnum+1End If____________________________________________________________________________________________________________________________________Close the browserBrowser("Real Estate Listings,_5").Page("2275 Youngman Ave Unit:").SyncBrowser("Real Estate Listings,_5").Close____________________________________________________________________________________________________________________________________ If msgnum = 0 Then intRunStatusID = 1 else intRunStatusID = 0 End If____________________________________________________________________________________________________________________________________Test Run End TimestrEndTime = timewww.ramupalanki.com
  17. 17. For more QTP Real time scripts, visit www.ramupalanki.com____________________________________________________________________________________________________________________________________Call UpdateRun____________________________________________________________________________________________________________________________________Determine which email sub to use based on Pass or FailIf intRunStatusID = 1 Then Call SendMail else Call SendMailEnd Ifwww.ramupalanki.com

×