Research DDE execution process (script is described as an example of ClassicsC_2001):
1. Open the test script cycleDrivertest.recior
2. Find the CDCyleDriver function, open the Cycledriver.sbl class library file
3. Research source code. The function processing process is to open the .cdd file, call Cycledriver, SuietDriver, STEPDRIVER to process the corresponding test data file (.cdd, .std, .sdd), the entire large loop DO Until ... .loop read .cdd file, resolve keywords, Call the SuiteDriver engine based on the corresponding keyword. SuiteDriver parsing keyword content calls the StepDriver engine. Stepdriver parses the keyword to call DRIVERCOMMAND to process.
One. We look at the code running process in the "T" command in the CDD file. The main code script calls the function cdcydriver in cycleDriver.sbl. Read the CDD file resolution keyword encountered command type "T", call the cdprocessTeStRecord function, function call SuiteDriver engine processing. Here is the CDCyleDriver core code:
Sub CDCycledriver (Filename As String, Separetor As String, _
Fac As Logfacility, Suitefac As Logfacility, Stepfac As Logfacility ,_
OPTIONAL MODE
XXXXXXX
Read file
Do Until Eof (FileRef)
Analyze the data file and call the corresponding command
Select Case Recordtype
Case DDU_Driver_Command, DDU_Driver_command_failok, DDU_Driver_command_warnok
Result = ddedriverCommand (CycledriveerGuiInfo, CycledriverInfo)
Case DDU_SKIP_TEST_STEP
Result = ddeskippedRecord (CycledriveerGuiInfo, CycledriverInfo)
Case DDU_TEST_STEP, DDU_TEST_STEP_FAILOK, DDU_TEST_STEP_WARNOK
Pushsuitedriverstack
Result = CDProcessTeSTRecord (SuiteFac, Stepfac)
If Result = cdnoscriptfailure the ausumstatusinfo suitedrivertestinfo, Cycledrivertestinfo
POPSUITEDRIVERSTACK
Case DDU_BLOCKID
Result = DDEPROCESSBLOCKID (CYCLEDRIVERIINFO, CYCLEDRIVERINFO)
Case DDU_BREAKPOINT
IF DDU_BREAKPOINTS_ENABLED THEN
DDU_BREAKPOINTS_MODE = 1
LogMessage "Breakpoint At Line" & Str $ (CycledriverInfo.Linecount) & "in" & FileName, FAC
END IF
Goto Mainloop
'Implied Script Executed or Unknown Record Type Logged
Case Else
Result = DDEIMPLIEDCALLScript (RecordType, CycledriveerguiInfo, CycledriverInfo) End Select
Xxxxx
Loop
Xxxx
End Sub
Summary: Calling Process CDCyCledriver ---> CDProcessTeSTRecord-> StsuITedriver
two. Handling high-level command type "t"
For example: t, adduseraccount, ^ user = name
1) Open SuiteDriver.sbl
2) Positioning the code to the function STSUITEDRIVER to process the record type, the following is the STSUITEDRIVER function code judgment, when the record type is "T", he calls case DDU_TEP_STEP, DDU_TEST_STEP_FAILOK, DDU_TEST_STEP_WARNOK The code behind:
Select Case Recordtype
Case DDU_Driver_Command, DDU_Driver_command_failok, DDU_Driver_command_warnok
Result = DDEDRIVERCOMMAND (SuiteDriveerGuiInfo, SuiteDriverInfo)
Case DDU_SKIP_TEST_STEP
Result = DDESKIPPedRecord (SuiteDriveerGuiInfo, SuiteDriverInfo)
Case DDU_TEST_STEP, DDU_TEST_STEP_FAILOK, DDU_TEST_STEP_WARNOK
Pushstepdriverstack
Result = stProcessTeSTRecord (Stepfac)
If Result = stnoscriptfailure the ausumstatusInfo StepdriverInfo, SuiteDrivertestinfo
POPSTepdriverstack
Case DDU_BLOCKID
Result = DDEPROCESSBLOCKID (SuiteDriveerGuiInfo, SuiteDriverInfo)
Case DDU_BREAKPOINT
IF DDU_BREAKPOINTS_ENABLED THEN
DDU_BREAKPOINTS_MODE = 1
LogMessage "BreakPoint At Line" & Str $ (SuiteDriverInfo.Linecount) & "In" & FileName, FAC
END IF
Goto Mainloop
'Implied Script Executed or Unknown Record Type Logged
Case Else
Result = DDEIMPLIEDCALLScript (RecordType, SuiteDriveerGuiInfo, SuiteDriverInfo)
End SELECT
3) Call the StepDriver engine handling command
Summary: Calling process
STSUITEDRIVER ----
>
StProcessTestRecord-
>
SDSTepdriver