以下是我们的3层QTP框架的设计。我的问题是
Master Driver Script – Tier1
Function Master ()
‘Take the contents of the excel sheet which stores the path of the test scrip to be executed, status, start time and end time in a record set
Do While Not oRecSet.EOF
dicResultSet.Add rCnt, CreateObject (“Scripting.Dictionary”)
For Each oField In oRecSet.Fields
dicResultSet (rCnt).Add oField.Name, oField.Value
‘Execute individual scripts
If oField.Name = “Path” Then
msQTPapp.Open oField.Value, True
Set qtTestScript = msQTPapp.Test
qtTestScript.Settings.Run.OnError = "NextStep"
strStartTime = Now
qtTestScript.Run
qtTestScript.Close
strEndTime = Now
End If
‘Write the status of the last run script in the dictionary object
If oField.Name = “Status” Then
dicResultSet (rCnt).Item (“Status”)=_ qtTestScript.LastRunResults.Status
End If
‘Write the start time of the last run script in the dictionary object
If oField.Name = “StartTime” Then
icResultSet (rCnt).Item (“StartTime”) = strStartTime
End If
‘Write the end time of the last run script in the dictionary object
If oField.Name = “EndTime” Then
dicResultSet (rCnt).Item (“EndTime”) = strEndTime
qtTestScript = Nothing
End If
Next
oRecSet.MoveNext
rCnt= rCnt+1
Loop
'Write the status, start time and end time of the individual test scripts in an excel sheet
'Close the rec set and connection
End Function
Test Script: Action – Tier2
‘Associate the individual test script with Environmental files, OR and other function library
Function Test1 ()
‘Call L1 from Function lib
‘Call L2 from Function lib
End Function
Function Library– Tier3
Function L1()
‘Actual task is getting done here
End Function
.
.
Function Ln()
‘Actual task is getting done here
End Function
答案 0 :(得分:0)
我将关注问题1.如果您想问其他问题,请提出两个问题。然而,我担心,由于过于宽泛或主要以意见为基础,它们将被关闭。
简短回答:是。
通过AOM调用的测试可以退出,例如使用ExitTest
,而调用者确实可以继续执行另一个测试。这与完全没有明确退出的测试完全相同,只是执行正常的执行流程,然后优雅地终止。
即使测试由于运行时错误而中止,调用者脚本也会重新获得控制权,并且可以像成功运行测试后一样继续。