這對我很有幫助,如果任何人都可以提供給我一個關於以下問題的想法。 我有一個場景,我的腳本將逐行執行每個測試步驟,對於每個測試步驟,它都會在html結果頁面中報告通過和失敗結果。 如果測試步驟結果爲合格,則將繼續進行下一個測試步驟。 類似地,失敗的情況下,它進入下一個測試步驟並執行它。 當腳本失敗時可以停止腳本嗎?當它失敗時可以停止vb腳本(在QTP中)嗎?
下面是示例大綱腳本
Call webEdit_check (「google」,」google」,」nametxtbox」,」xxxx」)
Call Link_check (strbrowser,strpage,strlink)
Call WebButton_check (strbrowser,strpage,strWebbutton)
所以根據上面的腳本,它會調用webEdit功能,並檢查對象是否顯示可見,並且將進入webEdit文本框,結果值將被寫入爲合格在html結果中,如果所有條件都滿足。 完成上述功能後,現在會調用鏈接函數並啓動執行,同時會檢查是否顯示對象,如果成功,將進入下一步。讓我們假設鏈接不可見,這裏這個函數的第二步失敗,所以結果寫成失敗,第三個函數的執行開始(調用WebButton_check)。我需要的是整個執行應該停止,因爲之前的測試步驟失敗了。是否有任何功能在後端運行,以停止執行?當測試步驟失敗時?有沒有解決我的問題? (請注意,我有多種方案,以便「退出測試/退出鍵功能」是不適用的。) 函數是
webEdit_check
Function webEdit_check(strbrowser,strpage,strwebEdit,strvalue)
Testobject=Browser(strbrowser).Page(strpage).WebEdit(strlink)
If Testobject.exist(10) Then
blnvisible= testobject.getRoproperty(visible)
If blnvisible =True Then
Testobject.set strvalue
Environment.value(result)=pass
‘It will write result to html page
Call html (「test step is success」,Environment(result))
Else
Environment.value(result)=fail
Call html (「test step is fail」,Environment(result))
End If
Else
Environment.value(result)=fail
Call html (「test object is not visible fail」,Environment(result))
End If
End Function
webEdit_check
Function webEdit_check(strbrowser,strpage,strLink)
Testobject=Browser(strbrowser).Page(strpage).Link(strlink)
If Testobject.exist(10) Then
blnvisible= testobject.getRoproperty(visible)
If blnvisible =True Then
Testobject.click
Environment.value(result)=pass
‘It will write result to html page
Call html (「test step is success」,Environment(result))
Else
Environment.value(result)=fail
Call html (「test step is fail」,Environment(result))
End If
Else
Environment.value(result)=fail
Call html (「test object is not visible fail」,Environment(result))
End If
End Function
WebButton_check
Function WebButton_check(strbrowser,strpage,strWebButton)
Testobject=Browser(strbrowser).Page(strpage).WebButton(strWebButton)
If Testobject.exist(10) Then
blnvisible= testobject.getRoproperty(visible)
If blnvisible =True Then
Testobject.click
Environment.value(result)=pass
‘It will write result to html page
Call html (「test step is success」,Environment(result))
Else
Environment.value(result)=fail
Call html (「test step is fail」,Environment(result))
End If
Else
Environment.value(result)=fail
Call html (「test object is not visible fail」,Environment(result))
End If
End Function
(strverify,結果)
Function (strverify,Result)
If Environment(result)=pass Then
Td.write(<td(strverify)/>td<xxx><td(Result)/>td)
'(please note this is sample, which I typed, it’s just for concept)
Else
Td.write(<td(strverify)/>td<xxx><td(Result)/>td)
End If
End Function
如果可能的話,請發郵件([email protected])我的解決方案,在我的辦公室,我已經到網站以外的機會有限。我無法立即檢查。這個問題我已經被通過了20天。 感謝&方面的 Jagadeesh瑪尼 [email protected]