Qtp+real time+test+script
Upcoming SlideShare
Loading in...5
×
 

Qtp+real time+test+script

on

  • 4,076 views

 

Statistics

Views

Total Views
4,076
Views on SlideShare
4,076
Embed Views
0

Actions

Likes
2
Downloads
332
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Qtp+real time+test+script Qtp+real time+test+script Document Transcript

  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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