The below mentioned framework script is prepared to add three sheets in the runtime data table and retrieve the data from an external excel file. Based on the retrieved data and keywords remaining functions will be executed. Finally the updated runtime results data is exported to external excel file.
Adding sheets to runtime data table
' Adding sheet for Module
DataTable.AddSheet ("Module")
' Adding sheet for Testcase
DataTable.AddSheet ("Testcase")
' Adding sheet for Teststep
DataTable.AddSheet ("Teststep")
'-- Importing sheets from an external excel file
' Importing data of Module sheet from external excel file
DataTable.ImportSheet "Path of the excel file",1,"Module"
' Importing data of Testcase sheet from external excel file
DataTable.ImportSheet "Path of the excel file",2,"Testcase"
' Importing data of Teststep sheet from external excel file
DataTable.ImportSheet "Path of the excel file",3,"Teststep"
' Getting the total number of rows in the Module sheet
MrowCount=Datatable.GetSheet("Module").GetRowCount
' For loop is started here for Module data
For i=1 to Mrowcount
' Setting the first row in the Module sheet
DataTable.SetCurrentRow(i)
' Getting and Assigning the value of current row to Mflag
Mflag=DataTable.Value(3,"Module")
If Mflag ="Y" Then
' If Mflag = Y, assigning the current row value to ModuleId
ModuleId= DataTable.Value (1,"Module")
' Getting the total number of rows in the Testcase sheet
TcrowCount=DataTable.GetSheet ("Testcase").GetRowCount
' For loop is started here for Testcase data
For j=1 to TcrowCount
' Setting the first row in the Testcase sheet
Datatable.SetCurrentRow (j)
' Getting and Assigning the value of current row to ModuleId1
ModuleId1=DataTable.Value(4,"Testcase")
' Getting and Assigning the value of current row to Tcflag
Tcflag=DataTable.Value(3,"Testcase")
If ModuleId=ModuleId1 and Tcflag="Y" Then
' If ModuleId = ModuleId1 and Tcflag = Y, assigning the
current row value to TcId
TcId=DataTable.Value(1,"Testcase")
' Getting the total number of rows in the Teststep sheet
TsrowCount=DataTable.GetSheet("Teststep").GetRowCount
' For loop is started here for Teststep data
For k= 1 to TsrowCount
' Setting the first row in the Teststep sheet
Datatable.SetCurrentRow(k)
' Getting and Assigning the value of current row to Tcid1
Tcid1=DataTable.Value(5,"Teststep")
If TcId= TcId1 Then
' If TcId = TcId1, assigning the current row value to
keyword
keyword= DataTable.Value(3,"Teststep")
' Select Case statement is started here
Select Case keyword
Case "lN"
' If keyword = IN, execute Login function and assign the
value to res
res=Login()
' Write the value of res to Teststep in the runtime data
table
DataTable.Value(6,"Teststep")=res
Case "CA"
' If keyword = CA, execute Close_Appl function
Close_Appl()
Case "OP"
' If keyword = OP, execute OpenOrd function and
assign the value to res
res=OpenOrd()
' Write the value of res to Teststep in the runtime
data table
DataTable.Value(6,"Teststep")=res
' End of Select Case statement
End Select
' End of If statement for Test Step sheet
End If
' End of For loop for Teststep data
Next
' End of If statement for Testcase sheet
End If
' End of For loop for Testcase data
Next
' End of If statement for Module sheet
End If
' End of For loop for Module data
Next
'--- Exporting results
' Exporting the runtime data sheet of Teststep to external excel file
Datatable.ExportSheet "Path of the file where you want","Teststep"
' Need to define functions like Login, Close_app and Openord
'--- Login function
' function definition for Login
Function Login()
----
End Function
'--- Close application function
' function definition for Close_Appl
Function Close_Appl()
-----
End Function
'--- Openord function
' function definition for OpenOrd
Function OpenOrd()
----
End Function