OLR_Stop_Words
上一篇 / 下一篇 2012-07-19 10:04:52 / 个人分类:Backlog
This needs to be create a excel file. Format as in script.
Call load_for_TitleAndSnippet
'This function is for read from the excel for search term
Public Function load_for_TitleAndSnippet
Public Function load_for_TitleAndSnippet
FilePath = "C:\automation\OLR stop words\StopWords.xls"
DataTable.ImportSheet FilePath , "Sheet1", "Action1"
DataTable.ImportSheet FilePath , "Sheet1", "Action1"
Call open
Dim arrayT(), arrayTB(), arrayBT()
Dim sarrayT(), sarrayTB(), sarrayBT()
Dim sarrayT(), sarrayTB(), sarrayBT()
TermNum = DataTable.Value("TermNum", "Action1")
For i = 1 to TermNum
datatable.GetSheet("Action1").SetCurrentRow(i)
For i = 1 to TermNum
datatable.GetSheet("Action1").SetCurrentRow(i)
sTermT = DataTable.Value("Term","Action1")
Call load_TitlesAndSnippets(sTermT, arrayT, sarrayT)
sTermTB = DataTable.Value("TermStop","Action1")
Call load_TitlesAndSnippets(sTermTB, arrayTB, sarrayTB)
sTermBT = DataTable.Value("StopTerm","Action1")
Call load_TitlesAndSnippets(sTermBT, arrayBT, sarrayBT)
Call load_TitlesAndSnippets(sTermT, arrayT, sarrayT)
sTermTB = DataTable.Value("TermStop","Action1")
Call load_TitlesAndSnippets(sTermTB, arrayTB, sarrayTB)
sTermBT = DataTable.Value("StopTerm","Action1")
Call load_TitlesAndSnippets(sTermBT, arrayBT, sarrayBT)
Call compare_TitleAndSnippet(arrayT, arrayTB, arrayBT, sTermT, sTermTB, sTermBT, sarrayT, sarrayTB, sarrayBT)
Next
Next
Call closeIE
End function
End function
''This function is for opening the broswer
Public Function open()
Public Function open()
SystemUtil.Run "iexplore.exe", "http://srspwqbos1.fmr.com:19000/vivisimo/cgi-bin/query-meta?v%3Aproject=olr-fesco-proj&query="
Browser("name:=Vivísimo Velocity","opentitle:=Vivísimo Velocity").Page("title:=Vivísimo Velocity").Sync
Wait 3
Browser("name:=Vivísimo Velocity","opentitle:=Vivísimo Velocity").Page("title:=Vivísimo Velocity").Sync
Wait 3
End function
'This funciton is for loading titles and snippets for each term
Public Function load_TitlesAndSnippets(term1, arrayTitle, arraySnippet)
Public Function load_TitlesAndSnippets(term1, arrayTitle, arraySnippet)
Browser("opentitle:=Vivísimo Velocity").Page("micClass:=Page").WebEdit("name:=query").Set term1
Browser("opentitle:=Vivísimo Velocity").Page("micClass:=Page").WebButton("name:=Search").Click
Set Title = Description.Create()
oTitle("micClass").value = "Link"
oTitle("class").value = "title"
Set Lists = Browser("opentitle:=Vivísimo Velocity").Page("micClass:=Page").ChildObjects(oTitle)
NumberOfLists = Lists.count()
Browser("opentitle:=Vivísimo Velocity").Page("micClass:=Page").WebButton("name:=Search").Click
Set Title = Description.Create()
oTitle("micClass").value = "Link"
oTitle("class").value = "title"
Set Lists = Browser("opentitle:=Vivísimo Velocity").Page("micClass:=Page").ChildObjects(oTitle)
NumberOfLists = Lists.count()
For i = 0 to NumberOfLists - 1
linkname = Trim(Lists(i).getRoProperty("innertext")) 'remove the black
linkname = LCase(linkname) 'A to a for title
ReDim preserve arrayTitle(i)
arrayTitle(i) = linkname
Next
linkname = Trim(Lists(i).getRoProperty("innertext")) 'remove the black
linkname = LCase(linkname) 'A to a for title
ReDim preserve arrayTitle(i)
arrayTitle(i) = linkname
Next
Set Snippets = Description.Create()
oSnippets("micClass").value = "WebElement"
oSnippets("class").value = "document-snippet"
Set Lists2 = Browser("opentitle:=Vivísimo Velocity").Page("micClass:=Page").ChildObjects(oSnippets)
NumberOfLists2 = Lists2.count()
oSnippets("micClass").value = "WebElement"
oSnippets("class").value = "document-snippet"
Set Lists2 = Browser("opentitle:=Vivísimo Velocity").Page("micClass:=Page").ChildObjects(oSnippets)
NumberOfLists2 = Lists2.count()
For i = 0 to NumberOfLists2 - 1
snippet = Trim(Lists2(i).getRoProperty("innertext")) 'remove the black
snippet = LCase(snippet) 'A to a for title
ReDim preserve arraySnippet(i)
arraySnippet(i) = snippet
Next
snippet = Trim(Lists2(i).getRoProperty("innertext")) 'remove the black
snippet = LCase(snippet) 'A to a for title
ReDim preserve arraySnippet(i)
arraySnippet(i) = snippet
Next
End Function
'This function is for closing the broswer
Public Function closeIE()
Public Function closeIE()
Browser("opentitle:=Vivísimo Velocity").Close
End Function
'This function is for compare the 3 array to check each of element(i) are the same
Public Function compare_TitleAndSnippet(arrayT, arrayTB, arrayBT, sTermT, sTermTB, sTermBT, sarrayT, sarrayTB, sarrayBT)
Public Function compare_TitleAndSnippet(arrayT, arrayTB, arrayBT, sTermT, sTermTB, sTermBT, sarrayT, sarrayTB, sarrayBT)
Dim flagA
Dim flagB
Dim flagC
Dim flagD
flagA = 0
flagB = 0
flagC = 0
flagD = 0
' verify arrayT and arrayTB
If ubound(arrayT) = ubound(arrayTB) Then
For i = 0 to ubound(arrayT)
If arrayT(i) <> arrayTB(i) Then
j = i+1
reporter.ReportEvent micFail, sTermT&" the "&j&" element error ", arrayT(i)&" and "&arrayTB(i)&" are different"
End If
Next
'reporter.ReportEvent micPass, sTermT, sTermT&" and "&sTermTB&" have the same Titles"
flagA = 1
else
reporter.ReportEvent micFail, sTermT, sTermT&" and "&sTermTB&" have the different Titles number"
End If
' verify arrayT and arrayBT
If ubound(arrayT) = ubound(arrayBT) Then
For i = 0 to ubound(arrayT)
If arrayT(i) <> arrayBT(i) Then
j = i+1
reporter.ReportEvent micFail, sTermT&" the "&j&" element error", arrayT(i)&" and "&arrayBT(i)&" are different"
End If
Next
'reporter.ReportEvent micPass, sTermT, sTermT&" and "&sTermBT&" have the same Titles"
flagB = 1
else
reporter.ReportEvent micFail, sTermT, sTermT&" and "&sTermBT&" have the different Titles number"
End If
' verify sarrayT and sarrayTB
If ubound(sarrayT) = ubound(sarrayTB) Then
For i = 0 to ubound(sarrayT)
If sarrayT(i) <> sarrayTB(i) Then
j = i+1
reporter.ReportEvent micFail, sTermT&" the "&j&" element error ", sarrayT(i)&" and "&sarrayTB(i)&" are different"
End If
Next
'reporter.ReportEvent micPass, sTermT, sTermT&" and "&sTermTB&" have the same snippets"
flagC = 1
else
reporter.ReportEvent micFail, sTermT, sTermT&" and "&sTermTB&" have the different snippets number"
End If
' verify sarrayT and sarrayBT
If ubound(sarrayT) = ubound(sarrayBT) Then
For i = 0 to ubound(sarrayT)
If sarrayT(i) <> sarrayBT(i) Then
j = i+1
reporter.ReportEvent micFail, sTermT&" the "&j&" element error", sarrayT(i)&" and "&sarrayBT(i)&" are different"
End If
Next
'reporter.ReportEvent micPass, sTermT, sTermT&" and "&sTermBT&" have the same snippets"
flagD = 1
else
reporter.ReportEvent micFail, sTermT, sTermT&" and "&sTermBT&" have the different snippets number"
End If
Dim flagB
Dim flagC
Dim flagD
flagA = 0
flagB = 0
flagC = 0
flagD = 0
' verify arrayT and arrayTB
If ubound(arrayT) = ubound(arrayTB) Then
For i = 0 to ubound(arrayT)
If arrayT(i) <> arrayTB(i) Then
j = i+1
reporter.ReportEvent micFail, sTermT&" the "&j&" element error ", arrayT(i)&" and "&arrayTB(i)&" are different"
End If
Next
'reporter.ReportEvent micPass, sTermT, sTermT&" and "&sTermTB&" have the same Titles"
flagA = 1
else
reporter.ReportEvent micFail, sTermT, sTermT&" and "&sTermTB&" have the different Titles number"
End If
' verify arrayT and arrayBT
If ubound(arrayT) = ubound(arrayBT) Then
For i = 0 to ubound(arrayT)
If arrayT(i) <> arrayBT(i) Then
j = i+1
reporter.ReportEvent micFail, sTermT&" the "&j&" element error", arrayT(i)&" and "&arrayBT(i)&" are different"
End If
Next
'reporter.ReportEvent micPass, sTermT, sTermT&" and "&sTermBT&" have the same Titles"
flagB = 1
else
reporter.ReportEvent micFail, sTermT, sTermT&" and "&sTermBT&" have the different Titles number"
End If
' verify sarrayT and sarrayTB
If ubound(sarrayT) = ubound(sarrayTB) Then
For i = 0 to ubound(sarrayT)
If sarrayT(i) <> sarrayTB(i) Then
j = i+1
reporter.ReportEvent micFail, sTermT&" the "&j&" element error ", sarrayT(i)&" and "&sarrayTB(i)&" are different"
End If
Next
'reporter.ReportEvent micPass, sTermT, sTermT&" and "&sTermTB&" have the same snippets"
flagC = 1
else
reporter.ReportEvent micFail, sTermT, sTermT&" and "&sTermTB&" have the different snippets number"
End If
' verify sarrayT and sarrayBT
If ubound(sarrayT) = ubound(sarrayBT) Then
For i = 0 to ubound(sarrayT)
If sarrayT(i) <> sarrayBT(i) Then
j = i+1
reporter.ReportEvent micFail, sTermT&" the "&j&" element error", sarrayT(i)&" and "&sarrayBT(i)&" are different"
End If
Next
'reporter.ReportEvent micPass, sTermT, sTermT&" and "&sTermBT&" have the same snippets"
flagD = 1
else
reporter.ReportEvent micFail, sTermT, sTermT&" and "&sTermBT&" have the different snippets number"
End If
If flagA = 1 and flagB = 1 and flagC = 1 and flagD = 1 Then
reporter.ReportEvent micPass, sTermT, "Test Right"
else
reporter.ReportEvent micFail, sTermT, "Test Fail"
End If
End Function
reporter.ReportEvent micPass, sTermT, "Test Right"
else
reporter.ReportEvent micFail, sTermT, "Test Fail"
End If
End Function
TAG:
标题搜索
日历
|
|||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
1 | 2 | 3 | 4 | ||||||
5 | 6 | 7 | 8 | 9 | 10 | 11 | |||
12 | 13 | 14 | 15 | 16 | 17 | 18 | |||
19 | 20 | 21 | 22 | 23 | 24 | 25 | |||
26 | 27 | 28 | 29 | 30 | 31 |
我的存档
数据统计
- 访问量: 6371
- 日志数: 15
- 建立时间: 2012-07-12
- 更新时间: 2012-07-30