三.组件命令处理
例子:T LoginWindow LoginWindow VerfyProperty Caption ^title
1) 打开StepDriver.SBL文件
2) 定位到SDStepDriver函数,根据记录类型调用SDProcessTestRecord函数处理
函数片断:
Select Case RecordType
Case DDU_DRIVER_COMMAND, DDU_DRIVER_COMMAND_FAILOK, DDU_DRIVER_COMMAND_WARNOK
Result = DDEDriverCommand (StepDriverTestInfo, StepDriverInfo)
Case DDU_SKIP_TEST_STEP
Result = DDESkippedRecord (StepDriverTestInfo, StepDriverInfo)
Case DDU_TEST_STEP, DDU_TEST_STEP_FAILOK, DDU_TEST_STEP_WARNOK
Result = SDProcessTestRecord()
Case DDU_BLOCKID
Result = DDEProcessBlockID (StepDriverTestInfo, StepDriverInfo)
Case DDU_BREAKPOINT
if DDU_BREAKPOINTS_ENABLED then
DDU_BREAKPOINTS_MODE = 1
Log Message "Breakpoint at line "& Str$(StepDriverInfo.linecount) &" in "& filename, fac
end if
Goto MainLoop
'IMPLIED Script? or UNKNOWN RECORD TYPE
Case Else
Result = DDEImpliedCallScript (RecordType, StepDriverTestInfo, StepDriverInfo)
End Select
3)根据组件类型调用处理命令(SDProcessTestRecord代码片断)
Select Case UCase$(.compType)
CASE "WINDOW"
WindowFunctions
CASE "GENERIC"
'process by CLASS?
if StrComp(.compClass,"SSTree", 1)=0 then
SSTreeFunctions
Elseif StrComp(.compClass,"VSFlexGrid", 1)=0 then
VSFlexGridFunctions
else
GenericObjectFunctions
end if
CASE "CHECKBOX"
Xxxxxxxxxxx
CASE "OTHER"
'process by CLASS?
WindowFunctions
Case Else
'Default to WindowFunctions?
GenericObjectFunctions
End Select
4)调用WindowFunctions.SBL文件中MAIN函数,由于window没有处理VerifyProperty,于是调用HandleGenericCommand函数处理
5)打开GenericObjectFunctions.SBL找到函数HandleGenericCommand,这里没有处理VerifyProperty,他调用GenericUnimplementedCommand
6)打开GenericMasterFunctions.SBL,找到GenericUnimplementedCommand
7)找到处理GENERIC_VERIFY_PROPERTY_COMMAND的地方
8)打开GenericMasterFunctions.SBL 定位到处理函数GenericVerifyProperty
总结:SDStepDriver-〉SDProcessTestRecord-〉处理函数(WindowFunctions)
小结:通过上面的例子我们对测试框架的运行流程有了大致的印象。运行的走势,处理的流程。对于上边流程的分析是为了更好的掌握测试自动化框架,让大家开发出符合自己公司要测试软件的测试自动化框架。我还会在后边的内容逐步介绍和实际例子紧密结合。