Sunday, August 23, 2015

main driver

On Error Resume Next
strFolderPath = Split(Environment.Value("TestDir"),"Test Scripts")(0)
strDataTablePath = strFolderPath & "Local Test Data\\"
strFunLibrPath = strFolderPath & "Local Functions\"
strInputFile = strDataTablePath & "1.xls"

Environment.Value("RowNo") = 1
Environment.Value("SNo") = 1
Environment.Value("strResultFile") = ""

fnQTPConfigurationSettings()           ' Sets the QTP Test Settings automatically
fnSetLoginCredentials(strInputFile)       ' Sets the Login Credentials to Environment Variables☺

DataTable.AddSheet("GroupSelector")
DataTable.ImportSheet strInputFile,"GroupSelector","GroupSelector"
intActCount = Datatable.GetSheet("GroupSelector").GetRowCount

For index = 1 To intActCount

DataTable.GetSheet("GroupSelector").SetCurrentRow(index)

If DataTable.Value("Execute","GroupSelector") = "Y" Then

strGroupName = DataTable.Value("TestGroupName","GroupSelector") ' Sheet Name = Vbs file Name = GroupName
Environment.Value("GroupDescription") = DataTable.Value("GroupDescription","GroupSelector")
strGroupSheet = strGroupName
DataTable.AddSheet(strGroupSheet)
DataTable.ImportSheet strInputFile,strGroupName,strGroupSheet      ' Loads the Input Data Sheet of required Group
Environment.Value("TestGroupName") = strGroupName
Environment.Value("CureentSheet")=strGroupName

Environment.Value("GPStatus") = "True"

'    ExecuteFile strFunLibrPath&strGroupName&".vbs"
strFunName = strGroupName&"("&Chr(34)&strGroupSheet&Chr(34)&")"
                   
Call Eval(strFunName)         'Runs the corresponding <strGroupName>.Vbs Main function ; which will run for Each testcase as mentioned in Corresponding sheet rows

If Environment.Value("GPStatus") = "True"  Then
fnReportingManager "GPPass", "Execution Complete for Group : " & Environment.Value("TestGroupName"),Environment.Value("TestGroupName") ,"", Environment.Value("TestGroupName")
Else
fnReportingManager "GPFail", "Execution Complete for Group : " & Environment.Value("TestGroupName"),Environment.Value("TestGroupName") ,"", Environment.Value("TestGroupName")
'     desktop.CaptureBitmap strFolderPath&"Result\"&strUseCaseName&".bmp", True
End If
DataTable.DeleteSheet(strGroupSheet)
End If

Next

Print "Done"