Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Details_Eng #13

Open
Raghunandanr76 opened this issue Aug 20, 2018 · 0 comments
Open

Details_Eng #13

Raghunandanr76 opened this issue Aug 20, 2018 · 0 comments

Comments

@Raghunandanr76
Copy link

'Engine

''*****************************************************************************************************
Option Explicit
'*************************************************************************************
' Engine.vbs is contains the Driver Code for the Framework

'List of functions
'----------------------------------------------------------------------------
' RunEngine() - Run the main Automation Engine
' fnExecuteBatch(strBatchID) - Execute Specified Batch of Testcases
' fnExecuteTSuite(strTSuiteID) -Execute Specified TestSuite
' fnExecuteTCase(strFileName, strTCaseID,strTCaseDesc) - Execute Specified Testcase
' fnExecuteTStep(strTStepID, strAction, dicTStepDetails, strTStepDesc) - Execute Specified TestStep of a Testcase
' fnExecuteBC(strBCID, dicBCDetails) - Execute the specified Business Component
' fnExecuteAction(strAction, dictActionDetails) -Execute the specified Action
'----------------------------------------------------------------------------
'*************************************************************************************

'----------------------------------------------------------------------------------------------
'Global Variables
'----------------------------------------------------------------------------------------------
Public gcnnTestRun 'ADODB Connection object for connecting to TestRun File
Public gcnnBC 'ADODB Connection object for connecting to Business Components File
Public gcnnTD 'ADODB Connection object for connecting to Test Data File

Public gdConfig 'Dictionary Object for storing Framework Config Varaibles
Public gdActionPrp 'Dictionary Object for storing Test Action Properties
Public gdTORef 'Dictionary Object for storing Test Object References
Public gdEnvData 'Dictionary Object for store Test environment Data
Public gdBCData 'Dictionary Object for maintain Business Component Level Data
Public gdTData 'Dictionary Object for maintain Testcase Level Data
Public gdRData 'Dictionary Object for maintain Run Time Data
Public gdRptInput 'Dictionary Object for storing Report Input and Summary

Public grsTestRun 'ADODB RecordSet for maintaining TestRun Information (Batch,Testsuite and Testcases To Execute)
Public grsBAResults 'ADODB RecordSet for maintaining Results information related to all the executed Batches
Public grsTSResults 'ADODB RecordSet for maintaining Results information related to all the executed TestSuites
Public grsTCResults 'ADODB RecordSet for maintaining Results information related to all the executed Testcases
Public grsTStepResults 'ADODB RecordSet for maintaining Results information related to all the executed TestSteps
Public grsBCResults 'ADODB RecordSet for maintaining Results information related to all the executed Business Components
Public grsBCStepResults 'ADODB RecordSet for maintaining Results information related to all the executed Business Components Steps
Public gstrFuncRtnMsg 'Global Function return message
Public gstrActionCompleteMsg 'Global Space for Complete Message of Action Execution Rseults
Public gstrActionMsg 'Global Space for Complete Message of Action Execution Rseults
Public gbValFound '
Public gstrTestExeID

'ADODB Recordset related Constants for defining the Fields
'properties interms of max char, Variable type, etc.
Const gFOR_READING = 1
Const gAD_VAR_CHAR = 200
Const gMAX_CHARACTERS = 255
Const gAD_DOUBLE = 5

'ADODB Connection related Constants to define the connection properties
Const gAD_OPEN_STATIC = 3
Const gAD_LOCK_OPTIMISTIC = 3
Const gAD_CMD_TEXT = "&H0001"

'Standard FileName & Path
Const gTRUN_FILENAME = "\Tests\TestRun.xls" 'Relative path or Name for TestRun File where
'information related to Batch,Testsuite and Testcases are present
Const gBC_FILENAME = "\Tests\BC.xls" 'Relative path or Name for Business Component file
Const gTD_FILENAME = "\InputData<<TEST_ENV>>\TestInput.xls" 'Relative path or Name for Test Data Input file
Const gENV_FILENAME = "\InputData<<TEST_ENV>>\Environment.xls" 'Relative path or Name for Environment file
Const gCONFIG_FILENAME = "Config.xls" 'Filename for Framework config file
Const gTO_FILENAME = "ObjectDef.xls" 'Filename for Object Defination file
Const gGEN_ACTION_INFO_FILENAME = "GenericActionInfo.xls" 'Filename for Generic Action Information
Const gAPP_ACTION_INFO_FILENAME = "AppActionInfo.xls" 'Filename for App Specific Action Information

Const gEMPTY = "" 'Empty String Value
Const gObjWaitTime = 10 'newly added by Navaneeth

'Creating an Instance of the Obejct
Set gcnnTestRun = CreateObject("ADODB.Connection")
Set gcnnBC = CreateObject("ADODB.Connection")
Set gcnnTD = CreateObject("ADODB.Connection")

Set gdConfig = CreateObject("Scripting.Dictionary")
Set gdActionPrp = CreateObject("Scripting.Dictionary")
Set gdTORef = CreateObject("Scripting.Dictionary")
Set gdEnvData = CreateObject("Scripting.Dictionary")
Set gdBCData = CreateObject("Scripting.Dictionary")
Set gdTData = CreateObject("Scripting.Dictionary")
Set gdRData = CreateObject("Scripting.Dictionary")
Set gdRptInput = CreateObject("Scripting.Dictionary")

Set grsBAResults = CreateObject("ADODB.RecordSet")
Set grsTSResults = CreateObject("ADODB.RecordSet")
Set grsTCResults = CreateObject("ADODB.RecordSet")
Set grsTStepResults = CreateObject("ADODB.RecordSet")
Set grsBCResults = CreateObject("ADODB.RecordSet")
Set grsBCStepResults = CreateObject("ADODB.RecordSet")

'***********************************************************************
'@ Name: RunEngine
'@ Purpose: Run the main Automation Engine
'@ Inputs : NA
'@ Returns : NA
'@ Example : RunEngine()
'@modifications:
' Raghu, 19th May 14, Initial Draft
' Raghu, 19th May 14, Included Error Handling Code
' Raghu, 9th June 14, Enhanced the Code with appropriate comments & minor logical changes
'***********************************************************************

Public Sub RunEngine()
Dim rsBatchList 'RecordSet to store Batch List Records
Dim blnAllBCExecuted 'Indicate whether all the Batches have been executed or not
Dim strBatchResult 'Hold Batch Execution Result Status
Dim intCnt
Dim strCurrentBatchID 'Current BatchID
Dim intNoRun 'Hold number of NoRun Testcases
Dim strExeMsg 'Hold Execution Message
Dim strBatchSQLQuery
Dim strSQLTCaseCount
Dim rsTCaseCount
Dim intTotalTCase

On Error Resume Next
Call SetRptNode("Library-Step", "Library Initalization", micDone)
' Initialize Libraries
If fnInitialize <> "SUCCESS" Then
   strExeMsg = "Test execution could not started due to failure of Library Initialization"
   MsgBox strExeMsg
   Logger "FATAL", "Initialization Failed", "Library Initalization Failed"
   Exit Sub
End If
Reporter.UnSetContext
'--------------------------------------
' Start - Get Overall Testcases Count
'--------------------------------------

strSQLTCaseCount = "Select T.TESTCASE_ID FROM [TESTCASES$] as T, [TESTSUITES$] as S, [BATCHES$] as B  Where  T.EXECUTE_FLAG = 'Y'" _
& "AND S.EXECUTE_FLAG = 'Y' AND B.EXECUTE_FLAG = 'Y' AND B.BATCH_ID = S.BATCH_ID AND T.TESTSUITE_ID = S.TESTSUITE_ID"

Set rsTCaseCount = CreateObject("ADODB.RecordSet")
rsTCaseCount.Open strSQLTCaseCount, gcnnTestRun, gAD_OPEN_STATIC, gAD_LOCK_OPTIMISTIC, gAD_CMD_TEXT

intTotalTCase = rsTCaseCount.RecordCount
rsTCaseCount.Close

Set rsTCaseCount = Nothing
'-----------------------------------------
' End  Get Overall Testcases Count
'-----------------------------------------

gdRptInput("TCaseTotal") = intTotalTCase
gdRptInput("TCasePassed") = 0
gdRptInput("TCaseFailed") = 0
gdRptInput("TCaseError") = 0
gdRptInput("TCaseDataError") = 0
gdRptInput("TCaseNoRun") = 0

'Extract all the batches from the Batch List file
strBatchSQLQuery = "Select * FROM [BATCHES$] Where  EXECUTE_FLAG = 'Y' ORDER BY 'EXECUTE_ORDER';"
Set rsBatchList = CreateObject("ADODB.RecordSet")
rsBatchList.Open strBatchSQLQuery, gcnnTestRun, gAD_OPEN_STATIC, gAD_LOCK_OPTIMISTIC, gAD_CMD_TEXT

'If there are no Batches to execute, Report Error and Exit Run
If rsBatchList.RecordCount <= 0 Then
        strExeMsg = "There are no Test Batches to execute as Batch Count is : " & rsBatchList.RecordCount
        Logger "DATA_ERROR", "Extract Batch", strExeMsg
        MsgBox strExeMsg
   Exit Sub
End If

blnAllBCExecuted = False
' -----------------------------------------------------
' Iterate through each BatchID and Call ExecuteBatch Function
' -----------------------------------------------------

For intCnt = 0 To rsBatchList.RecordCount - 1
    strBatchResult = "FAIL"
                            
    strCurrentBatchID = rsBatchList.Fields("BATCH_ID")
    Call SetRptNode("BC-" & strCurrentBatchID, "Executing   BATCHID" & strCurrentBatchID, micDone)
     Logger "INFO", "Start -Batch", "START of  Batch Execution ; BATCHID  := '" & strCurrentBatchID
   
    strBatchResult = fnExecuteBatch(strCurrentBatchID, rsBatchList.Fields("BATCH_DESC"))
    
    Logger "INFO", "End -Batch", "END of Batch Execution ; BATCHID  := '" & strCurrentBatchID _
                    & "' ; RESULT is : '" & strBatchResult & "'"
    rsBatchList.MoveNext
    Reporter.UnSetContext

Next
' -----------------------------------------------------
blnAllBCExecuted = rsBatchList.EOF

' -----------------------------------------------------
' Error Handling and Logging
' -----------------------------------------------------
If Err.Number <> 0 Then
    strExeMsg = "Error Occured trying to Run the Automation Script " _
                    & " Error Details :  Err Number - " & Err.Number & " Err Desc - " & Err.Description
    Logger "FATAL", "RunTime Error", strExeMsg
    gdRptInput("Message").Value = strExeMsg
    Err.Clear
    Exit Sub
End If
    
If (strBatchResult <> "FAIL") And (strBatchResult <> "ERROR") And (strBatchResult <> "DATA_ERROR") And (blnAllBCExecuted = True) Then
    strExeMsg = "Test Run successfully completed"
    Logger "PASS", "Overall Run Status", strExeMsg
Else
    strExeMsg = "Test Run did not complete"
    Logger "ERROR", "Overall Run Status", strExeMsg
End If
' -----------------------------------------------------

'Track No Run Testcase count
intNoRun = CInt(gdRptInput("TCaseTotal")) - (CInt(gdRptInput("TCasePassed")) + CInt(gdRptInput("TCaseFailed")) _
            + CInt(gdRptInput("TCaseError")) + CInt(gdRptInput("TCaseDataError")))
                
'Store Run Details for Reporting
gdRptInput("TCaseNoRun") = intNoRun
gdRptInput("EndTime") = Now
gdRptInput("Message") = strExeMsg
        
rsBatchList.Close

Set rsBatchList = Nothing
'Call ExportResultsToExcel( "C:\Temp\")
'Call CreateReport (gdRptInput("ReportFilePath"))
Call CreateHTMLReport(gdConfig("report_file_path"))

'fnPrintReport()

End Sub

'***********************************************************************
'@ Name: fnExecuteBatch
'@ Purpose: Execute Specified Batch of Testcases
'@ Inputs : strBatchID : Execute Batch ID
' strBatchDesc : Batch Description
'@ Returns : "Based on the execution result, it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call fnExecuteBatch("BC003")
'@modifications:
' Raghu, 19th May 14, Initial
' Raghu, 10th June 14, Enhanced the Code with appropriate comments & minor logical changes
'***********************************************************************
Private Function fnExecuteBatch(strBatchID, strBatchDesc)
Dim strBatchResult ' Holds the Batch Result
Dim blnAllTSExecuted 'Indicate wheither all the TestSuite are executed or Not
Dim strTSSQLQuery ' SQL query to extract list of Testsuite of the specified batch
Dim intCnt
Dim strTestSuiteResult 'Holds the Testsuite result Status
Dim strTSuiteID
Dim strTSuiteDesc
Dim strExeMsg 'Holds the Batch Execution Message
Dim intNoRunCnt 'Hold number of NoRun Testcases
Dim rsTestSuiteList 'RecordSet to hold TestSuite list info
Dim screenShotPath 'File Path to store Screenshot during error or failure

    strBatchResult = gEMPTY
    blnAllTSExecuted = False
    
    On Error Resume Next
    
    '----------------------------------------------------
    ' Start - Get Overall Testcases Count for the Batch
    '----------------------------------------------------
    Dim strSQLTCaseCount
    Dim rsTCaseCount
    Dim intTotalTCase

    strSQLTCaseCount = "Select T.TESTCASE_ID FROM [TESTCASES$] as T, [TESTSUITES$] as S Where  T.EXECUTE_FLAG = 'Y'" _
                        & "AND S.EXECUTE_FLAG = 'Y' AND S.BATCH_ID = '" & strBatchID & "' AND T.TESTSUITE_ID = S.TESTSUITE_ID"

    Set rsTCaseCount = CreateObject("ADODB.RecordSet")
    rsTCaseCount.Open strSQLTCaseCount, gcnnTestRun, gAD_OPEN_STATIC, gAD_LOCK_OPTIMISTIC, gAD_CMD_TEXT

    intTotalTCase = rsTCaseCount.RecordCount
    rsTCaseCount.Close
    Set rsTCaseCount = Nothing
    '--------------------------------------------------
    ' End  Get Overall Testcases Count for the Batch
    '--------------------------------------------------
    
    grsBAResults.AddNew
    grsBAResults("BatchID") = strBatchID
    grsBAResults("BatchDesc") = strBatchDesc
    grsBAResults("StartTime") = Now
    grsBAResults("TSuiteTotal") = 0
    grsBAResults("TCaseTotal") = intTotalTCase
    grsBAResults("TCasePassed") = 0
    grsBAResults("TCaseFailed") = 0
    grsBAResults("TCaseError") = 0
    grsBAResults("TCaseDataError") = 0
    
            
    'Extract List of TestSuites of specified Batch into the RecordSet
    strTSSQLQuery = "Select  TS.TESTSUITE_ID, TI.TESTSUITE_DESC From [TESTSUITES$]  as TS, [TESTSUITE_INFO$] as TI " _
                & "Where BATCH_ID = '" & strBatchID & "' AND TS.TESTSUITE_ID = TI.TESTSUITE_ID " _
                & "AND TS.EXECUTE_FLAG = 'Y' order by TS.EXECUTE_ORDER;"

    Set rsTestSuiteList = CreateObject("ADODB.RecordSet")
    rsTestSuiteList.Open strTSSQLQuery, gcnnTestRun, gAD_OPEN_STATIC, gAD_LOCK_OPTIMISTIC, gAD_CMD_TEXT
    grsBAResults("TSuiteTotal") = rsTestSuiteList.RecordCount
    'If there are no TestSuites to Execute Report Error and Skip Batch Execution
    If rsTestSuiteList.RecordCount <= 0 Then
        strBatchResult = "DATA_ERROR"
        strExeMsg = "No testsuites available to execute for Batch ID :- " & strBatchID
    Else
        ' --------------------------------------------------------------------
        ' Iterate through each TestSuite and call fnExecuteTSuite Function
        ' --------------------------------------------------------------------
        For intCnt = 0 To rsTestSuiteList.RecordCount - 1 'objRecordset.fields.item(1).properties.count
            
            
            strTestSuiteResult = "FAIL"
            strTSuiteID = rsTestSuiteList.Fields("TESTSUITE_ID").Value
            strTSuiteDesc = rsTestSuiteList.Fields("TESTSUITE_DESC").Value

            Call SetRptNode("TS-" & strTSuiteID, "Executing   TestSuite" & strTSuiteID & " :- " & strTSuiteDesc, micDone)
        
            Logger "INFO", "Start-TS", "START of  Testsuite Execution ; TESTSUITE ID '" & strTSuiteID & "'" _
                            & "TESTSUITE DESCRIPTION : '" & strTSuiteDesc & "'"

            strTestSuiteResult = fnExecuteTSuite(strTSuiteID, strTSuiteDesc)
            'If one of the TestSuite Fail, then the whole Batch would be set to fail
            If (strTestSuiteResult = "FAIL") Then
                strBatchResult = "FAIL"
            End If
            Logger "INFO", "End-TS", "END of TestSuite Execution ; TESTSUITE_ID  := '" & strTSuiteID _
                        & "' ; RESULT is : '" & UCase(strTestSuiteResult) & "'"

            rsTestSuiteList.MoveNext
            Reporter.UnSetContext
        Next
        ' --------------------------------------------------------------------
        blnAllTSExecuted = rsTestSuiteList.EOF
            
     End If
     
    ' -----------------------------------------------------
    ' Error Handling and Logging
    ' -----------------------------------------------------
     If Err.Number <> 0 Then
            strExeMsg = "Execution failed for Batch ID '" & strBatchID _
                        & "' as error occured when executing this batch;  Error Details : " _
                        & Err.Description
                
            Logger "ERROR", "RunTime Error", strExeMsg
            strBatchResult = "ERROR"
            Err.Clear
     End If
            
     If (strBatchResult <> "FAIL") And (strBatchResult <> "ERROR") And (strBatchResult <> "DATA_ERROR") And (blnAllTSExecuted = True) Then
            strBatchResult = "PASS"
            strExeMsg = "Batch execution was successfull"
     Else
        If strExeMsg = gEMPTY Then strExeMsg = "Batch execution was Not successfull"
            If strBatchResult = strBatchResult Then strBatchResult = "FAIL"
        '----Capture Screenshot when there is Error or Failure----------
        ' screenShotPath = gdConfig("screenshot_dir") & gstrTestExeID _
          '               & "_" & strBatchID & ".jpg"
        ' Call CaptureScreenshot(screenShotPath)
        'grsBAResults("ScreenshotPath") = CaptureScreenshot( gdConfig("screenshot_dir") )
     
     End If
        
    '-----------------------------------------------------
    ' Track NoRun Testcase count
    intNoRunCnt = CInt(grsBAResults("TCaseTotal")) - (CInt(grsBAResults("TCasePassed")) _
                   + CInt(grsBAResults("TCaseFailed")) + CInt(grsBAResults("TCaseError")) + CInt(grsBAResults("TCaseDataError")))
    
    ' Store Run Details of Current Batch for Reporting
     grsBAResults("TCaseNoRun") = intNoRunCnt
     grsBAResults("BatchStatus") = strBatchResult
     grsBAResults("EndTime") = Now
     grsBAResults("Message") = strExeMsg

    fnExecuteBatch = strBatchResult

End Function
'***********************************************************************
'@ Name: fnExecuteTSuite
'@ Purpose: Execute Specified TestSuite
'@ Inputs : strTSuiteID : ID of the TestSuite to be executed
' strTSuiteDesc: Testsuite Description
'@ Returns : "Based on the execution result, it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call fnExecuteTSuite("TS001" )
'@modifications:
' Raghu, 19th May 14, Initial
' Raghu, 12th June 14, Enhanced the Code with appropriate comments & minor logical changes
'***********************************************************************
Private Function fnExecuteTSuite(strTSuiteID, strTSuiteDesc)
Dim blnAllTCExecuted 'Indicate wheither all the TestCase are executed or Not
Dim strTSuiteResult 'Hold TestSuite Result
Dim strTCaseSQLQuery 'SQL Query To extract List of Testcase of specified TestSuite
Dim rsTCaseList 'Recordset to hold Testcase list
Dim intCnt
Dim strExeMsg 'Holds the TestSuite Execution Message

Dim strTCaseResult 'Hold Testcase Result
Dim strTCaseID 'Hold Testcase ID
Dim strTCaseDesc 'Hold Testcase Description
Dim strTCFileName 'Hold Name of the File where Testcase Steps have been defined

Dim intNoRunCnt 'Hold number of NoRun Testcases
Dim screenShotPath 'File Path to store Screenshot during error or failure

blnAllTCExecuted = False
strTSuiteResult = gEMPTY

On Error Resume Next

grsTSResults.AddNew
grsTSResults("BatchID") = grsBAResults("BatchID")
grsTSResults("TSuiteID") = strTSuiteID
grsTSResults("TSuiteDesc") = strTSuiteDesc
grsTSResults("StartTime") = Now
grsTSResults("TCaseTotal") = 0
grsTSResults("TCasePassed") = 0
grsTSResults("TCaseFailed") = 0
grsTSResults("TCaseError") = 0
grsTSResults("TCaseDataError") = 0

'Extract List of Testcase of specified TesSuite into the RecordSet

strTCaseSQLQuery = "Select TC.TESTCASE_ID, TI.TESTCASE_DESC, TI.FILE_NAME from [TESTCASES$] as TC, [TESTCASE_INFO$] as TI " _
& "where TC.TESTSUITE_ID = '" & strTSuiteID & "'" _
& "AND TC.TESTCASE_ID = TI.TESTCASE_ID AND TC.EXECUTE_FLAG = 'Y' AND TC.EXECUTE_FLAG = 'Y' order by TC.EXECUTE_ORDER;"

Set rsTCaseList = CreateObject("ADODB.RecordSet")
rsTCaseList.Open strTCaseSQLQuery, gcnnTestRun, gAD_OPEN_STATIC, gAD_LOCK_OPTIMISTIC, gAD_CMD_TEXT

grsTSResults("TCaseTotal") = rsTCaseList.RecordCount
'grsBAResults("TCaseTotal") = Cint(grsBAResults("TCaseTotal")) + Cint(grsTSResults("TCaseTotal"))

'If there are no TestCases to execute, Report Error and Skip TestSuite Execution.
If rsTCaseList.RecordCount <= 0 Then
strTSuiteResult = "DATA_ERROR"
strExeMsg = "No Testcases available to execute for TestSuiteID :- " & strTSuiteID

Else
' --------------------------------------------------------------------
' Iterate through each Testcase and call fnExecuteTCase Function
' --------------------------------------------------------------------
For intCnt = 0 To rsTCaseList.RecordCount - 1
strTCaseResult = "FAIL"
strTCaseID = rsTCaseList.Fields("TESTCASE_ID")
strTCaseDesc = rsTCaseList.Fields("TESTCASE_DESC")
strTCFileName = rsTCaseList.Fields("FILE_NAME")
Call SetRptNode("TC-" & strTCaseID, "Executing TCaseID" & strTCaseID, micDone)
Logger "INFO", " Start TC", "START of TestCase Execution ; TESTCase ID '" & strTCaseID & "'" _
& "TESTCASE DESCRIPTION : '" & strTCaseDesc & "'"

        strTCaseResult = fnExecuteTCase(strTCFileName, strTCaseID, strTCaseDesc)
     
        'If one of the Testcase File, the whole Suite would be set to fail
        If (strTCaseResult = "FAIL") Then
            strTSuiteResult = "FAIL"
        End If
        
        Logger "INFO", "EndT-C", "END of TestCase Execution ; TESTCase_ID  := '" & strTCaseID _
                    & "' ; RESULT is : '" & UCase(strTCaseResult) & "'"

        rsTCaseList.MoveNext
        Reporter.UnSetContext
    Next
    ' --------------------------------------------------------------------
    blnAllTCExecuted = rsTCaseList.EOF
End If

' -----------------------------------------------------
' Error Handling and Logging
' -----------------------------------------------------
If Err.Number <> 0 Then
strExeMsg = "Execution failed for TestSuite ID '" & strTSuiteID _
& "' as error occured when executing this TestSuite; Error Details : " _
& Err.Description

    Logger "ERROR", "RunTime Error", strExeMsg
    strTSuiteResult = "ERROR"
    Err.Clear
End If
    
' ------------Evalaute Result----------------------
If (strTSuiteResult <> "FAIL") And (strTSuiteResult <> "ERROR") And (strTSuiteResult <> "DATA_ERROR") And (blnAllTCExecuted = True) Then
    strTSuiteResult = "PASS"
    strExeMsg = "TestSuite execution was successfull"
Else
    If strExeMsg = gEMPTY Then strExeMsg = "TestSuite execution was Not successfull"
    '----Capture Screenshot when there is Error or Failure----------
   ' screenShotPath = gdConfig("screenshot_dir") & gstrTestExeID _
                    '& "_" & grsTSResults("BatchID") & "_" & strTSuiteID & ".jpg"
    'Call CaptureScreenshot(screenShotPath)
            
   ' grsTSResults("ScreenshotPath") = CaptureScreenshot( gdConfig("screenshot_dir") )
    
End If
    
' Track NoRun Testcase count
intNoRunCnt = CInt(grsTSResults("TCaseTotal")) - (CInt(grsTSResults("TCasePassed")) _
                + CInt(grsTSResults("TCaseFailed")) + CInt(grsTSResults("TCaseError")) + _
                CInt(grsTSResults("TCaseDataError")))
                
' Store Run Details of Current TestSuite for Reporting
grsTSResults("TCaseNoRun") = intNoRunCnt
grsTSResults("TSuiteStatus") = strTSuiteResult
grsTSResults("EndTime") = Now
grsTSResults("Message") = strExeMsg
    
fnExecuteTSuite = strTSuiteResult

End Function
'***********************************************************************
'@ Name: fnExecuteTCase
'@ Purpose: Execute Specified Testcase
'@ Inputs : strFileName : Filename where the Testcase is defined
' strTCaseID : TestcaseID which needs to be executed
' strTCaseDesc : Testcase Description
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call fnExecuteTSuite("MD001.xlsx", "TS001", "Login To app" )
'@modifications:
' Raghu, 19th May 14, Initial
' Raghu, 13th June 14, Enhanced the Code with appropriate comments & minor logical changes
'***********************************************************************
Private Function fnExecuteTCase(strFileName, strTCaseID, strTCaseDesc)

Dim blnAllTStepExecuted 'Indicate wheither all the TestSteps executed or Not
Dim strTCaseResult      'Holds the TestCase Result
Dim strTStepSQLQuery    'SQL Query To extract List of TestStep of a specified Testcase
Dim rsTStepList         'Recordset to hold TestStep list
Dim strTCFilePath       'Testcase FilePath where TestSteps have been defined
Dim dictTSteps           'Hold array of TestSteps
Dim strTStepResult      'Hold TestStep Result
Dim blnExitOnFailure    'BooIndication to Exit TestStep execution on Failure -(Boolean Representation)
Dim strExitOnFailure    'Indication to Exit TestStep execution on Failure - (String Representation)
Dim strExeMsg           'Holds the TestCase Execution Message
Dim screenShotPath      'File Path to store Screenshot during error or failure
Dim intNoRunCnt         'Hold number of NoRun TestSteps
Dim objConnTestCase
Dim intCnt
Dim strAction
Dim strTStepID
Dim strTStepDesc
Dim Field

blnAllTStepExecuted = False
strTCaseResult = gEMPTY
Set dictTSteps = CreateObject("Scripting.Dictionary")

On Error Resume Next
grsTCResults.AddNew
grsTCResults("BatchID") = grsBAResults("BatchID")
grsTCResults("TSuiteID") = grsTSResults("TSuiteID")
grsTCResults("TCaseID") = strTCaseID
grsTCResults("TCDescription") = strTCaseDesc
grsTCResults("StartTime") = Now

Set objConnTestCase = CreateObject("ADODB.Connection")
' -----------------------------------------------------
'Extract all the TestSteps of the specified Testcases into a RecordSet
' -----------------------------------------------------
strTCFilePath = gdConfig("aut_rootfolder") & "\Tests" & Trim(strFileName)
objConnTestCase.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strTCFilePath & ";" _
& "Extended Properties=""Excel 8.0;HDR=Yes;"";"

strTStepSQLQuery = "Select * from [" & strTCaseID & "$]" & "where  EXECUTE_FLAG = 'Y' order by EXECUTE_ORDER;"

Set rsTStepList = CreateObject("ADODB.RecordSet")
rsTStepList.Open strTStepSQLQuery, objConnTestCase, gAD_OPEN_STATIC, gAD_LOCK_OPTIMISTIC, gAD_CMD_TEXT

grsTCResults("TStepsTotal") = rsTStepList.RecordCount
grsTCResults("TStepsPassed") = 0
grsTCResults("TStepsFailed") = 0
grsTCResults("TStepsError") = 0
grsTCResults("TStepsNoRun") = 0
grsTCResults("TStepsDataError") = 0



'If there are no TestStep to execute,  Report Error and Skip Testcase Execution
If rsTStepList.RecordCount <= 0 Then
        strTCaseResult = "DATA_ERROR"
        strExeMsg = "No Testcases available to execute for TestSuiteID :- " & strTSuiteID
Else
    ' -----------------------------------------------------
    ' Iterate through each TestStep and Call fnExecuteTStep Function
    ' -----------------------------------------------------
    For intCnt = 0 To rsTStepList.RecordCount - 1 'objRecordset.fields.item(1).properties.count
    
        
        strTStepResult = "FAIL"
        strTStepID = rsTStepList.Fields("TESTSTEP_ID")
        strAction = rsTStepList.Fields("ACTION")
        strTStepDesc = rsTStepList.Fields("TESTSTEP_DESC")

        Call SetRptNode("TStep-" & strTStepID, "Executing   TStepID" & strTStepID, micDone)
        
        dictTSteps.RemoveAll
        
        For Each Field In rsTStepList.Fields
                If Trim(Field.Name) <> gEMPTY Then
                    dictTSteps(UCase(Trim(Field.Name))) = Field.Value
                End If
        Next
        Logger "INFO", "Start-TStep", "START of  TestStep Execution ; TESTStep ID '" & strTStepID & "'  " & "TESTStep DESCRIPTION : '" & strTStepDesc & "'"
        
      '  dictTSteps = rsTStepList.Getrows( )
        strTStepResult = fnExecuteTStep(strTStepID, strAction, dictTSteps, strTStepDesc)
       
        Logger "INFO", "End-TStep", "END of TestStep Execution ; TestStepID  := '" & strTStepID _
                    & "' test action=: '" & strAction & "' is complete" _
                    & "' ; RESULT is : '" & UCase(strTStepResult) & "'"
          Reporter.UnSetContext
        If strTStepResult <> "PASS" Then
            strTCaseResult = strTStepResult
        End If
        
        '<------Testcase execution would skip if there is an error
        'and expectation is to skip execution------>.
        
        blnExitOnFailure = True
        strExitOnFailure = rsTStepList.Fields("EXIT_ON_FAILURE")
    
        If (strExitOnFailure = Null) Or (strExitOnFailure = "Y") Or (strExitOnFailure = gEMPTY) Then
            blnExitOnFailure = True
        Else
            blnExitOnFailure = False
        End If
    
        If (blnExitOnFailure And (strTStepResult = "ERROR" Or strTStepResult = "FAIL")) Then
            Exit For
        End If
        rsTStepList.MoveNext
      
    Next
    
    '-----------------------------------------------------
    blnAllTStepExecuted = rsTStepList.EOF
  
End If

' -----------------------------------------------------
' Error Handling and Logging
' -----------------------------------------------------
If Err.Number <> 0 Then
        strExeMsg = "Execution failed for TestCase ID '" & strTCaseID _
                    & "' as error occured when executing this TestSuite;  Error Details : Err Number- " _
                    & Err.Number & "   -  " & Err.Description
        Logger "ERROR", "RunTime Error", strExeMsg
        strTCaseResult = "ERROR"
        Err.Clear
End If
  
' ------------Evalaute Result----------------------
If (strTCaseResult <> "FAIL") And (strTCaseResult <> "ERROR") And (strTCaseResult <> "DATA_ERROR") And (blnAllTStepExecuted) Then
    strTCaseResult = "PASS"
    ' ------------Update Testcase Pass Count----------------------
    gdRptInput("TCasePassed") = CInt(gdRptInput("TCasePassed")) + 1
    grsBAResults("TCasePassed") = CInt(grsBAResults("TCasePassed")) + 1
    grsTSResults("TCasePassed") = CInt(grsTSResults("TCasePassed")) + 1
    strExeMsg = "Testcase execution was successfull"
Else
    If strExeMsg = gEMPTY Then strExeMsg = "Testcase execution was Not successfull"
    '----Capture Screenshot when there is Error or Failure----------
    ' screenShotPath = gdConfig("screenshot_dir") & gstrTestExeID _
      '                   & "_" & grsTCResults("BatchID") & "_" & grsTCResults("TSuiteID") _
       '                  & "_" & strTCaseID & ".jpg"

    ' Call CaptureScreenshot(screenShotPath)
    'grsTCResults("ScreenshotPath") = CaptureScreenshot( gdConfig("screenshot_dir") )
        
    ' ------------Update Testcase Error Count----------------------
    If (strTCaseResult = "ERROR") Then
        gdRptInput("TCaseError") = CInt(gdRptInput("TCaseError")) + 1
        grsBAResults("TCaseError") = CInt(grsBAResults("TCaseError")) + 1
        grsTSResults("TCaseError") = CInt(grsTSResults("TCaseError")) + 1
        
    ElseIf (strTCaseResult = "DATA_ERROR") Then
        gdRptInput("TCaseDataError") = CInt(gdRptInput("TCaseDataError")) + 1
        grsBAResults("TCaseDataError") = CInt(grsBAResults("TCaseDataError")) + 1
        grsTSResults("TCaseDataError") = CInt(grsTSResults("TCaseDataError")) + 1
    Else
        ' ------------Update Testcase Fail Count----------------------
        strTCaseResult = "FAIL"
        gdRptInput("TCaseFailed") = CInt(gdRptInput("TCaseFailed")) + 1
        grsBAResults("TCaseFailed") = CInt(grsBAResults("TCaseFailed")) + 1
        grsTSResults("TCaseFailed") = CInt(grsTSResults("TCaseFailed")) + 1
    End If
    
End If
    
  ' Track NoRun TestStep count
  intNoRunCnt = CInt(grsTCResults("TStepsTotal")) - (CInt(grsTCResults("TStepsPassed")) _
                 + CInt(grsTCResults("TStepsFailed")) + CInt(grsTCResults("TStepsError")) + CInt(grsTCResults("TStepsDataError")))

  'Store Run Details of Current Testcase for Reporting
  grsTCResults("TStepsNoRun") = intNoRunCnt
  grsTCResults("EndTime") = Now
  grsTCResults("TCaseStatus") = strTCaseResult
  grsTCResults("Message") = strExeMsg
    
  fnExecuteTCase = strTCaseResult
End Function

'***********************************************************************
'@ Name: fnExecuteTStep
'@ Purpose: Execute Specified TestStep of a Testcase
'@ Inputs : i. strTStepID : StepID to be executed
' ii. strAction : Action name
' iii.dicTStepDetails : Dictionary of TestStep details
' iv. strTStepDesc :StepId Description
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call fnExecuteTStep("STEP001", "LaunchApp, arryStepDetails, "Launch application" )
'@modifications:
' Raghu, 19th May 14, Initial
' Raghu, 16th June 14, Enhanced the Code with appropriate comments & minor logical changes
'***********************************************************************
Private Function fnExecuteTStep(strTStepID, strAction, dicTStepDetails, strTStepDesc)
Dim strTStepResult 'Holds TestStep Result
Dim strExeMsg 'Holds the TestStep Execution Message
Dim strBC 'Business Component Name
Dim screenShotPath 'File Path to store Screenshot during error or failure

    grsTStepResults.AddNew
    grsTStepResults("BatchID") = grsBAResults("BatchID")
    grsTStepResults("TSuiteID") = grsTSResults("TSuiteID")
    grsTStepResults("TCaseID") = grsTCResults("TCaseID")
    grsTStepResults("TStepID") = strTStepID
    grsTStepResults("TStepDesc") = strTStepDesc
    grsTStepResults("StartTime") = Now
    
    gstrActionCompleteMsg = gEMPTY  'Holds the complete message of executed Action
    gstrActionMsg = gEMPTY      'Holds the message of executed Action
    
    On Error Resume Next
    'Execute Teststep which could be Business Component or direct Action.
    'So accordingly respective codes have been saved.
    
    If UCase(strAction) = "RUNBC" Then
        strBC = dicTStepDetails("PARA_1")
        Call SetRptNode("BC-" & strBC, "Executing   Action" & strAction, micDone)
        grsTStepResults("Action") = strAction & "-" & strBC
        grsTStepResults("TStepIsBC") = True
        strTStepResult = fnExecuteBC(strBC, dicTStepDetails)
    Else
    Call SetRptNode("AC-" & strAction, "Executing   Action" & strAction, micDone)
        grsTStepResults("TStepIsBC") = False
        grsTStepResults("Action") = strAction
        strTStepResult = fnExecuteAction(strAction, dicTStepDetails)
        grsTStepResults("ActionCompleteMsg") = gstrActionCompleteMsg
        grsTStepResults("ActionMsg") = gstrActionMsg
    End If
    Reporter.UnSetContext
    ' -----------------------------------------------------
    ' Error Handling and Logging
    ' -----------------------------------------------------
    If Err.Number <> 0 Then
        strExeMsg = "Execution failed for TStep ID '" + strTStepID _
                & "' as error occured when executing this TestStep;  Error Details : " _
                   & Err.Number & "   -  " & Err.Description
                
        Logger "ERROR", "Runtime Error", strExeMsg
        strTStepResult = "ERROR"
        Err.Clear
    End If
    
    ' ------------Evalaute Result----------------------
    Select Case UCase(strTStepResult)
        Case "PASS"
            grsTCResults("TStepsPassed") = CInt(grsTCResults("TStepsPassed")) + 1
            grsTStepResults("TStepStatus") = "PASS"
            strExeMsg = "TestStep execution was Successful"
            
        Case "FAIL"
            grsTCResults("TStepsFailed") = CInt(grsTCResults("TStepsFailed")) + 1
            grsTStepResults("TStepStatus") = "FAIL"
            If strExeMsg = gEMPTY Then strExeMsg = "TestStep execution Failed"
            
        Case "ERROR"
            grsTCResults("TStepsError") = CInt(grsTCResults("TStepsError")) + 1
            grsTStepResults("TStepStatus") = "ERROR"
            If strExeMsg = gEMPTY Then strExeMsg = "Error Occured during TestStep execution"
            
            
        Case "DATA_ERROR"
            grsTCResults("TStepsDataError") = CInt(grsTCResults("TStepsDataError")) + 1
            grsTStepResults("TStepStatus") = "DATA_ERROR"
            If strExeMsg = gEMPTY Then strExeMsg = "Invalid Data during TestStep execution"
            
    End Select
            
            
    If UCase(strTStepResult) <> "PASS" Then
    '----Capture Screenshot when there is Error or Failure----------
        'screenShotPath = gdConfig("screenshot_dir") & gstrTestExeID _
         '                & "_" & grsTStepResults("BatchID") & "_" & grsTStepResults("TSuiteID") _
          '               & "_" & grsTStepResults("TCaseID") _
           '              & "_" & strTStepID & ".jpg"

        'Call CaptureScreenshot(screenShotPath)

' grsTStepResults("ScreenshotPath") = CaptureScreenshot( gdConfig("screenshot_dir") )
End If

    'Store Run Details of Current TestStep for Reporting
    grsTStepResults("Message") = strExeMsg
    grsTStepResults("EndTime") = Now
    fnExecuteTStep = grsTStepResults("TStepStatus")

End Function
'***********************************************************************
'@ Name: fnExecuteBC
'@ Purpose: Execute the specified Business Component
'@ Inputs : i. "strBCID" : Business Component ID to be executed
' ii. "dicBCDetails" : Business Component details in a dictionary"
'@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call fnExecuteBC("BC_001", dicBCDetails)
'@modifications:
' Raghu, 19th May 14, Initial
' Raghu, 17th June 14, Enhanced the Code with appropriate comments & minor logical changes
'***********************************************************************

Private Function fnExecuteBC(strBCID, dicBCDetails)

    Dim blnAllStpExecuted   'Indicate wheither all the BPC TestStep are executed or Not
    Dim strBCResult         'Holds Business component Result
    Dim strBCStepQuery      'SQL Query To extract List of Business Process steps of specified business component
    Dim rsBCStepList        'Recordset to hold Business Component Step list
    Dim screenShotPath      'File Path to store Screenshot during error or failure
    Dim strExeMsg            'Holds the TestSuite Execution Message
    Dim intNoRunCnt          'Hold number of NoRun BC TestStep count
    Dim dicBCStepDetails
    Dim intCnt
    Dim strBCStepResult
    Dim strBCStepID
    Dim strBCStepDesc
    Dim strAction
    Dim Field
    
    
    blnAllStpExecuted = False
    
    On Error Resume Next
    
    'strBCResult = "FAIL"
    
    grsBCResults.AddNew
    grsBCResults("BatchID") = grsBAResults("BatchID")
    grsBCResults("TSuiteID") = grsTSResults("TSuiteID")
    grsBCResults("TCaseID") = grsTCResults("TCaseID")
    grsBCResults("TStepID") = grsTStepResults("TStepID")
    grsBCResults("BCID") = strBCID
    grsBCResults("StartTime") = Now

    Set dicBCStepDetails = CreateObject("Scripting.Dictionary")
      'Call SetRptNode("BCStepID-" & strBCID, "Executing   BCStepID" &  strBCID, micDone)
    Logger "INFO", "Start-BC", "Started Execution of Business Component'" & dicBCDetails("Para_1") & "'"
    
    'Extract all the Business component steps into the RecordSet
    
    ' S Indicates Business component Step table
    ' I Indicates Business component Info table
    strBCStepQuery = "Select  *  from [" & strBCID & "$] as S, [BC_INFO$] as I " _
                & "where  I.BC_ID = '" & strBCID & " ' AND S.EXECUTE_FLAG = 'Y' AND I.EXECUTE_FLAG = 'Y' " _
                & "Order by S.EXECUTE_ORDER;"
   
    Set rsBCStepList = CreateObject("ADODB.RecordSet")
    rsBCStepList.Open strBCStepQuery, gcnnBC, gAD_OPEN_STATIC, gAD_LOCK_OPTIMISTIC, gAD_CMD_TEXT
    grsBCResults("BCStepsTotal") = rsBCStepList.RecordCount
    
    
    'If there are no BCSteps to execute, then report error and skip Batch Execution
     If rsBCStepList.RecordCount <= 0 Then
        strBCResult = "DATA_ERROR"
        strExeMsg = "No Business Component Steps are available to execute for Business Component  :- " & strBCID
    Else
        ' -----------------------------------------------------
        ' Iterate through each BCStep and Call executeAction Function
        ' -----------------------------------------------------
        For intCnt = 0 To rsBCStepList.RecordCount - 1 'objRecordset.fields.item(1).properties.count
            strBCStepResult = "FAIL"
            
            gstrActionCompleteMsg = gEMPTY
            gstrActionMsg = gEMPTY
            
            strBCStepID = rsBCStepList.Fields("BC_STEP_ID")
            strAction = rsBCStepList.Fields("ACTION")
            strBCStepDesc = rsBCStepList.Fields("BC_STEP_DESC")
        
            grsBCStepResults.AddNew
            grsBCStepResults("BatchID") = grsBCResults("BatchID")
            grsBCStepResults("TSuiteID") = grsBCResults("TSuiteID")
            grsBCStepResults("TCaseID") = grsBCResults("TCaseID")
            grsBCStepResults("TStepID") = grsBCResults("TStepID")
            grsBCStepResults("BCID") = grsBCResults("BCID")
            grsBCStepResults("BCStepID") = strBCStepID
            grsBCStepResults("BCStepStatus") = strBCStepResult
            grsBCStepResults("Action") = strAction
            grsBCStepResults("BCStepDesc") = strBCStepDesc
            grsBCStepResults("StartTime") = Now
            Call SetRptNode("BCStep-" & strBCStepID, "Executing   BC Step" & strBCStepID, micDone)
                
            Logger "INFO", "Start-BCStep", "START of  Business Component of STEP ID : '" & strBCStepID & "'"
            
            dicBCStepDetails.RemoveAll
            For Each Field In rsBCStepList.Fields
                If Trim(Field.Name) <> gEMPTY Then
                        dicBCStepDetails(UCase(Trim(Field.Name))) = Field.Value
                End If
            Next
            
            strBCStepResult = fnExecuteAction(strAction, dicBCStepDetails)
            
            grsBCStepResults("ActionCompleteMsg") = gstrActionCompleteMsg
            grsBCStepResults("ActionMsg") = gstrActionMsg
            
            '------------Evalaute BCStep Level Result----------------------
            Select Case UCase(strBCStepResult)
                Case "FAIL"
                    strBCStepResult = "FAIL"
                    grsBCResults("BCStepsFailed") = CInt(grsBCResults("BCStepsFailed")) + 1
                Case "DATA_ERROR"
                    strBCStepResult = "DATA_ERROR"
                    grsBCResults("BCStepsDataError") = CInt(grsBCResults("BCStepsDataError")) + 1
                Case "ERROR"
                    strBCStepResult = "ERROR"
                    grsBCResults("BCStepsError") = CInt(grsBCResults("BCStepsError")) + 1
                Case "PASS"
                    strBCStepResult = "PASS"
                    grsBCResults("BCStepsPassed") = CInt(grsBCResults("BCStepsPassed")) + 1
            End Select
            
            If strBCStepResult <> "PASS" Then
                strBCResult = strBCStepResult
                '----Capture Screenshot when there is Error or Failure at BCStep Level----------
              '  screenShotPath = gdConfig("screenshot_dir") & gstrTestExeID _
               '          & "_" & grsBCResults("BatchID") & "_" & grsBCResults("TSuiteID") _
                '         & "_" & grsBCResults("TCaseID") & "_" & grsBCResults("TStepID") & "_" & grsBCResults("BCID") _
                 '        & "_" & strBCStepID & ".jpg"

                'Call CaptureScreenshot(screenShotPath)

' grsBCStepResults("ScreenshotPath") = CaptureScreenshot( gdConfig("screenshot_dir") )
End If

            Logger "INFO", "End-BCStep", "END of BC STEP Execution ; BC STEP ID  := '" & strBCStepID _
                        & "' test action=: '" & strAction & "' is complete" _
                        & "' ; RESULT is : '" & strBCStepResult & "'"
            'Store Run Details of Current BCStep  for Reporting
            Reporter.UnSetContext
            
            grsBCStepResults("EndTime") = Now
            grsBCStepResults("BCStepStatus") = strBCStepResult
        
    
            If (rsBCStepList.Fields("EXIT_ON_FAILURE") = "Y") And _
                (strBCStepResult <> "PASS") Then
                Exit For
            End If
            rsBCStepList.MoveNext
    Next
        blnAllStpExecuted = rsBCStepList.EOF

' If blnAllStpExecuted and (strBCStepResult="PASS") Then
'
' strBCResult="PASS"
'
' End If

   End If
    ' -----------------------------------------------------
    ' Error Handling and Logging
    ' -----------------------------------------------------
    If Err.Number <> 0 Then
         strExeMsg = "Execution failed for Business Component  ID '" + grsBCResults("BCID") _
                & "' as error occured when executing this Busines Component;  Error Details : " _
                & Err.Description
                
         Logger "ERROR", "RunTime Error", strExeMsg
         strBCResult = "ERROR"
         Err.Clear
    End If
    '------------Evalaute BC Level Result----------------------
    If ((strBCResult <> "FAIL") And (strBCResult <> "ERROR") And (strBCResult <> "DATA_ERROR") And blnAllStpExecuted) Then
            strBCResult = "PASS"
             strExeMsg = "Business Component execution was successfull"
    Else
        '----Capture Screenshot when there is Error or Failure at BC Level----------
       '  screenShotPath = gdConfig("screenshot_dir") & gstrTestExeID _
        '                 & "_" & grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") _
         '                & "_" & grsTCResults("TCaseID") & "_" & grsTStepResults("TStep_ID") _
          '                & "_" & grsBCResults("BCID") & ".jpg"

         'Call CaptureScreenshot(screenShotPath)

' grsBCResults("ScreenshotPath") = CaptureScreenshot( gdConfig("screenshot_dir") )

         If (strBCResult = "ERROR") Then
            If strExeMsg = gEMPTY Then
                strExeMsg = "Error Occured during Business Component execution"
            End If
        ElseIf (strBCResult = "FAIL") Then
                strExeMsg = "Business Component execution was Failed"
        ElseIf (strBCResult = "DATA_ERROR") Then
                strExeMsg = "Business Component execution was Failed due to Invalid Data"
        End If
    End If
    'Track NoRun Testcase count
    intNoRunCnt = CInt(grsBCResults("BCStepsTotal")) - CInt((grsBCResults("BCStepsPassed")) _
                + CInt(grsBCResults("BCStepsFailed")) + CInt(grsBCResults("BCStepsError")) + CInt(grsBCResults("BCStepsDataError")))
    
    'Store Run Details of Current BC  for Reporting
    grsBCResults("BCStepsNoRun") = intNoRunCnt
    grsBCResults("EndTime") = Now
    grsBCResults("Message") = strExeMsg
    grsBCResults("BCStatus") = strBCResult
        
    
    Logger "INFO", "End-BC", "END of Business Component STEP ID :  '" & grsBCResults("BCID") & "'" & "Execution RESULT is " & grsBCResults("BCStatus")
        
fnExecuteBC = strBCResult

End Function
'***********************************************************************
'@ Name: fnExecuteAction
'@ Purpose: Execute the specified Action
'@ Inputs : i. "strAction" : Action to be executed
' ii. "dictActionDetails" : Action Details in a dictionary"
'@ Returns : "Based on the excution result, it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call fnExecuteAction("LaunchApp", dictActionDetails)
'@modifications:
' Raghu, 19th May 14, Initial
' Raghu, 23rd June 14, Enhanced the Code with appropriate comments & minor logical changes
'***********************************************************************
Private Function fnExecuteAction(strAction, dictActionDetails)
Dim strActionResult 'Holds Action Result
Dim intParaCnt 'Holds Parameter Count
Dim intCnt
Dim strFunctionStatement 'Function Statment to be executed
Dim strParameter 'Action Parameter Name
Dim strExeMsg
'Dim screenShotPath

    strActionResult = "FAIL"

    Logger "INFO", "Start -Action", "START of  Test Action execution ; TEST ACTION : = '" + strAction + "'"
    On Error Resume Next
    Dim testKey
    testKey = dictActionDetails.keys
    'Check Action properties exist to get the Parameter count of an Action
    If gdActionPrp.Exists(LCase(strAction)) Then
        intParaCnt = CInt(gdActionPrp(LCase(strAction)))
        strFunctionStatement = strAction
        Do While (intParaCnt > 0)
               
        ' Dynamically build Action name and associated Parameters
        For intCnt = 1 To intParaCnt
            
             If intCnt = 1 Then strFunctionStatement = strFunctionStatement & "("
            
            If Trim(dictActionDetails("PARA_" & intCnt)) = gEMPTY Then
                strParameter = Chr(34) & Chr(34)
               Else
                strParameter = Chr(34) & Trim(GetTheValue(dictActionDetails("PARA_" & intCnt))) & Chr(34)
            End If
            strFunctionStatement = strFunctionStatement & strParameter
            
            If intCnt < intParaCnt Then
                strFunctionStatement = strFunctionStatement & ","
            Else
                strFunctionStatement = strFunctionStatement & ")"
            End If
        Next

' msgbox strFunctionStatement
Exit Do
strFunctionStatement = strFunctionStatement
Loop
' msgbox strFunctionStatement
strActionResult = Eval(strFunctionStatement)

    Else
        'Report Error if Parameters details for Action is not defined,
        strActionResult = "DATA_ERROR"
        strExeMsg = "Property for Action " & strAction & " has not been defined"
        gstrActionCompleteMsg = strExeMsg
        gstrActionMsg = strExeMsg
        Logger "DATA_ERROR", "DataError", strExeMsg
    End If
    ' -----------------------------------------------------
    ' Error Handling and Logging
    ' -----------------------------------------------------
    If Err.Number <> 0 Then
        strExeMsg = "Execution failed for Action '" + strAction _
                & "' as error occured when executing this Action;  Error Details : " _
                & Err.Number & " - " & Err.Description
                
        Logger "ERROR", "RunTime Error", strExeMsg
        strActionResult = "ERROR"
        Err.Clear
    End If
    '------------Evalaute Action Result----------------------
    If UCase(strActionResult) <> "ERROR" And UCase(strActionResult) <> "FAIL" And UCase(strActionResult) <> "DATA_ERROR" Then
            strActionResult = "PASS"
            strExeMsg = "Successfully Executed Action " & strActionResult
    Else
                '----Capture Screenshot when there is Error or Failure ----------

' screenShotPath = gdConfig("screenshot_dir") & gstrTestExeID _
' & "" & grsBAResults("BatchID") & "" & grsTSResults("TSuiteID") _
' & "" & grsTCResults("TCaseID") & "" & grsTStepResults("TStep_ID") _
' & "_" & grsBCResults("BCID") & ".jpg"

         grsBCResults("ScreenshotPath") = CaptureScreenshot(gdConfig("screenshot_dir"))
        
    End If
    
    Logger "INFO", "End-Action", "END of TestAction Execution ; TEST ACTION := '" & strActionResult _
                & "' ; RESULT is : '" & UCase(strActionResult) & "'"
                
    fnExecuteAction = strActionResult

End Function

'''GenAction

''*****************************************************************************************
Option Explicit

'*************************************************************************************
' GenActions.vbs contains all the generic action or keyword functions

'List of functions
'----------------------------------------------------------------------------
' LaunchApp(strBrowser,strURL) - Keyword to Launch Web Application
' SetText(strObject, strInputValue) - Keyword to SetText for a Test Object
' SetData(strDataType, strKey, strValue) - Keyword to SetData in a global memory
' LoadData(strDTSource, strDType, strDTID) - Load Test Data which could be Test/BusinessComponent/RunTime Data
' SetSecureText(strObject, strInputValue) - Keyword to Set Secure Text for a Test Object mainly passwords
' VerifyObjectsExist(strObject, strExpectedValue, intWaitingTime) - Keyword to verify whether an Object exists at the Run Time or Not
' VerifyObjectProperty(strObject, strPropertyName, strExpectedValue, strValCondition) - Keyword to verify whether an Object exists at the Run Time or Not
' GetObjPropertyValue(strObject, strPropertyName, stgVariableName) - Keyword to get runtime value of an Object property
' Click(strObject, strCoordinates) - Keyword to Click on a particular object with given coordinates
' TypeText(strObject, strInputValue) - Keyword to Type for a Test Object
' SetFocus(strObject) - Keyword to Set Focus on a particular object
' SendKeys(strObject, strKey) -Keyword to Send keyboard input to a particular object
' ActivateWindow(strObject) - Activate Window
' CloseWindow(strObject) - Keyword to close window
' mClick(strObject, strCoordinates) - Keyword to Click on a particular object with given coordinates
' ScrollPage(StrobjField, strValue)-Keyword to scroll page
' SetCheckBox(strObject, stronoroff)-Checks or UNcheks the check box
'SetRadioButton(strObject,index)- Sets the radio button value
'SelectItem(strObject, StrListitem)-Selecys the option from a drop down or a list box
' mVerifyText (StrobjField, intTopRow, intLeftCol, intBottomRow, intRightCol, strExpectedValue, strValCondition) - Keyword to 'verify the text in screen
'ClickLinkinTable(strObject, strsearchtext, strsearchtxtcolumn , strlinkcolumn)-Click a link in a wetable
'Gettablecellvalue(strObject, row_num,col_num) Gets the value of a cell in a webtable
'Settablecellvalue(strObject, row_num,col_num,objtype,index)-sets a value for an object in a webtable
'SetMultipleValues( strObjIDs, strValues, strDelimiter) -sets values to different objects in the AUT
'mSendKeys(strObject, strKey)-Mainframe specifc Key word to pass function keys
'SetValues( strObjIDs, strValues)-- a coomon key word to set value for indivisual object
'mScreenAlign(strObject,scrnID)- Mainframe specific keyword which sets the screen back to the index screen
'SetMultipleObjVerfication( strObjIDs,strDelimiter)-- Verifyes the existance of muliple objects

'***********************************************************************
'@ Name: LaunchApp
'@ Purpose: Keyword to Launch Web Application
'@ Inputs : i. "strURL": URL of the application to be launched
'@ ii. " strBrowser" : Type of Browser i.e. IE, FF
'@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call LaunchWebApp("http://www.Google.com" , "IE")
'@modifications:
' Raghu, 9th April 14, Initial
'***********************************************************************

Public Function LaunchApp(strBrowser, strURL)

    Dim strResult
    Dim strActionInfo
    Dim strRptMsg

    
    strActionInfo = "Action Name:=LaunchApp : URL:=" & strURL & " for strBrowser:= " & strBrowser
    
    On Error Resume Next
    Logger "INFO", "LaunchApp - Start", "Executing Action,  Details :- " & strActionInfo

    If Err.Number <> 0 Then
        strResult = "DATA_ERROR"
        strRptMsg = "Test Data Provided is Incorrect, Please refer log"
        LaunchApp = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
        Exit Function
   End If
        
       
    If Trim(strBrowser) = gEMPTY Then
             strResult = "DATA_ERROR"
             strRptMsg = "User has not defined the browser to be launched"
    Else
        Select Case UCase(strBrowser)
            Case "IE"
                Systemutil.Run gdConfig("ie_program_path"), strURL
                strResult = "PASS"
            Case "FF"
                Systemutil.Run gdConfig("ff_program_path"), strURL
                strResult = "PASS"
             Case "MF"
                Systemutil.Run gdConfig("mf_path")
                strResult = "PASS"
              Case "WIN"
                Systemutil.Run strURL
                strResult = "PASS"
        End Select
    End If
         
    LaunchApp = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
    Wait (4)

End Function

'***********************************************************************
'@ Name: SetText
'@ Purpose: Keyword to SetText for a Test Object
'@ Inputs : i. "strObject": "Name of the Test Object for text is being set"
'@ ii. "strInputValue" : Text Value being set
'@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SetText("txtLn_Username" , "Tester")
'@modifications:
' Raghu, 9th April 14, Initial
'***********************************************************************

Public Function SetText(strObject, strInputValue)

    Dim strResult
    Dim objTest
    Dim strActionInfo
    Dim strRptMsg, intWaitingTime
    
    strActionInfo = "Action Name:=SetText : Value:=" & strInputValue & " for TestObject:= " & strObject

    
    On Error Resume Next
    Logger "INFO", strActionInfo & "- Start", "Executing Action, Details :- " & strActionInfo

   
   intWaitingTime = gObjWaitTime
    'Get TestObject
    Set objTest = GetTheObject(strObject)
    
    If objTest.Exist(intWaitingTime) Then
        objTest.Set strInputValue
        strResult = "PASS"
    Else
        strRptMsg = "TestObject  := " & strObject & "does not exist"
        strResult = "FAIL"
    End If
    
    
    SetText = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
    Wait (4)

End Function

'***********************************************************************
'@ Name: Closewin
'@ Purpose: Keyword to Close the active wiondow
'@ Inputs : i. "strObject": "Name of the Test Object for text is being set"
'@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call Closewin("txtLn_Username" )
'@modifications:
' Raghu, 9th April 14, Initial
'***********************************************************************

Public Function Closewin(strObject)

    Dim strResult
    Dim objTest
    Dim strActionInfo
    Dim strRptMsg, intWaitingTime
    
    strActionInfo = "Action Name:=Closewin :" & " for TestObject:= " & strObject

    
    On Error Resume Next
    Logger "INFO", strActionInfo & "- Start", "Executing Action, Details :- " & strActionInfo

' intWaitingTime = gObjWaitTime
' 'Get TestObject
' Set objTest = GetTheObject(strObject)
'
' If objTest.Exist(intWaitingTime) Then
' objTest.Close
' strResult = "PASS"
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
' SystemUtil.CloseProcessByName Chr(34) & strObject & Chr(34)
SystemUtil.CloseProcessByName ("'"& strObject & "'")
SetText = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)
End Function

'***********************************************************************
'@ Name: SetData
'@ Purpose: Keyword to SetData in a global memory
'@ Inputs : i. "strDataType": Type of Data under which it would stored "BC/TD/RD/VR"
' ii. "strKey" : "Key which is would used for identification
'@ ii. "strValue" : Text Value being set
'@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SetText("txtLn_Username" , "Tester")
'@modifications:
' Raghu, 9th April 14, Initial
'***********************************************************************

Public Function SetData(strDataType, strKey, strValue)
Dim strResult
Dim strActionInfo
Dim strRptMsg

   strActionInfo = "Action Name:=SetData : for DataType:=" & strDataType _
                    & " with Key:= " & strKey & " with Value:= " & strValue

    
    On Error Resume Next
    Logger "INFO", "Executing Action, Details :- " & strActionInfo
    
  
           Select Case Trim(UCase(strDataType))
                Case "BC"
                    gdBCata(strKey) = strValue
                Case "TD"
                    gdTData(strKey) = strValue
                Case "RD"
                    gdRData(strKey) = strValue
                Case "VR"
                    Executestatement strKey & "=" & strValue
             End Select
          
    SetData = fnEvalActionResult(strActionInfo, strResult, strRptMsg)

Wait (4)
End Function
'***********************************************************************
'@ Name: LoadData()
'@ Purpose: Load Test Data which could be Test/BusinessComponent/RunTime Data
'@ Inputs : i. "strDTSource": URL of the application to be launched
'@ ii. "strResult" : Type of Browser i.e. IE, FF
'@ iii. "strRptMsg" :
'@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call fnEvalActionResult("http://www.Google.com" , "IE")
'@modifications:
' Raghu, 20th April 14, Initial
'***********************************************************************
Public Function LoadData(strDTSource, strDType, strDTID)

   Dim strResult
   Dim strQuery
   Dim strActionInfo
   Dim strRptMsg
   Dim intCounter
   Dim intCnt
   Dim strKeyValue
   Dim arrKeyValue
   Dim recTData

   
   strActionInfo = "Action Name:=LoadData : for DTSource:=" & strDTSource _
                    & " with DType:= " & strDType & " with DTID:= " & strDTID

    
   On Error Resume Next
   Logger "INFO", "Executing Action, Details :- " & strActionInfo, "  "
     
   '------------------------------------------------
   ' if there are any error while extacting the actual data
   ' Report Error and exit
   If strDTID = gEMPTY Then
        strResult = "DATA_ERROR"
        strRptMsg = "DataID Provided is Incorrect DATAID :- " & strDTID
        LoadData = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
        Exit Function
   End If
    
   
        
   'Query for Data Source Path is needed.
         strQuery = "select * from [" & strDTSource & "$]  where DataID ='" & strDTID & "'"
                        
        Set recTData = CreateObject("ADODB.RecordSet")
        recTData.Open strQuery, gcnnTD, gAD_OPEN_STATIC, gAD_LOCK_OPTIMISTIC, gAD_CMD_TEXT
        Logger "INFO", "Data extracted into recorded for TestDataID " & strDTID, "Test data"
        intCounter = 1

        recTData.MoveFirst
        
        If recTData.RecordCount < 0 Then
                    strResult = "DATA_ERROR"
                    strRptMsg = "No Data exists for DATAID :- " & strDTID
                    recTData.Close
                    Set recTData = Nothing
                    LoadData = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
                    Exit Function
        End If

' For intCounter = 0 To recTData.RecordCount - 1

            Select Case UCase(strDType)
                Case "TD"
                    'Clear Test Data Dictionary
                    gdTData.RemoveAll
                    
                Case "BC"
                    'Clear Business Component Data Dictionary
                    gdBCData.RemoveAll
            
            End Select
        
         intCnt = 1
             
                'Load Key & Value pair
                For intCnt = 1 To recTData.Fields.Count - 1
                    strKeyValue = Trim(recTData.Fields(intCnt))
                    
                    If strKeyValue <> gEMPTY Then
                        arrKeyValue = Split(strKeyValue, "=", 2)
                        
                        If UBound(arrKeyValue) = 1 Then
                            arrKeyValue(0) = Trim(arrKeyValue(0))
                            Logger "INFO", "Storing Testcase data values in Dictionary Table", " "
                            Select Case UCase(strDType)
                                Case "TD"
                                    arrKeyValue(1) = Trim(arrKeyValue(1))
                                    gdTData(LCase(arrKeyValue(0))) = arrKeyValue(1)
                                    Logger "INFO", "Test data Value " & arrKeyValue(1) & " Stored in memory field " & arrKeyValue(0), " "
                                Case "BC"
                                    arrKeyValue(1) = Trim(arrKeyValue(1))
                                    gdBCata(LCase(arrKeyValue(0))) = arrKeyValue(1)
                                    Logger "INFO", "Module data Value " & arrKeyValue(1) & " Stored in memory field " & arrKeyValue(0), " "
                            End Select
                        Else
                            strResult = "DATA_ERROR"
                            strRptMsg = "Key value passed in Input data table is Invalid " & strKeyValue
                            Exit For
                        End If

' Else
' strResult = "DATA_ERROR"
' strRptMsg = "Key value passed in Input data table is EMPTY"
' Exit For
End If
Next

' Next

        recTData.Close
        Set recTData = Nothing
        If strResult <> "DATA_ERROR" Then
                strResult = "PASS"
        End If

 LoadData = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
 Wait (4)

End Function
'***********************************************************************
'@ Name: SetSecureText
'@ Purpose: Keyword to Set Secure Text for a Test Object mainly passwords
'@ Inputs : i. "strObject": "Name of the Test Object for text is being set"
'@ ii. "strInputValue" : Text Value being set in encrypted format
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SetSecureText("txtLn_Username" , "Tester")
'@modifications:
' Amit, 22nd April 14, Initial
'***********************************************************************
Public Function SetSecureText(strObject, strInputValue)
Dim strResult
Dim objTest
Dim strActionInfo
Dim strRptMsg

strActionInfo = "Action Name:=SetSecureText : Value:=" & strInputValue & " for TestObject:= " & strObject

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "  "

    
    
'Get TestObject
Set objTest = GetTheObject(strObject)

If objTest.Exist(gObjWaitTime) Then
    objTest.SetSecure (strInputValue)
    strResult = "PASS"
Else
    strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If
    
SetSecureText = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function

'***********************************************************************
'@ Name: VerifyObjectsExist
'@ Purpose: Keyword to verify whether an Object exists at the Run Time or Not
'@ Inputs : i. "strObject": "Name of the Test Object verification"
'@ ii. "strExpectedValue" whether it should exits or not
'@ iii. "intWaitingTime" : Time in Seconds for QTP to wait
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call VerifyObjectsExist("txtLn_Username" ,30) or Call VerifyObjectsExist("txtLn_Username" ,"30")
'@modifications:
' Amit, 22nd April 14, Initial
'***********************************************************************
Public Function VerifyObjectsExist(strObject, strExpectedValue, intWaitingTime)
Dim strResult
Dim objTest
Dim strActionInfo
Dim strRptMsg

strActionInfo = "Action Name:=VerifyObjectsExist check:" & strExpectedValue & " waiting time :=" & intWaitingTime & " for TestObject:= " & strObject

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, " "

'Extract Input Value
intWaitingTime = GetTheValue(intWaitingTime)
If intWaitingTime = gEMPTY Then intWaitingTime = gObjWaitTime

'Get TestObject
Set objTest = GetTheObject(strObject)

  If objTest.Exist(intWaitingTime) Then
    If StrComp(strExpectedValue, "exist", 1) = 0 Then
        strResult = "PASS"
    Else
        strRptMsg = "TestObject  := " & strObject & "should not exist but it exists"
        strResult = "FAIL"
    End If
Else
    If StrComp(strExpectedValue, "notexist", 1) = 0 Then
        strResult = "PASS"
    Else
        strRptMsg = "TestObject  := " & strObject & "does not exist"
        strResult = "FAIL"
    End If
End If

VerifyObjectsExist = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function
'***********************************************************************
'@ Name: VerifyObjectProperty
'@ Purpose: Keyword to verify whether an Object exists at the Run Time or Not
'@ Inputs : i. "strObject": "Name of the Test Object whose property need to be verified"
'@ ii. "strPropertyName": Name of the property of the object that need to be varified
'@ iii. "strExpectedValue": Expected value of the property
'@ iv. "strValCondition": Condition for validation ex. equals, Contains
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call VerifyObjectProperty("txtLn_Username" ,"InnerText","QTP","Equals")
'@modifications:
' Amit, 22nd April 14, Initial
'***********************************************************************
Public Function VerifyObjectProperty(strObject, strPropertyName, strExpectedValue, strValCondition)
Dim strResult
Dim objTest
Dim strActionInfo
Dim strActualValue, srtLenOfExp
Dim regEx, retVal, RegExp
Dim strRptMsg, intWaitingTime

strActionInfo = "Action Name:=VerifyObjectProperty Property=:" & strPropertyName _
                & " Expected Value:=" & strExpectedValue & " matching condition:=" _
                & strValCondition & " for TestObject:= " & strObject

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "  "

intWaitingTime = gObjWaitTime
' if there are any error while extacting the actual data
' Report Error and exit
If Trim(strPropertyName) = gEMPTY Then
strResult = "DATA_ERROR"
strRptMsg = "Test Data Provided is Incorrect, Please refer log"
VerifyObjectProperty = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Exit Function
End If

If strValCondition = gEMPTY Then
    strValCondition = "Equals"
End If

Set objTest = GetTheObject(strObject)

If objTest.Exist(intWaitingTime) Then
    strActualValue = objTest.GetROProperty(strPropertyName)
Select Case UCase(strValCondition)
    Case "EQUALS"
        If StrComp(strActualValue, strExpectedValue) = 0 Then
            strResult = "PASS"
        Else
            strRptMsg = "TestObject  := " & strObject & " property " & strPropertyName & " value " & strExpectedValue & " not " & strValCondition & " actual value " & strActualValue
            strResult = "FAIL"
        End If
    Case "CONTAINS"
        If InStr(1, strActualValue, strExpectedValue, 0) > 0 Then
            strResult = "PASS"
        Else
            strRptMsg = "TestObject  := " & strObject & " property " & strPropertyName & " value " & strExpectedValue & " not " & strValCondition & " actual value " & strActualValue
            strResult = "FAIL"
        End If
    Case "BEGINSWITH"
        srtLenOfExp = StrLen(strExpectedValue)
        If StrComp(Left(strActualValue, srtLenOfExp), strExpectedValue) = 0 Then
            strResult = "PASS"
        Else
            strRptMsg = "TestObject  := " & strObject & " property " & strPropertyName & " value " & strExpectedValue & " not " & strValCondition & " actual value " & strActualValue
            strResult = "FAIL"
        End If
    Case "ENDSWITH"
        srtLenOfExp = StrLen(strExpectedValue)
        If StrComp(Right(strActualValue, srtLenOfExp), strExpectedValue) = 0 Then
            strResult = "PASS"
        Else
            strRptMsg = "TestObject  := " & strObject & " property " & strPropertyName & " value " & strExpectedValue & " not " & strValCondition & " actual value " & strActualValue
            strResult = "FAIL"
        End If
    Case "REGEXPON"
        Set regEx = New RegExp
        'regEx.IgnoreCase=True
        regEx.Global = True
        regEx.Pattern = strExpectedValue
        retVal = regEx.Execute(strActualValue).Count
        If retVal > 0 Then
            strResult = "PASS"
        Else
            strRptMsg = "TestObject  := " & strObject & " property " & strPropertyName & " value " & strExpectedValue & " not " & strValCondition & " actual value " & strActualValue
            strResult = "FAIL"
        End If
        
        Set regEx = Nothing

    Case Else
        strRptMsg = "TestObject  := " & strObject & " Validation condition " & strValCondition & " not valid."
        strResult = "FAIL"
    End Select
    
Else
    strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If

VerifyObjectProperty = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function

'***********************************************************************
'@ Name: GetObjPropertyValue
'@ Purpose: Keyword to get runtime value of an Object property
'@ Inputs : i. "strObject": "Name of the Test Object whose property need to be verified"
'@ ii. "strPropertyName": Name of the property of the object
'@ iii. "strVariableName": variable name where the property will be stored
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call GetObjPropertyValue("txtLn_Username" ,30) or Call GetObjPropertyValue("txtLn_Username" ,"30")
'@modifications:
' Amit, 22nd April 14, Initial
'***********************************************************************
Public Function GetObjPropertyValue(strObject, strPropertyName, strVariableName)
Dim strResult
Dim objTest
Dim strActionInfo
Dim strTempValue
Dim strRptMsg
Dim intWaitingTime

strActionInfo = "Action Name:=GetObjPropertyValue Property=:" & strPropertyName & " for TestObject:= " & strObject

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "  "

intWaitingTime = GetTheValue(intWaitingTime)
If intWaitingTime = gEMPTY Then intWaitingTime = gObjWaitTime

'------------------------------------------------
' if there are any error while extacting the actual data
' Report Error and exit
If Trim(strPropertyName) = gEMPTY Then
    strResult = "DATA_ERROR"
    strRptMsg = "Test Data Provided is Incorrect, Please refer log"
    GetObjPropertyValue = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
    Exit Function
End If

Set objTest = GetTheObject(strObject)

If objTest.Exist(intWaitingTime) Then
    strTempValue = objTest.GetROProperty(strPropertyName)
    gdRData(LCase(strVariableName)) = strTempValue
    strResult = "PASS"

' Environment("PassData")=strTempValue
Else
strRptMsg = "TestObject := " & strObject & "does not exist"
strResult = "FAIL"
End If

GetObjPropertyValue = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function
'***********************************************************************
'@ Name: Click
'@ Purpose: Keyword to Click on a particular object with given coordinates
'@ Inputs : i. "strObject": "Name of the Test Object to be clicked"
'@ ii. "strCoordinates" : X and Y Coordinates of the Object
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call Click("btn_Login" ,"150,340")
'@modifications:
' Amit, 22nd April 14, Initial
'***********************************************************************
Public Function Click(strObject, strCoordinates)
Dim strResult
Dim objTest
Dim strActionInfo
Dim strTempArray, strXCord, strYCord
Dim strRptMsg
Dim intWaitingTime

strActionInfo = "Action Name:=Click : for TestObject:= " & strObject & " with Coordinates := " & strCoordinates

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, ""

intWaitingTime = GetTheValue(intWaitingTime)
If intWaitingTime = gEMPTY Then intWaitingTime = gObjWaitTime
    
If strCoordinates <> gEMPTY Then
    strTempArray = Split(strCoordinates, ",")
    strXCord = strTempArray(0)
    strYCord = strTempArray(0)
Else
    strXCord = 0
    strYCord = 0
End If
'Get TestObject
Set objTest = GetTheObject(strObject)

If objTest.Exist(intWaitingTime) Then
    If CInt(strXCord) > 0 And CInt(strYCord) > 0 Then
        objTest.Click strXCord, strYCord
        strResult = "PASS"
    Else
        objTest.Click
        strResult = "PASS"
    End If
Else
    strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If
    
Click = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function

'***********************************************************************
'@ Name: TypeText
'@ Purpose: Keyword to Type for a Test Object
'@ Inputs : i. "strObject": "Name of the Test Object for text is being typed"
'@ ii. "strInputValue" : Text Value being typed
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call TypeText("txtLn_Username" , "Tester")
'@modifications:
' Raghu, 9th April 14, Initial
'***********************************************************************
Public Function TypeText(strObject, strInputValue)
Dim strResult
Dim objTest
Dim strActionInfo
Dim strRptMsg

    strActionInfo = "Action Name:=Type : Value:=" & strInputValue & " for TestObject:= " & strObject

    
    On Error Resume Next
    Logger "INFO", "Executing Action, Details :- " & strActionInfo, " "
    
    'Extract Input Value
    strInputValue = GetTheValue(strInputValue)
    
    '------------------------------------------------
    ' if there are any error while extacting the actual data
    ' Report Error and exit
    If Err.Number <> 0 Then
        strResult = "DATA_ERROR"
        strRptMsg = "Test Data Provided is Incorrect, Please refer log"
        TypeText = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
        Exit Function
    End If
    
    'Get TestObject
    Set objTest = GetTheObject(strObject)
    
    If objTest.Exist(gObjWaitTime) Then
        objTest.Type strInputValue
        strResult = "PASS"
    Else
        strRptMsg = "TestObject  := " & strObject & "does not exist"
        strResult = "FAIL"
    End If
    
    
    TypeText = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
    Wait (4)
    
End Function

'***********************************************************************
'@ Name: SetFocus
'@ Purpose: Keyword to Set Focus on a particular object
'@ Inputs : i. "strObject": "Name of the Test Object which need to be focused"
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SetFocus("btn_Login")
'@modifications:
' Amit, 22nd April 14, Initial
'***********************************************************************
Public Function SetFocus(strObject)
Dim strResult
Dim objTest
Dim strActionInfo
Dim strRptMsg

strActionInfo = "Action Name:=SetFocus : on TestObject:= " & strObject

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "  "

'Get TestObject
Set objTest = GetTheObject(strObject)

If objTest.Exist(intWaitingTime) Then
    objTest.FireEvent "onfocus" '''' need to check which will work for both Web And Window
    'objTest.SetToProperty "Focus",True
    'objTest.SetFocus
    'objTest.object.Focus
    strResult = "PASS"
Else
    strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If
    
SetFocus = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function

'***********************************************************************
'@ Name: SendKeys
'@ Purpose: Keyword to Send keyboard input to a particular object
'@ Inputs : i. "strObject": Name of the Test Object.
'@ : ii. "strKey": The key to pass to the script
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SendKeys("WenEdit_Login","F11")
'@modifications:
' Amit, 22nd April 14, Initial
'***********************************************************************
Public Function SendKeys(strObject, strKey)
Dim strResult
Dim objTest
Dim strActionInfo
Dim strRptMsg

strActionInfo = "Action Name:=SendKeys : key : " & strKey & " on TestObject:= " & strObject

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "   "

strKey = GetTheValue(strKey)

'------------------------------------------------
' if there are any error while extacting the actual data
' Report Error and exit
If Err.Number <> 0 Then
        strResult = "DATA_ERROR"
        strRptMsg = "Test Data Provided is Incorrect, Please refer log"
        SendKeys = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
        Exit Function
End If
    
'Get TestObject
Set objTest = GetTheObject(strObject)

If objTest.Exist(intWaitingTime) Then
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.SendKeys Chr(34) & strKey & Chr(34)
    Wait 2
    Set WshShell = Nothing

    strResult = "PASS"
Else
    strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If
    Wait (4)
SendKeys = fnEvalActionResult(strActionInfo, strResult, strRptMsg)

End Function

'***********************************************************************
'@ Name: ActivateWindow
'@ Example : Call ActivateWindow(strObject)
' Asim, 9th April 14, Initial
'***********************************************************************
Public Function ActivateWindow(strObject)

Dim strResult
Dim objTest
Dim strActionInfo
Dim hWnd
Dim strRptMsg

strActionInfo = "Action Name:= ActivateWindow for TestObject:= " & strObject

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "  "
'Get Test Object'
Set objTest = GetTheObject(strObject)
                        
hWnd = strObject.GetROProperty("hWnd")
                        
If objTest.Exist(gObjWaitTime) Then
    Window("hwnd:=" & hWnd).Activate
    strResult = "PASS"
Else
    strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If
ActivateWindow = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function

'***********************************************************************
'@ Name: CloseWindow
'@ Purpose: Keyword to close window
'@ Inputs : "strObject":window name
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call CloseWindow(wnd_Flight)
'@ Modifications:
' Shiva, 23th April 14, Initial
'***********************************************************************
Public Function CloseWindow(strObject)

    Dim strResult
    Dim objTest
    Dim strActionInfo
    Dim strhWnd
    Dim strRptMsg
    
    strActionInfo = "Action Name:= CloseWindow for TestObject:= " & strObject

    On Error Resume Next
    Logger "INFO", "Executing Action, Details :- " & strActionInfo
    
            'Get TestObject
    Set objTest = GetTheObject(strObject)
    
    strhWnd = strObject.GetROProperty("hWnd")
    
    If objTest.Exist(gObjWaitTime) Then
        Window("hwnd:=" & strhWnd).Close
        strResult = "PASS"
    Else
        strRptMsg = "TestObject  := " & strObject & "does not exist"
        strResult = "FAIL"
    End If
            
    CloseWindow = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
    Wait (4)

End Function

'***********************************************************************
'@ Name: mClick
'@ Purpose: Keyword to Click on a particular object with given coordinates
'@ Inputs : I. "strObject": "Name of the Test Object to be clicked"
'@ ii. "strCoordinates" : X and Y Coordinates of the Object
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call mClick("mfr_CoreApp" ,"10,15")
'@modifications:
' Amit, 22nd April 14, Initial
'***********************************************************************
Public Function mClick(strObject)
Dim strResult
Dim objTest
Dim strActionInfo
Dim strTempArray, intWaitingTime
Dim strRptMsg

            strActionInfo = "Action Name:=mClick :" & " for TestObject:= " & strObject

intWaitingTime = gObjWaitTime

            On Error Resume Next
            Logger "INFO", "Executing Action, Details :- " & strActionInfo, " "
            
            Set objTest = GetTheObject(strObject)
            
            If objTest.Exist(intWaitingTime) Then
                     
                                            objTest.Click
                                            strResult = "PASS"
            Else
                            strRptMsg = "TestObject  := " & strObject & "does not exist"
                            strResult = "FAIL"
            End If
                            
            mClick = fnEvalActionResult(strActionInfo, strResult, strRptMsg)

Wait (4)

End Function

'***********************************************************************
'@ Name: ScrollPage
'@ Purpose: Keyword to scroll page
'@ Inputs : I. "StrobjField": "Name of the Test Object on which scrollpage is performed"
'@ ii. "strValue" : Text Value being set
'@ Returns : "Based on the execution it would result in PASS/FAIL"
'@ Example : Call ScrollPage("Scrll_Object" , "pageLeft")
'@modifications:
' Shiva, 23th April 14, Initial
'***********************************************************************
Public Function ScrollPage(StrobjField, strValue)

    Dim strResult
    Dim objTest
    Dim strActionInfo
    Dim strRptMsg
    
    strActionInfo = "Action Name:= ScrollPage : Value:=" & strValue & " for TestObject:= " & StrobjField

    
    On Error Resume Next
    Logger "INFO", "Executing Action, Details :- " & strActionInfo, " "
    
    
    'Extract Input Value
    strValue = GetTheValue(strValue)
    'Get TestObject
    Set objTest = GetTheObject(StrobjField)
    
    If objTest.Exist(gObjWaitTime) Then
        objTest.Object.body.doScroll ("strValue")
        strResult = "PASS"
    Else
        strRptMsg = "TestObject  := " & StrobjField & "does not exist"
        strResult = "FAIL"
    End If
    
    
    ScrollPage = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
    Wait (4)

End Function

'***********************************************************************
'@ Name: SetCheckBox
'@ Purpose: function to check or uncheck a CheckBox
'@ Inputs : i. "strObject": "Name of the Test Object to be clicked"
'@ "Stronoroff" "Set the check box status"
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SetCheckBox("chkisMale",ON)
'@modifications:
'***********************************************************************
Public Function SetCheckBox(strObject, stronoroff)

Dim strResult
Dim objTest
Dim strActionInfo
Dim strTempArray, strXCord, strYCord
Dim strRptMsg

strActionInfo = "Action Name:=SetCheckBox  : for TestObject:= " & strObject & " status := " & stronoroff

On Error Resume Next

Logger "INFO", "Executing Action, Details :- " & strActionInfo


'Get TestObject
Set objTest = GetTheObject(strObject)

If objTest.GetROProperty("micclass") = "WebCheckBox" Then ObjectIsCheckBox = True Else ObjectIsCheckBox = False
    
If objTest.Exist(gObjWaitTime) And ObjectIsCheckBox Then

    Select Case LCase(Trim(ONorOFF))
            Case "on"
                objTest.Set "On"
                strResult = "PASS"
            Case "off"
                objTest.Set "Off"
                strResult = "PASS"
            Case Else
                strResult = "Fail"
    End Select

Else

    strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
    
End If
    
SetCheckBox = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function

'***********************************************************************
'@ Name: SetRadioButton
'@ Purpose: function to select a radio button
'@ Inputs : i. "strObject": "Name of the Test Object to be clicked"
'@ "index" "index of radiobutton in radio group
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SetRadioButton("rdmale",1)
'@modifications:
'***********************************************************************
Public Function SetRadioButton(strObject, index)
Dim strResult
Dim objTest
Dim strActionInfo
Dim strTempArray, strXCord, strYCord
Dim strRptMsg

strActionInfo = "Action Name:=SetRadioButton  : for TestObject:= " & strObject & " number := " & index

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "Selection of Radio Button"


'Get TestObject
Set objTest = GetTheObject(strObject)


If objTest.Exist(gObjWaitTime) Then
    objTest.Select index
    strResult = "PASS"
    
Else
    strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If
    
SetRadioButton = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function

'***********************************************************************
'@ Name: Select
'@ Purpose: function to select a value from weblist or combolist
'@ Inputs : i. "strObject": "Name of the Test Object to be clicked"
'@ "StrListitem" "particular value for the object"
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call Select(weblisttestobject or wincomboboxtestobject,"Mysore")
'@modifications:
'***********************************************************************
Public Function SelectItem(strObject, StrListitem)
Dim strResult
Dim objTest
Dim strActionInfo
Dim itemfromList
Dim ValidObject
Dim ListCount
Dim Liststart
Dim Listend
Dim strRptMsg
Dim List
Dim currentitem

itemfromList = False
ValidObject = False

strActionInfo = "Action Name:=Select  : for TestObject:= " & strObject & "List := " & StrListitem

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "STart selecting the Value"


'Get TestObject
Set objTest = GetTheObject(strObject)

If objTest.Exist(gObjWaitTime) Then

    Select Case objTest.GetROProperty("micclass")

            Case "WebList"

                ListCount = objTest.GetROProperty("items count")
                Liststart = 1
                Listend = ListCount
                ValidObject = True
            
            Case "WinComboBox"

                ListCount = objTest.GetROProperty("items count")
                Liststart = 0
                Listend = ListCount - 1
                ValidObject = True
                
            Case Else

             strResult = "Fail"
            
    End Select
    
If ValidObject Then
    For List = Liststart To Listend
    currentitem = objTest.Getitem(List)
    If StrComp(Trim(currentitem), Trim(StrListitem), 1) = 0 Then
    objTest.Select currentitem
    strResult = "PASS"
    Exit For
    End If
Next
End If
ElseIf Not objTest.Exists Then
strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If
    
SelectItem = fnEvalActionResult(strActionInfo, strResult, strRptMsg)

Wait (4)

End Function

'***********************************************************************
'@ Name: ClickLinkinTable
'@ Purpose: function to click a link in a table
'@ Inputs : i. "strObject": "Name of the Test Object to be clicked"
'@ "strsearchtext" "search for particular text"
' "strsearchtxtcolumn" "specify the column where text to be searched as long"
' "strlinkcolumn" "specify the column where link is reside as long"
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call ClickLinkinTable(Table,"Suresh",2,3)
'@modifications:
'***********************************************************************
Public Function ClickLinkinTable(strObject, strsearchtext, strsearchtxtcolumn, strlinkcolumn)
Dim strResult
Dim objTest
Dim strActionInfo
Dim itemfromList
Dim ValidObject
Dim strRptMsg

itemfromList = False
ValidObject = False

strActionInfo = "Action Name:=ClickLinkinTable  : for TestObject:= " & strObject & "text := " & strsearchtext
On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo


'Get TestObject
Set objTest = GetTheObject(strObject)
'get the value
Set strsearchtext = GetTheValue(strsearchtext)


If objTest.Exist(gObjWaitTime) Then
    Matchfound = False
    Totalrows = objTest.RowCount
    For crow = 1 To Totalrows
    If strsearchtext = Trim(objTest.Getcelldata(crow, strsearchtxtcolumn)) Then
        Foundrow = crow
        Matchfound = True
        Exit For
    End If
    Next
If Matchfound Then
    Set Linkobjct = objTest.Childitem(Foundrow, strlinkcolumn, "Link", 0)
    Linkobjct.Click
    strResult = "PASS"
ElseIf Not Matchfound Then
    strResult = "FAIL"
End If
ElseIf Not objTest.Exists Then
strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If
    Wait (4)
ClickLinkinTable = fnEvalActionResult(strActionInfo, strResult, strRptMsg)

End Function

'***********************************************************************
'@ Name: Gettablecellvalue
'@ Purpose: function to get a vlue of particular cell
'@ Inputs : i. "strObject": "Name of the Test Object "
'@ "row_num" "row number of webtable"
' "col_num" "column numbe rof web table"
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call Gettablecellvalue(Table,2,3)
'@modifications:
'***********************************************************************
Public Function Gettablecellvalue(strObject, row_num, col_num)
Dim strResult
Dim objTest
Dim strActionInfo
Dim itemfromList
Dim ValidObject
Dim strRptMsg

itemfromList = False
ValidObject = False

strActionInfo = "Action Name:=Gettablecellvalue  : for TestObject:= " & strObject & "text := " & strsearchtext
On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo


'Get TestObject
Set objTest = GetTheObject(strObject)


If objTest.Exist(gObjWaitTime) Then
    Set Text = objTest.Getcelldata(row_num, col_num)
    MsgBox "It contains " & Text
    strResult = "PASS"
ElseIf Not objTest.Exists Then
strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If
    
Gettablecellvalue = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function

'***********************************************************************
'@ Name: Settablecellvalue
'@ Purpose: function to set a value of particular cell if it's web edit,
'@ Inputs : i. "strObject": "Name of the Test Object "
'@ "row_num" "row number of webtable"
' "col_num" "column number of web table"
' "objtype" Type of object
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call Settablecellvalue(Table,2,3,"Link",0)
'@modifications:
'***********************************************************************
Public Function Settablecellvalue(strObject, row_num, col_num, objtype, index)
Dim strResult
Dim objTest
Dim strActionInfo
Dim itemfromList
Dim ValidObject
Dim strRptMsg

itemfromList = False
ValidObject = False

strActionInfo = "Action Name:=Settablecellvalue  : for TestObject:= " & strObject
On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo


'Get TestObject
Set objTest = GetTheObject(strObject)


If objTest.Exist(gObjWaitTime) Then
    Set Item = objTest.Childitem(row_num, col_num, objtype, index)
If (objtype = "Link" Or objtype = "Webedit") Then
    Item.Click
    strResult = "PASS"
    ElseIf (objtype = "WebcheckBox") Then
    Item.Set "ON"
    strResult = "PASS"
End If
ElseIf Not objTest.Exists Then
strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
End If
    
Settablecellvalue = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function

'***********************************************************************
'@ Name: SetMultipleValues
'@ Purpose: Keyword to Setvalues for multiple fields
'@ Inputs : i. "strDelimiter": The seperator which diffrentiates the object and values "||/;"
' ii. "strObjIDs" : "different Objects for which values needs to be set
'@ ii. "strValues" :Values for differnt fileds
'@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SetMultipleValues("||","||txtLn_Username||Password" , "||Tester||Password")
'@modifications:
' Raghu, 16th Sep 14,
'***********************************************************************
Public Function SetMultipleValues(strObjIDs, strValues, strDelimiter)
Dim strResult
Dim objTest
Dim strActionInfo
Dim arrObjects
Dim arrValues
Dim strRptMsg
Dim strObjType
Dim strValue
Dim intObj

strActionInfo = "Action Name:=Setting Values for Multiple Object "

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "  "

If Trim(strDelimiter) = gEMPTY Then strDelimiter = "||"

arrObjects = Split(strObjIDs, strDelimiter)
arrValues = Split(strValues, strDelimiter)

        
        If UBound(arrObjects) <> UBound(arrValues) Then
            strResult = "DATA_ERROR"
            strRptMsg = "Mismatch in the Object to Value count"
            SetMultipleValues = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
            Exit Function
        End If
        
For intObj = 1 To UBound(arrObjects)
    If Trim(arrObjects(intObj)) <> gEMPTY Then
        Set objTest = GetTheObject(LCase(Trim(arrObjects(intObj))))
        
        If Err.Number <> 0 Then
            strResult = "DATA_ERROR"
            strRptMsg = "Test Object " & strObject & " not defined in Object Defination file "
            SetMultipleValues = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
            Exit Function
        End If

         If objTest.Exist(gObjWaitTime) Then
            strObjType = objTest.GetROProperty("micClass")
            strValue = GetTheValue(LCase(arrValues(intObj)))

            Select Case Trim(UCase(strObjType))
                Case "WEBEDIT", "WEBCHECKBOX"
                    objTest.Set strValue
                Case "WEBLIST", "WEBRADIOGROUP"
                    objTest.Select strValue
                Case "WinRadioButton"
                    objTest.Set strValue
            End Select
        Else
            strRptMsg = "TestObject  := " & strObject & "does not exist"
            strResult = "FAIL"
            Exit For
        End If
        Set objTest = Nothing
    End If
Next
    
    If strResult <> "FAIL" Then strResult = "PASS"

    SetMultipleValues = fnEvalActionResult(strActionInfo, strResult, strRptMsg)

Wait (4)
End Function
'*********************************************************************** ************************************************************

'************************************************************************************************************************************
'@ Name: SendKeys
'@ Purpose: Keyword to Send keyboard input to a particular object
'@ Inputs : i. "strObject": Name of the Test Object.
'@ : ii. "strKey": The key to pass to the script
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SendKeys("WenEdit_Login","F11")
'@modifications:
' Amit, 22nd April 14, Initial
'************************************************************************************************************************************
Public Function mSendKeys(strObject, strKey)
Dim strResult
Dim objTest
Dim strActionInfo, WshShell
Dim strRptMsg, intWaitingTime

strActionInfo = "Action Name:=SendKeys : key : " & strKey & " on TestObject:= " & strObject

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "   "

' strKey = GetTheValue(strKey)
intWaitingTime = gObjWaitTime
'------------------------------------------------
' if there are any error while extacting the actual data
' Report Error and exit
If Err.Number <> 0 Then
strResult = "DATA_ERROR"
strRptMsg = "Test Data Provided is Incorrect, Please refer log"
SendKeys = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Exit Function
End If

Set objTest = GetTheObject(strObject)

If objTest.Exist(intWaitingTime) Then

Select Case strKey

Case "TE_ENTER"
            objTest.SendKey TE_ENTER
            Wait 2
            strResult = "PASS"

Case "TE_PF3"
            objTest.SendKey TE_PF3
            Wait 2
            strResult = "PASS"
            
Case "TE_PF8"
            objTest.SendKey TE_PF8
            Wait 2
            strResult = "PASS"

Case "TE_CLEAR"
            objTest.SendKey TE_CLEAR
            Wait 2
            strResult = "PASS"

Case "TE_bon1"
            objTest.SendKey "bon1"
            Wait 2
            strResult = "PASS"

End Select

Else

    strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
    
End If

    Wait (2)
mSendKeys = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
Wait (4)

End Function

' **************** End Of Keyword******************************************************************************

'***********************************************************************
'@ Name: SetValues
'@ Purpose: Keyword to Setvalues for multiple fields
'@ Inputs : i. "strDelimiter": The seperator which diffrentiates the object and values "||/;"
' ii. "strObjIDs" : "different Objects for which values needs to be set
'@ ii. "strValues" :Values for differnt fileds
'@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SetMultipleValues("||","||txtLn_Username||Password" , "||Tester||Password")
'@modifications:
' Raghu, 16th Sep 14,
'***********************************************************************
Public Function SetValues(strObjIDs, strValues)
Dim strResult
Dim objTest
Dim strActionInfo
Dim arrObjects
Dim arrValues
Dim strRptMsg
Dim strObjType
Dim strValue
Dim intObj

strActionInfo = "Action Name:=Setting Values for Multiple Object "

On Error Resume Next

Logger "INFO", "Executing Action, Details :- " & strActionInfo, "  "

        If Err.Number <> 0 Then
            strResult = "DATA_ERROR"
            strRptMsg = "Test Object " & strObject & " not defined in Object Defination file "
            SetValues = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
            Exit Function
        End If
        
   Set objTest = GetTheObject(strObjIDs)
   
         If objTest.Exist(gObjWaitTime) Then
            strObjType = objTest.GetROProperty("micClass")

            Select Case Trim(UCase(strObjType))
                Case "WEBEDIT", "WEBCHECKBOX", "WINEDIT","WINCHECKBOX"
                    objTest.Set strValues
                Case "WEBLIST", "WEBRADIOGROUP"
                    objTest.Select strValues
                Case "WINRADIOBUTTON"
                    objTest.Set
            End Select
        Else
            strRptMsg = "TestObject  := " & strObject & "does not exist"
            strResult = "FAIL"

' Exit For
End If
Set objTest = Nothing

    If strResult <> "FAIL" Then strResult = "PASS"

    SetValues = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
    Wait (4)

End Function
'***********************************************************************

'***********************************************************************
'@ Name: mScreenAlign
'@ Purpose: realigns the screen to a disred state
'@ Inputs : i. "strObject": Name of the Test Object.it is better to create an object under the common Tewindow boject
'which is of type tescreen and set the regular expression for the text and tile of the object
'so that it can be used as general object
'@ : ii. "scrnID": The screen ID to be idenfified
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call mScreenAlign("WenEdit_Login","88506")
'@modifications:
' Navaneeth , 20th OCT 14, Initial
'***********************************************************************
Public Function mScreenAlign(strObject, scrnID)
Dim strResult, Res1
Dim objTest, strScrnID
Dim strActionInfo, WshShell
Dim strRptMsg, intWaitingTime

strActionInfo = "Action Name:=ScreenAlign : Window ID : " & scrnID & " on TestObject:= " & strObject

'Set strObject=TeWindow("TeWindow").TeScreen("Anyscreen")
Wait (4)
On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, " "

intWaitingTime = gObjWaitTime

If Err.Number <> 0 Then
        strResult = "DATA_ERROR"
        strRptMsg = "Test Data Provided is Incorrect, Please refer log"
        SendKeys = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
        Exit Function
End If


Set objTest = GetTheObject(strObject)


If objTest.Exist(intWaitingTime) Then

                Do
            
                        strScrnID = objTest.GetROProperty("screen id")
                        Res1 = StrComp(strScrnID, scrnID, 0)
                        If Res1 = 0 Then Exit Do
                        objTest.SendKey TE_PF10
                        Wait 2
                Loop
                
strResult = "PASS"

Else

    strRptMsg = "TestObject  := " & strObject & "does not exist"
    strResult = "FAIL"
    
End If

    Wait (4)

mScreenAlign = fnEvalActionResult(strActionInfo, strResult, strRptMsg)

End Function

' **************** End of Code************************************************************************************************************

'***********************************************************************
'@ Name: SetMultipleObjVerfication
'@ Purpose: Keyword to Setvalues for multiple fields
'@ Inputs : i. "strDelimiter": The seperator which diffrentiates the object and values "||/;"
' ii. "strObjIDs" : "different Objects for which values needs to be set
'@ ii. "strDelimiter" :a seperator used to distingvish the different objects
'@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call SetMultipleValues("||","||txtLn_Username||Password" , "||Tester||Password")
'@modifications:
' Navaneeth R D, 23rd Oct 2014,
'***********************************************************************
Public Function SetMultipleObjVerfication(strObjIDs, strDelimiter)
Dim strResult
Dim objTest
Dim strActionInfo
Dim arrObjects
Dim arrValues
Dim strRptMsg
Dim strObjType
Dim strValue
Dim intObj

strActionInfo = "Action Name:=Setting Values for Multiple Object "

On Error Resume Next
Logger "INFO", "Executing Action, Details :- " & strActionInfo, "  "

If Trim(strDelimiter) = gEMPTY Then strDelimiter = "||"

arrObjects = Split(strObjIDs, strDelimiter)

    
        If UBound(arrObjects) = gEMPTY Then
            strResult = "DATA_ERROR"
            strRptMsg = "There are no objects to verify"
            SetMultipleValues = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
            Exit Function
        End If
        
For intObj = 1 To UBound(arrObjects)
    If Trim(arrObjects(intObj)) <> gEMPTY Then
        Set objTest = GetTheObject(LCase(Trim(arrObjects(intObj))))
        
        If Err.Number <> 0 Then
            strResult = "DATA_ERROR"
            strRptMsg = "Test Object " & strObject & " not defined in Object Defination file "
            SetMultipleValues = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
            Exit Function
        End If

         If objTest.Exist(gObjWaitTime) Then

                strResult = "PASS"
                strRptMsg = "TestObject  := " & strObject & "does exist"
   
        Else
            strRptMsg = "TestObject  := " & strObject & "does not exist"
            strResult = "FAIL"
            Exit For
        End If
        Set objTest = Nothing
    End If
Next
    
    If strResult <> "FAIL" Then strResult = "PASS"

    SetMultipleValues = fnEvalActionResult(strActionInfo, strResult, strRptMsg)

Wait (4)
End Function

'***********************************************************************

'*************below Keywords needs to be evaluated as the similar ones already exist

'***********************************************************************
'@ Name: VerifyObjectValue
'@ Purpose: Verify the value displayed against a filed is as expected
'@ Inputs : i. "strObject": "Name of the Test Object verification"
'@ ii. "strExpectedValueA,strExpectedValueB" Value for comparision with the RO value
'@ iii. "CompTyp" : type of comparision that needs to be done
'@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call VerifyObjectsExist("txtLn_Username" ,30) or Call VerifyObjectsExist("txtLn_Username" ,"30")
'@modifications:
' Amit, 22nd April 14, Initial
'***********************************************************************
'Public Function VerifyObjectValue(strObject, strExpectedValueA,strExpectedValueB,CompTyp)
' Dim strResult
' Dim objTest, tPos,tLen,tExtract,intWaitingTime
' Dim strActionInfo,Res1,Res2
' Dim strRptMsg,ROvalue
'
' strActionInfo = "Action Name:=VerifyObject Value check:" & strExpectedValueA & " for TestObject:= " & strObject
'
' On Error Resume Next
' Logger "INFO", "Executing Action, Details :- " & strActionInfo, " "
' intWaitingTime = gObjWaitTime
'
' 'Get TestObject
' Set objTest = GetTheObject(strObject)
'
' If objTest.Exist(intWaitingTime) Then
'
' ROvalue=objTest.GetROProperty("text")
'
'
' Select Case CompTyp
'
' Case "Dcomp"
'
' Res1=DateValue(strExpectedValueA)<DateValue(ROvalue)
' Res2=DateValue(ROvalue)<DateValue(strExpectedValueB)
'
' If (Res1 and Res2) = True Then
' strResult = "PASS"
' Else if (Res1 and Res2) <> True then
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
' End If
'
' Case "Scompcon"
'
' tPos=Instr(1,Trim(strExpectedValueA),Trim(ROvalue),1)
' tLen=Len(Trim(strExpectedValueA))
' tExtract=Mid(Trim(strExpectedValueA),tPos,tLen)
'
' Res1=Strcomp(Trim(strExpectedValueA),Trim(tExtract),0)
'
' If Res1=0 Then
' strResult = "PASS"
'
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
' Case "ScompExact"
'
' Res1=Strcomp(Trim(strExpectedValueA),Trim(ROvalue),0)
'
' If Res1=0 Then
' strResult = "PASS"
'
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
' Case "ScompBW"
'
' tLen=Len(Trim(strExpectedValueA))
' tExtract=Left(Trim(ROvalue),tLen)
'
' Res1=Strcomp(Trim(strExpectedValueA),Trim(tExtract),0)
'
' If Res1=0 Then
' strResult = "PASS"
'
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
' Case "ScompEW"
'
' tLen=Len(Trim(strExpectedValueA))
' tExtract=Right(Trim(ROvalue),tLen)
'
' Res1=Strcomp(Trim(strExpectedValueA),Trim(tExtract),0)
'
' If Res1=0 Then
' strResult = "PASS"
'
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
' Case "Acomp"
'
' If ROvalue<> gEMPTY Then
' strResult = "PASS"
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
'End Select
'End If
'
' VerifyObjectValue = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
' Wait(4)
'End Function
''*********************************************************************************************************************************************
'
'
'
''***********************************************************************
''@ Name: CompareText
''@ Purpose: Keyword to compare two text
''@ Inputs : i. "Refstr": environment variable from a different function
''@ ii. " CurText" : text to which it is compared
''@ iii"ExpRes if it is tru or false
''@ iv'Cpara specify if it needs to ingnore case or should check if it is exact match or contains
''@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
''@ Example : Call CompareText("apple" , "apple","True","exact")
''@modifications:
'' Raghu, 9th April 14, Initial
''***********************************************************************
'Public Function CompareText(Refstr, CurText,ExpRes, Cpara)
'
' Dim strResult
' Dim strActionInfo
' Dim strRptMsg
' Dim StrTxt2
' Dim Val1,Val2,Val3,CompRes
' Dim strVariableName
'' Environment("PassData")=StrTxt2
' StrTxt2=gdRData(strVariableName)
' strActionInfo = "Action Name:=CompareText : Text1:=" & Trim(Refstr) & " and Text2:= " & Trim(CurText)
'
' On Error Resume Next
' Logger "INFO", "CompareText - Start", "Executing Action, Details :- Comparing " & Refstr &"and"&CurText
'
'
' '------------------------------------------------
' ' if there are any error while extacting the actual data
' ' Report Error and exit
' If Err.Number <> 0 Then
' strResult = "DATA_ERROR"
' strRptMsg = "Test Data Provided is Incorrect, Please refer log"
' CompareText = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
' Exit Function
' End If
'
'
'
' If Trim(StrTxt2) = gEMPTY Then
' strResult = "DATA_ERROR"
' strRptMsg = "The required text is not captured"
'
' Else
'
'
' Select Case UCase(Cpara)
'
' Case "CONTAINS"
'
' Val1=Instr(1,Trim(StrTxt2),Trim(CurText),1)
' Val2=Len(Trim(CurText))
' Val3=Mid(Trim(StrTxt2),Val1,Val2)
'
' CompRes=Strcomp(Val3,Trim(CurText),1)
'
' If CompRes=0 Then
' CompRes="TRUE"
' Else
' CompRes="FALSE"
' End If
'
'
' If Strcomp(UCase(CompRes),Ucase( ExpRes),1) =0 Then
' strResult = "PASS"
' Else
' strResult="FAIL"
' End If
'
' Case "EXACT"
'
' CompRes=Strcomp(Trim(StrTxt2),Trim(CurText),1)
'
' If CompRes=0 Then
' CompRes="TRUE"
' Else
' CompRes="FALSE"
' End If
'
' If ComRes= ExpRes Then
' strResult = "PASS"
' Else
' strResult="FAIL"
' End If
'
' Case "IGCASE"
'
' CompRes=Strcomp(IgnoreCase(trim(StrTxt2)),IgnoreCase(Trim(CurText)),1)
'
' If CompRes=0 Then
' CompRes="TRUE"
' Else
'
' CompRes="FALSE"
' End If
'
'
' If ComRes= ExpRes Then
' strResult = "PASS"
' Else
' strResult="FAIL"
' End If
'
' End Select
'
' End If
'
' CompareText = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
' Wait(4)
'End Function
'
''***********************************************************************
'
''***********************************************************************************************************************************************
''@ Name: mGetTableData
''@ Purpose: realigns the screen to a disred state
''@ Inputs : i. "strObject": Name of the Test Object.it is better to create an object under the common Tewindow boject
' 'which is of type tescreen and set the regular expression for the text and tile of the object
' 'so that it can be used as general object
''@ : ii. "RowNo": the rwo number which needs to be scanned for comparision
''ColNO:Column number for data extrafction
''CompTyp:Comparision type
''scrnSet:Screen where the data needs to be extracted,
''DtInput1:Data input 1 for comparsion
''DtInput2:Data input 2 for comparision
''@ Returns : "Based on the execution it would result in PASS/FAIL/ERROR/DATA_ERROR"
''@ Example : Call mScreenAlign("WenEdit_Login","88506")
''@modifications:
'' Navaneeth , 20th OCT 14, Initial
''**************************************************************************************************************************************************
' Public Function mGetTableData(strObject, RowNo,ColNO, CompTyp, scrnSet,DtInput1,DtInput2,rMax)
' Dim strResult, Res1,Res2
' Dim objTest,ROvalue
' Dim strActionInfo, WshShell
' Dim strRptMsg, intWaitingTime
' Dim tPos, tLen,tExtract, teFldObj, i
'
' strActionInfo = "Action Name:=GetTableData with : Row no & Column No : " & RowNo &" & " & ColNO &" on TestObject:= " & strObject
'
'
' On Error Resume Next
'
' Logger "INFO", "Executing Action, Details :- " & strActionInfo, " "
'
' intWaitingTime=gObjWaitTime
'
' If Err.Number <> 0 Then
' strResult = "DATA_ERROR"
' strRptMsg = "Test Data Provided is Incorrect, Please refer log"
' SendKeys = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
' Exit Function
' End If
'
' Set objTest = GetTheObject(strObject)
'
'
'
' If objTest.Exist(intWaitingTime) Then
'
' If scrnSet <>"none" Then
' For k=1 to scrnSet
' objTest.SendKey TE_PF11
' Wait 2
' Next
' End If
'
'For i=RowNo to rMax
'
' Set teFldObj=Description.Create()
' teFldObj("text").Value=".*"
' teFldObj("start row").Value=RowNo
' teFldObj("start column").value=ColNO
'
' ROvalue=objTest.TeField(teFldObj).GetROProperty("text")
'
' Select Case CompTyp
'
' Case "Dcomp"
'
' Res1=DateValue(DtInput1)<DateValue(ROvalue)
' Res2=DateValue(ROvalue)<DateValue(DtInput2)
'
' If (Res1 and Res2) = True Then
' strResult = "PASS"
' Else if (Res1 and Res2) <> True then
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
' End If
'
' Case "Scompcon"
'
' tPos=Instr(1,Trim(ROvalue),Trim(DtInput1),1)
' tLen=Len(Trim(DtInput1))
' tExtract=Mid(Trim(ROvalue),tPos,tLen)
' Res1=Strcomp(Lcase(Trim(DtInput1)),Lcase(Trim(tExtract)),0)
'
' If Res1=0 Then
' strResult = "PASS"
' Exit for
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
' Case "ScompExact"
'
' Res1=Strcomp(Trim(DtInput1),Trim(ROvalue),0)
'
' If Res1=0 Then
' strResult = "PASS"
' Exit for
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
' Case "ScompBW"
'
' tLen=Len(Trim(DtInput1))
' tExtract=Left(Trim(ROvalue),tLen)
' Res1=Strcomp(Lcase(Trim(DtInput1)),Lcase(Trim(tExtract)),0)
'
'
' If Res1=0 Then
' strResult = "PASS"
' Exit for
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
' Case "ScompEW"
'
' tLen=Len(Trim(DtInput1))
' tExtract=Right(Trim(ROvalue),tLen)
' Res1=Strcomp(Lcase(Trim(DtInput1)),Lcase(Trim(tExtract)),0)
'
' If Res1=0 Then
' strResult = "PASS"
' Exit for
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
' Case "Acomp"
'
' If ROvalue<> gEMPTY Then
' strResult = "PASS"
' Else
' strRptMsg = "TestObject := " & strObject & "does not exist"
' strResult = "FAIL"
' End If
'
' End Select
'
'Next
'
' End If
' Wait(4)
' Set teFldObj=NOthing
'
' mGetTableData = fnEvalActionResult(strActionInfo, strResult, strRptMsg)
'
'End Function

''''GenUtility

''''************************************************************************************************

Option Explicit
'*************************************************************************************
' GenUtility.vbs contains all the generic action or keyword functions
'List of functions
'----------------------------------------------------------------------------GetTheObject(strObjectID) - To Get instance of Test Obejct using a Test ObjectString
' fnEvalActionResult(strActionInfo, strResult, strRptMsg) - Evaluate Keyword Action results , Report and handle Error
' GetTheValue(strInputValue) - To Get single value from reference values
' GetMultiValue(dRefValue) - To Get mutliple actual values from reference inputs
' SetRptNode("Library-Step", "Library Initalization", micDone) : Sets the Reporting Node against which all the subsequent reporting would be done till UnReporting Node is called
' Logger ("FATAL", "Failure", "Step Failed") :Function to Log
'CaptureScreen("Library-Step", "Library Initalization", micDone) : Create a screen print of the open application window
' ExportResultsToExcel("C:\Temp"): Exports Results Record Set to Excel file

'***********************************************************************
'@ Name: GetTheObject
'@ Purpose: To Get instance of Test Obejct using a Test ObjectString
'@ Inputs : i. "strObject": "Test object String which would be evaluated"
'@ Returns : Returns the Test object Instance
'@ Example : Call GetTheObject("Browser("Login").Page("Login").WebEdit("Username")")
'@modifications:
' Raghu, 1 June 2014, Initial
'***********************************************************************

Public Function GetTheObject(strObjectID)
Dim strObject ' Test Object String
Dim strValue
Dim objTest
On Error Resume Next

    Logger "INFO", "GetObject", "Getting the object : " & strObject
    strObjectID = Trim(strObjectID)
    
    If strObject <> gEMPTY Then
        Logger "DATA_ERROR", "GetObject-DataError", "Func GetTheObject: Test Object details are empty"
        Exit Function
    End If
     
     '------------Verify if the Indirect or direct object reference ----------
     
    If Mid(strObjectID, 1, 1) = Chr(34) And _
            Mid(strObjectID, Len(strObjectID) - 1, Len(strObjectID)) = Chr(34) Then
            strValue = Mid(strObjectID, 2, Len(strObjectID) - 1)
            blnfound = "True"
        strObject = strObjectID
    ElseIf gdTORef.Exists(LCase(strObjectID)) Then
         strObject = gdTORef(LCase(strObjectID))
    Else
        Logger "DATA_ERROR", "GetObject-DataError", "Func GetTheObject: Test Object details provided are not appropriate " & strObjectID
        Exit Function
    End If
    
    
     Set objTest = Eval(strObject)
     If Err.Number <> 0 Then
        Logger "ERROR", "RunTime Error", "Func GetTheObject: Err while gettting the object for " & strObject _
                            & " Error details: Err no- - " & Err.Number & " Error Description -  " & Err.Description
        Err.Clear
     Else
        Set GetTheObject = objTest
        Logger "INFO", "GetObject-Success", "Func GetTheObject:Successfully created the object :" & strObject & " from objectID " & strObjectID
     End If
     
     Set objTest = Nothing

End Function

'***********************************************************************
'@ Name: fnEvalActionResult
'@ Purpose: Evaluate Keyword Action results , Report and handle Error
'@ Inputs : i. "strActionInfo": URL of the application to be launched
'@ ii. "strResult" : Type of Browser i.e. IE, FF
'@ iii. "strRptMsg" :
'@ Returns : "Based on the excution it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call fnEvalActionResult("http://www.Google.com" , "IE")
'@modifications:
' Raghu, 20th April 14, Initial
'***********************************************************************
Public Function fnEvalActionResult(strActInfo, strResult, strRptMsg)

     If Err.Number <> 0 Then
              strResult = "ERROR"
     End If
     
     strRptMsg = "More Details:-'" & strRptMsg & "'"
   
     Select Case UCase(strResult)
     
        Case "ERROR"
              strRptMsg = "Runtime Error Occured, Error Details:-'" & Err.Number _
                            & " Error Description :  " & Err.Description & "'" _
                             & strRptMsg
              Err.Clear
        Case "DATA_ERROR"
              strRptMsg = "Failed to Perform Action due to INVALID Data," & strRptMsg
                            
        Case "FAIL", gEMPTY
              strResult = "FAIL"
              strRptMsg = "Failed to Perform Action," & strRptMsg
        Case Else
              strResult = "PASS"
              strRptMsg = "Successfuly performed action, " & strRptMsg
    End Select

    
    Logger strResult, strActInfo & " - Result", strRptMsg
    gstrActionCompleteMsg = strActInfo & vbCrLf _
                        & "Result:- " & strResult _
                        & "Details :- " & strRptMsg
                        
    gstrActionMsg = strRptMsg
    
    fnEvalActionResult = strResult

End Function

'***********************************************************************
'@ Name: GetTheValue
'@ Purpose: To Get single value from reference values
'@ Inputs : i. "dRefValue": "Dictionay of reference input values "
'@ Returns : Returns the dictionary of actual value or null.
'@ Example : Call GetTheValue(dRefValue)

'@modifications:
' Raghu, 1 June 2014, Initial
'***********************************************************************
Public Function GetTheValue(strInputValue)
Dim arrInput
Dim blnfound 'Flag to indicate if value could be found
Dim strMsg
Dim dActValues 'To store actual values
Dim colKeys
Dim strValue

    On Error Resume Next
    blnfound = False
    Logger "INFO", "GetTheValue", "Call for getTheValue function"
    
    
    
        strInputValue = Trim(strInputValue)
        ' --If Reference value is not empty
        If strInputValue <> gEMPTY Then
            
            ' --If Reference value has double Quotes as the starting chars
            '   consider it as actual value

' If Mid(strInputValue, 1, 1) = Chr(91) And _
' Mid(strInputValue, Len(strInputValue), Len(strInputValue)) = Chr(93) Then
' strValue = Mid(strInputValue, 2, Len(strInputValue) - 2)
' blnfound = "True"

' Else
' if the value passed is a reference value then
' they are split to understand to get actual value

                  If InStr(1, strInputValue, "_", 1) > 0 Then

                arrInput = Split(strInputValue, "_", 2)
                arrInput(0) = Trim(arrInput(0)) 'Type of data (BC,TD, ENV, Config)
                arrInput(1) = Trim(arrInput(1)) 'Field Name
                
                Select Case UCase(arrInput(0))
                    Case "BC"   'Business Component Level Data
                    
                        If gdBCata.Exists(LCase(arrInput(1))) Then
                            blnfound = "True"
                            strValue = gdBCata(LCase(arrInput(1)))
                             'strValue = gdBCata(arrInput(1))
                        Else
                            blnfound = "False"
                            strMsg = "Key Value " & arrInput(1) & " does not exist in Global Business Component DataSet "
                        End If
                    Case "TD" 'Testcase Level Data
                        If gdTData.Exists(LCase(arrInput(1))) Then
                            blnfound = "True"
                            strValue = gdTData(LCase(arrInput(1)))

' strValue = gdTData(arrInput(1))
Else
blnfound = "False"
strMsg = "Key Value " & arrInput(1) & " does not exist in Global TestDataSet "
End If

                    Case "RD" 'RunTime Data
                        If gdRData.Exists(LCase(arrInput(1))) Then
                            blnfound = "True"
                            strValue = gdRData(LCase(arrInput(1)))

' strValue = gdRData(arrInput(1))
Else
blnfound = "False"
strMsg = "Key Value " & arrInput(1) & " does not exist in Global RunTime DataSet "
End If

                    Case "ENV"  'Test Environment Specific data
                        If gdEnvData.Exists(LCase(arrInput(1))) Then
                            blnfound = "True"
                            strValue = gdEnvData(LCase(arrInput(1)))

' strValue = gdEnvData(arrInput(1))
Else
blnfound = "False"
strMsg = "Key Value " & arrInput(1) & " does not exist in Global Env Dictionary"
End If

                    Case "CNF" 'Configuration data
                        If gdtConfig.Exists(LCase(arrInput(1))) Then
                            blnfound = "True"
                            strValue = gdtConfig(LCase(arrInput(1)))

' strValue = gdtConfig(arrInput(1))
Else
blnfound = "False"
strMsg = "Key Value " & arrInput(1) & " does not exist in Global Config Dictionary"
End If
Case Else ' Global Variable
strValue = strInputValue
If Err.Number = 0 Then
blnfound = "True"
End If
End Select
Else
strValue = strInputValue
blnfound = "True"
End If
Else
blnfound = "True"
Logger "WARNING", "GetTheValue", "Input Value provided is blank"
strValue = strInputValue
End If

    ' -----------------------------------------------------
    ' Error Handling and Logging
    ' -----------------------------------------------------
    If Err.Number <> 0 Then
        blnfound = "ERROR"
        strMsg = "Input Value " & strInputValue & "Could not be retrieved " _
                & "Error Details , Err Number : " & Err.Number & " Description : " _
                & Err.Description
                
        Logger "Error", "GetTheValue-RunTimeError", strMsg
        Err.Clear
    End If
    
    
    If blnfound = "True" Then
        Logger "INFO", "GetTheValue -Found", "Input Value " & strInputValue & " retrieved successfully"
        ' strInputValue = blnfound & " | " & strInputValue
        GetTheValue = strValue
    Else
        Logger "FAIL", "GetTheValue -NotFound", "Input Value " & strInputValue & " Could not be retrieved " & strMsg
        ' strInputValue = blnfound & " | "
   End If

End Function

'***********************************************************************
'@ Name: SetRptNode
'@ Purpose: Sets the Reporting Node against which all the subsequent reporting would be done till UnReporting Node is called
'@ Inputs : i. "strNodeID": Node ID against which all the subsequent reporting would be done
' ii. "strNodeInfo" : Information about the Node
' iii "strStatus": Default Status of the Node
'@ Returns : N/A
'@ Example : Call SetRptNode("Library-Step", "Library Initalization", micDone)

'@modifications:
' Raghu, 1 August 2014, Initial
'***********************************************************************
Public Function SetRptNode(strNodeID, strNodeInfo, strStatus)
Dim dictRpt, intContext
Set dictRpt = CreateObject("Scripting.Dictionary")
dictRpt("Status") = strStatus
dictRpt("PlainTextNodeName") = strNodeID
dictRpt("StepHTMLInfo") = "

" & strNodeInfo & "

"
dictRpt("DllIconIndex") = "208"
dictRpt("DllIconSelIndex") = "208"
dictRpt("DllPath") = "C:\Program Files\HP\QuickTest Professional\bin\ContextManager.dll"
intContext = Reporter.LogEvent("User", dictRpt, Reporter.GetContext)
Reporter.SetContext intContext

End Function

'***********************************************************************
'@ Name: Logger
'@ Purpose: Function to Log
'@ Inputs : i. "strType": Logger Type (Possible Values : INFO, ERROR, DATA_ERROR, PASS, FAIL. FATAL, WARN)
' ii. "strStep" : Step details
' iii "strMsg": Message to be logged
'@ Returns : N/A
'@ Example : Call Logger ("FATAL", "Failure", "Step Failed"

'@modifications:
' Raghu, 1 August 2014, Initial
'***********************************************************************
Public Function Logger(strType, strStep, strMsg)
Select Case UCase(strType)
Case "INFO"
Reporter.ReportEvent micDone, strStep, "< " & strMsg & ""
Case "ERROR"
Reporter.ReportEvent micFail, strStep, "<" & strMsg & ""
Case "PASS"
Reporter.ReportEvent micPass, strStep, "<" & strMsg & ""
Case "FATAL"
Reporter.ReportEvent micFail, strStep, "<" & strMsg & ""
Case "FAIL"
Reporter.ReportEvent micFail, strStep, "<" & strMsg & ""
Case "WARN"
Reporter.ReportEvent micWarning, strStep, "<" & strMsg & ""
Case Else
Reporter.ReportEvent micDone, strStep, strMsg
End Select
End Function

'***********************************************************************
'@ Name: CaptureScreen
'@ Purpose: Create a screen print of the open application window
'@ Inputs : i. "sPath" : - Path to store the captured screenshot
'@ Returns : Filepath of the Captured Screen shot
'@ Example : Call CaptureScreen("Library-Step", "Library Initalization", micDone)

'@modifications:
' Raghu, 1 August 2014, Initial
'***********************************************************************
Public Function CaptureScreenshot(sPath)
Dim dTimestamp, sFileName
Dim oQTP

CaptureScreenshot = sFileName

' Exit Function

dTimestamp = DotNetFactory.CreateInstance("System.DateTime").Now.ToString("ddMMyyHHmmss")

sFileName = sPath & dTimestamp & ".png"
Set oQTP = CreateObject("QuickTest.Application")

oQTP.Visible = False: Wait 0, 500

' If IsObject( oSender ) Then
' oSender.CaptureBitmap sFileName, True
'Else
Desktop.CaptureBitmap sFileName, True
Reporter.ReportEvent micFail, "ScreenShot", "< img src =" & sFileName & ">"
'Reporter.ReportEvent micFail, "<img src =" & "'"&sFileName &"'"&">"
'End If
oQTP.Visible = True
CaptureScreenshot = sFileName
End Function

'***********************************************************************
'@ Name: ExportResultsToExcel
'@ Purpose: Exports Results Record Set to Excel file
'@ Inputs : i. "strFolderPath": Folder Path where Report need to be Saved
'@ Returns : N/A
'@ Example : Call ExportResultsToExcel("C:\Temp")

'@modifications:
' Raghu, 1 August 2014, Initial
'***********************************************************************
Public Sub ExportResultsToExcel(strFolderPath)

On Error Resume Next

Dim arrRST
Dim createExcel
Dim Existfilename, NewFileName
Dim Wbook
Dim Wsheet
Dim fieldIdx
Dim rowIdx
Dim i
Dim rst
Dim ws

arrRST = Array("grsBCStepResults", "grsBCResults", "grsTStepResults", "grsTCResults", "grsTSResults", "grsBAResults")

' Existfilename = strFolderPath & "Batch.xls"
NewFileName = strFolderPath & "ExeResults" & Hour(Now) & Minute(Now) & ".xls"
Set createExcel = CreateObject("Excel.Application")
createExcel.Visible = True

Set Wbook = createExcel.Workbooks.Add


For Each ws In Wbook.Worksheets

    If Wbook.Worksheets.Count > 1 Then
        ws.Delete
    End If
Next

For i = 0 To UBound(arrRST)

Set rst = Eval(arrRST(i) & ".Clone")


Set Wsheet = Wbook.Worksheets.Add


fieldIdx = 0
 'writing column headers
For fieldIdx = 0 To rst.Fields.Count - 1
        
        Wsheet.Cells(1, fieldIdx + 1).Value = rst.Fields(fieldIdx).Name

Next


' looping through rows and writing in spreadsheet

rowIdx = 0
If (rst.RecordCount > 0) Then
        
rst.MoveFirst

For rowIdx = 0 To rst.RecordCount - 1

  For fieldIdx = 0 To rst.Fields.Count - 1
            
    Wsheet.Cells(rowIdx + 2, fieldIdx + 1).Value = rst(fieldIdx).Value
    
    Next

    rst.MoveNext

  Next
End If
    Set rst = Nothing
    Wsheet.Name = Replace(arrRST(i), "grs", "")
Next
createExcel.DisplayAlerts = False
Wbook.SaveAs NewFileName

Wbook.Close False
createExcel.DisplayAlerts = True

Set Wbook = Nothing
Set Wsheet = Nothing
Set createExcel = Nothing

End Sub

' ****************************************** End of file ***********************************
'Initialize

''***************************************************************************

Option Explicit
'*************************************************************************************
' fnInitialize.vbs contains all the initialization files of the Framework

'List of functions
'----------------------------------------------------------------------------
' fnInitialize() - Initalize all the Global variables and libaries values
' fnLoadConfig() - Load Framework level configuration parameters into memory
' fnLoadLibrary() - Load all the library files into memory
' fnLoadEnvInfo()- Load Application Environment specific parameters into memory
' fnLoadTestOR()- Load Test Object Reference into memory
' fnLoadActionInfo()- Load Action related information into memory
' fnSetInitialReportInput() - Set Initial values for Test Execution Report Inputs.

'***********************************************************************
'@ Name: fnInitialize
'@ Purpose: Initalize all the variables and libaries valuesf
'@ Inputs : NA
'@ Returns : "Based on the excution, it would result in SUCCESS/ERROR"
'@ Example : Call fnInitialize()
'@modifications:
' Raghu, 9th May 14, Initial
'***********************************************************************
Public Function fnInitialize()

Dim strTRFilePath   ' TestRun File Path
Dim strBCFilePath   ' Business Component File Path
Dim strTDFilePath   ' TestData File Path
Dim strStatus               ' Function Execution Status
Dim arrLoadItems
Dim strMsg
Dim strLoadItem

gstrTestExeID = Month(Now) & Day(Now) & "_" & Hour(Now) & Minute(Now) & Second(Now)

strStatus = gEMPTY

gstrFuncRtnMsg = "Function : fnInitialize >>"

arrLoadItems = Array("fnLoadConfig",  "fnLoadEnvInfo", "fnLoadTestOR", "fnLoadActionInfo", "fnSetInitialReportInput")

' arrLoadItems = Array("fnLoadConfig", "fnLoadLibrary", "fnLoadEnvInfo", "fnLoadTestOR", "fnLoadActionInfo", "fnSetInitialReportInput")

For Each strLoadItem In arrLoadItems
    If UCase(Eval(strLoadItem)) <> "SUCCESS" Then
        strStatus = "FAILURE"
        strMsg = "Initialization Failed due to error while loading one of initialization file : - " & strLoadItem
        Logger "FATAL", strLoadItem & " - Failed", strMsg
        gstrFuncRtnMsg = gstrFuncRtnMsg & ">>" & strMsg
        fnInitialize = strStatus
        Exit Function
    End If
Next


If strStatus <> "FAILURE" Then

    'Setup Connection object for TestRun File
    strTRFilePath = gdConfig("aut_rootfolder") & gTRUN_FILENAME
    gcnnTestRun.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strTRFilePath & ";" _
                & "Extended Properties=""Excel 8.0;HDR=Yes;"";"

' gcnnTestRun.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & strTRFilePath & ";" _
' & "Extended Properties=""Excel 12.0;HDR=Yes;"";"

    'Setup Connection object for Business component File
    strBCFilePath = gdConfig("aut_rootfolder") & gBC_FILENAME
    gcnnBC.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strBCFilePath & ";" _
                & "Extended Properties=""Excel 8.0;HDR=Yes;"";"

' gcnnBC.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & strBCFilePath & ";" _
' & "Extended Properties=""Excel12.0;HDR=Yes;"";"

    'Setup Connection object for Test Data File
    
    strTDFilePath = gdConfig("aut_rootfolder") & Replace(gTD_FILENAME, "<<TEST_ENV>>", LCase(gdConfig("aut_environment")))
    gcnnTD.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strTDFilePath & ";" _
                & "Extended Properties=""Excel 8.0;HDR=Yes;"";"

' gcnnTD.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & strTDFilePath & ";" _
' & "Extended Properties=""Excel 12.0;HDR=Yes;"";"

End If

' -----------------------------------------------------
' Error Handling and Logging
' -----------------------------------------------------
If Err.Number <> 0 Then
    strStatus = "FAILURE"
    strMsg = "Error Occured when loading initalizing libraries" & "Error Details : " & Err.Description
    Logger "FATAL", "RunTime Error", strMsg
    gstrFuncRtnMsg = strMsg
    Err.Clear
Else
    strStatus = "SUCCESS"
    strMsg = "Successfuly loaded the initalizing libraries"
    Logger "INFO", "All Libraries Loaded", strMsg
    gstrFuncRtnMsg = strMsg
End If

fnInitialize = strStatus

End Function

'***********************************************************************
'@ Name: fnLoadConfig
'@ Purpose: Load Framework level configuration parameters into memory
'@ Inputs : NA
'@ Returns : "Based on the excution, it would result in SUCCESS/FAILURE"
'@ Example : Call fnLoadConfig()
'@modifications:
' Raghu, 9th May 14, Initial
'***********************************************************************
Private Function fnLoadConfig()
Dim strConfigSQLQuery 'SQL Query to access all the parameters of Config file
Dim rsConfigList 'Recordset to store Config Parameters
Dim strAUT
Dim strFilteredSQLQuery 'SQL Query to extract just AUT related Config Parameters
Dim strConfigFilePath 'Configuration File Path
Dim cnnConfig 'Connection Object
Dim intCnt
Dim strStatus 'Function Execution Status
Dim fso ' File System Object
Dim strParentFolder '
Dim strMsg
' On Error Resume Next
gstrFuncRtnMsg = "Function: fnLoadConfig"
strStatus = gEMPTY

Set fso = CreateObject("Scripting.FileSystemObject")
strConfigFilePath = fso.GetParentFolderName(Environment("TestDir")) & "" & gCONFIG_FILENAME
gdConfig("frameworkpath") = strConfigFilePath
gdConfig("enterprisepath") = fso.GetParentFolderName(strConfigFilePath)
'---- Get name of the AUT ----
Set cnnConfig = CreateObject("ADODB.Connection")
cnnConfig.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strConfigFilePath & ";" _
& "Extended Properties=""Excel 8.0;HDR=Yes;"";"

' cnnConfig.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & strConfigFilePath & ";" _
' & "Extended Properties=""Excel 12.0;HDR=Yes;"";"

strConfigSQLQuery = "Select * FROM [CONFIG$] Where PARAMETER = 'AUT' "

'---- Get Config parameters which are common and are related to AUT ----
Set rsConfigList = CreateObject("ADODB.RecordSet")
rsConfigList.Open strConfigSQLQuery, cnnConfig, gAD_OPEN_STATIC, gAD_LOCK_OPTIMISTIC, gAD_CMD_TEXT
intCnt = 0

If rsConfigList.RecordCount <= 0 Then
strStatus = "FAILURE"
strMsg = "AUT is not defined in Configuration File"
Logger "DATA_ERROR", "DataError", strMsg
gstrFuncRtnMsg = gstrFuncRtnMsg & ">>" & strMsg
fnLoadConfig = strStatus
Exit Function
End If

For intCnt = 0 To rsConfigList.RecordCount - 1
strAUT = rsConfigList.Fields("Value").Value
Next
rsConfigList.Close

strFilteredSQLQuery = "Select * FROM [CONFIG$] Where AUT = '" & strAUT & "' OR AUT = 'common'"
rsConfigList.Open strFilteredSQLQuery, cnnConfig, gAD_OPEN_STATIC, gAD_LOCK_OPTIMISTIC, gAD_CMD_TEXT
intCnt = 0

For intCnt = 0 To rsConfigList.RecordCount - 1
gdConfig(LCase(rsConfigList.Fields("PARAMETER").Value)) = rsConfigList.Fields("Value").Value
rsConfigList.MoveNext
Next
gdConfig("screenshot_dir") = gdConfig("aut_rootfolder") & "\Output\Screenshot"

rsConfigList.Close
cnnConfig.Close

Set rsConfigList = Nothing
Set cnnConfig = Nothing
' -----------------------------------------------------
' Error Handling and Logging
' -----------------------------------------------------
If Err.Number <> 0 Then
strMsg = "Error occured when loading Configuration file " & "Error Details : Err.number - " _
& Err.Number & " Err.Desc: - " & Err.Description
Logger "FATAL", "Run time Error", strMsg
Err.Clear
strStatus = "FAILURE"
gstrFuncRtnMsg = strMsg
Else
strStatus = "SUCCESS"
strMsg = "Successfuly loaded the Configuration File"
Logger "INFO", "fnLoadConfig", strMsg
gstrFuncRtnMsg = strMsg
End If

fnLoadConfig = strStatus
End Function

'***********************************************************************
'@ Name: fnLoadLibrary
'@ Purpose: Load both additional library files specified in the Configuration file
'@ Inputs : NA
'@ Returns : "Based on the execution, it would result in SUCCESS/FAILURE"
'@ Example : Call fnLoadLibrary()
'@modifications:
' Raghu, 9th May 14, Initial
'***********************************************************************
Private Function fnLoadLibrary()
Dim strStatus 'Function Execution Status
Dim arrGENLib 'Array of Generic Library Files
Dim arrAUTLib 'Array of AUT Library Files
Dim strGenLibFolder 'Folder path for Generic Library Files
Dim strAUTLibFolder 'Folder path for AUT Library Files
Dim intCounter

Dim strMsg
Dim dicLibrary
Set dicLibrary = CreateObject("Scripting.Dictionary")

On Error Resume Next
gstrFuncRtnMsg = "Function: fnLoadLibrary"
strStatus = gEMPTY

arrGENLib = Split(gdConfig("gen_library"), ";")
arrAUTLib = Split(gdConfig("aut_library"), ";")

strGenLibFolder = gdConfig("enterprisepath") & "\Library"
strAUTLibFolder = gdConfig("aut_rootfolder") & "\Library"

intCounter = 0
Dim strGEN
Dim strAUT
'Load file path of all generic Library in a local dictionary
For Each strGEN In arrGENLib
If Trim(strGEN) <> "" Then
intCounter = intCounter + 1
dicLibrary(intCounter) = strGenLibFolder & Trim(strGEN)
End If
Next

'Load file path of all AUT Library in a local dictionary
For Each strAUT In arrAUTLib
If Trim(strAUT) <> "" Then
intCounter = intCounter + 1
dicLibrary(intCounter) = strAUTLibFolder & strAUT
End If
Next

Dim strKey

'Load all the libraries using ExecuteFile
For Each strKey In dicLibrary
ExecuteFile dicLibrary(strKey)
If Err.Number <> 0 Then
Exit For
strMsg = "Error Occured when loading Libary file" & strLib & "Error Details : Number:" _
& Err.Number & " Description:- " & Err.Description
End If
Next
'-----------------------------------------------------
'Error Handling and Logging
'-----------------------------------------------------
If Err.Number <> 0 Then
If strMsg = "" Then
strMsg = "Error Occured when loading Action Properties from file Error Details : Number:" _
& Err.Number & " Description:- " & Err.Description
End If
Logger "FATAL", "RunTimeError", strMsg
Err.Clear
strStatus = "FAILURE"
Else
strStatus = "SUCCESS"
strMsg = "Successfuly executed all the Library Files"
Logger "INFO", "fnLoadLibrary", strMsg
End If
gstrFuncRtnMsg = strMsg
fnLoadLibrary = strStatus
End Function

'***********************************************************************
'@ Name: fnLoadEnvInfo
'@ Purpose: Load Application Environment specific parameters into memory
'@ Inputs : NA
'@ Returns : "Based on the execution, it would result in SUCCESS/FAILURE"
'@ Example : Call fnLoadEnvInfo()
'@modifications:
' Raghu, 9th May 14, Initial
'***********************************************************************
Private Function fnLoadEnvInfo()
Dim strStatus 'Function Execution Status
Dim strEnvFilePath 'Environment File path
Dim strMsg
Dim intRowcount
Dim intRow

On Error Resume Next
gstrFuncRtnMsg = "Function: fnLoadEnvironment"
strStatus = gEMPTY

strEnvFilePath = gdConfig("aut_rootfolder") & Replace(gENV_FILENAME, "<<TEST_ENV>>", UCase(gdConfig("aut_environment")))

'---- Import Environment File and load values into global dictionary----
DataTable.Addsheet "Environment"
DataTable.Importsheet strEnvFilePath, 1, "Environment"
' intRowcount = DataTable.GetSheet(3).rowCount
intRowcount = DataTable.GetSheet("Environment").GetRowCount

For intRow = 1 To intRowcount
DataTable.SetCurrentRow (intRow)
gdEnvData(LCase(Trim(DataTable("Variable", "Environment")))) = Trim(DataTable("Value", "Environment"))
Next
' -----------------------------------------------------
' Error Handling and Logging
' -----------------------------------------------------
If Err.Number = 0 And gdEnvData.Count = intRowcount Then
strStatus = "SUCCESS"
strMsg = "Successfuly loaded the Environment variables from File " & strEnvFilePath
Logger "INFO", "fnLoadEnvInfo", strMsg
gstrFuncRtnMsg = strMsg
Else
strMsg = "Error Occured when loading Environment file " & strEnvFilePath & " : Error Details : " & Err.Description
Logger "FATAL", "Failure", strMsg
Err.Clear
strStatus = "FAILURE"
gstrFuncRtnMsg = strMsg
End If

DataTable.DeleteSheet ("Environment")
fnLoadEnvInfo = strStatus
End Function

'***********************************************************************
'@ Name: fnLoadTestOR
'@ Purpose: Load Test Object Reference into memory
'@ Inputs : NA
'@ Returns : "Based on the execution, it would result in SUCCESS/FAILURE"
'@ Example : Call fnLoadTestOR()
'@modifications:
' Raghu, 9th May 14, Initial
'***********************************************************************
Private Function fnLoadTestOR()
Dim strStatus 'Function Execution Status
Dim strTOFilePath 'Test Object Reference Filepath
Dim strMsg
Dim intRowcount
Dim intRow

On Error Resume Next
gstrFuncRtnMsg = "Function: fnLoadTestOR"

strStatus = gEMPTY
strTOFilePath = gdConfig("aut_rootfolder") & "\ObjRef" & gTO_FILENAME

'---- Import Object Reference File and load values into global dictionary----

DataTable.Addsheet "ObjectDef"
DataTable.Importsheet strTOFilePath, 1, "ObjectDef"
intRowcount = DataTable.GetSheet("ObjectDef").GetRowCount
gdTORef.RemoveAll

For intRow = 1 To intRowcount
DataTable.SetCurrentRow (intRow)
gdTORef(LCase(Trim(DataTable("ObjectID", "ObjectDef")))) = Trim(DataTable("ObjectRef", "ObjectDef"))
Next

DataTable.DeleteSheet ("ObjectDef")
If Err.Number <> 0 Then
strStatus = "FAILURE"
strMsg = "Error Occured when loading Test Object Defination file " & strTOFilePath & " : Error Details: Number:" _
& Err.Number & " Description: " & Err.Description
fnLoadTestOR = strStatus
Exit Function
End If

'---- Dynamically load the Object Repository in the RunEngine QTP Script---

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtRepositories 'As QuickTest.ObjectRepositories ' Declare an action's object repositories collection variable
Dim arrObjRep
Dim strPath
Dim strObjRepFld, findo

Set qtApp = CreateObject("QuickTest.Application")
Set qtRepositories = qtApp.Test.Actions(1).ObjectRepositories

'just creating an object in order to access repositories of the above said action.
qtRepositories.RemoveAll

arrObjRep = Split(gdConfig("aut_objrep"), ";")
strObjRepFld = gdConfig("aut_rootfolder") & "\ObjRef"

For Each strPath In arrObjRep
strPath = Trim(strPath)
If strPath <> gEMPTY Then
strPath = strObjRepFld & strPath
If qtRepositories.Find(strPath) = -1 Then
qtRepositories.Add strPath, 1 ' Add the repository to the collection
Else
Exit For
End If
End If
Next

findo=qtRepositories.Find(strPath)

Set qtRepositories = Nothing
Set qtApp = Nothing

' -----------------------------------------------------
' Error Handling and Logging
' -----------------------------------------------------
If Err.Number = 0 Then
strStatus = "SUCCESS"
strMsg = "Successfuly loaded the Test Object Repositories"
Logger "INFO", "ObjectRep", strMsg
Else
strStatus = "FAILURE"
strMsg = "Error Occured when loading Test Object Repositories" & " : Error Details: Number:" _
& Err.Number & " Description: " & Err.Description
Logger "FATAL", "ObjectRep", strMsg
Err.Clear
End If
gstrFuncRtnMsg = gstrFuncRtnMsg & strMsg

fnLoadTestOR = strStatus
End Function

'***********************************************************************
'@ Name: fnLoadActionInfo
'@ Purpose: Load Test Object Reference into memory
'@ Inputs : NA
'@ Returns : "Based on the execution, it would result in SUCCESS/FAILURE"
'@ Example : Call fnLoadTestOR()
'@modifications:
' Raghu, 9th May 14, Initial
'***********************************************************************
Private Function fnLoadActionInfo()
Dim strStatus 'Function Execution Status
Dim strGenActionFilePath 'File where Generic Actions Property Info details are stored
Dim strAppActionFilePath 'File where Application specific action Property Info details are stored
Dim strMsg
Dim intRowcount
Dim intRow
Dim intActionCnt
Dim arrActionFiles
Dim strActionFile

On Error Resume Next
gstrFuncRtnMsg = "Function: fnLoadEnvironment"
strStatus = gEMPTY

strGenActionFilePath = gdConfig("enterprisepath") & "" & gGEN_ACTION_INFO_FILENAME
strAppActionFilePath = gdConfig("aut_rootfolder") & "\Library" & gAPP_ACTION_INFO_FILENAME

arrActionFiles = Array(strGenActionFilePath, strAppActionFilePath)
gdActionPrp.RemoveAll

'Load Action properties from both Generic Action info & Application Specific Action Info File
For Each strActionFile In arrActionFiles

DataTable.Addsheet "ActionInfo"
DataTable.Importsheet strActionFile, 1, "ActionInfo"

intRowcount = DataTable.GetSheet("ActionInfo").GetRowCount

For intRow = 1 To intRowcount
    DataTable.SetCurrentRow (intRow)
    If gdActionPrp.Exists(LCase(Trim(DataTable("ACTION_NAME", "ActionInfo")))) <> True Then
        gdActionPrp(LCase(Trim(DataTable("ACTION_NAME", "ActionInfo")))) = Trim(DataTable("PARA_COUNT", "ActionInfo"))
    Else
        strStatus = "DUPLICATE"
        strMsg = "Duplicate Action observed - Action name: " & Trim(DataTable("ACTION_NAME", "ActionInfo")) _
                & " in file " & strActionFile
        Exit For
    End If
Next

DataTable.DeleteSheet ("ActionInfo")
intActionCnt = intActionCnt + intRowcount
If strStatus = "DUPLICATE" Then Exit For

Next
' -----------------------------------------------------
' Error Handling and Logging
' -----------------------------------------------------
If Err.Number <> 0 Then
strMsg = "Error Occured when loading Action Properties from file Error Details : Number:" _
& Err.Number & " Description:- " & Err.Description
Logger "FATAL", "Load Action", strMsg
Err.Clear
strStatus = "FAILURE"
ElseIf strStatus = "DUPLICATE" Then
Logger "FATAL", "Load Action", strMsg
strStatus = "FAILURE"
ElseIf gdActionPrp.Count = intActionCnt And strStatus = gEMPTY Then
strStatus = "SUCCESS"
strMsg = "Successfuly loaded the Action Properties "
Logger "INFO", "Load Action", strMsg
End If
gstrFuncRtnMsg = strMsg
fnLoadActionInfo = strStatus
End Function

'***********************************************************************
'@ Name: fnSetInitialReportInput
'@ Purpose: Set Initial values for Test Execution Report Inputs.
'@ Inputs : NA
'@ Returns : "Based on the execution, it would result in SUCCESS/FAILURE"
'@ Example : Call fnSetInitialReportInput()
'@modifications:
' Raghu, 9th May 14, Initial
'***********************************************************************

Private Function fnSetInitialReportInput()
Dim strMsg
Dim strStatus
On Error Resume Next
gstrFuncRtnMsg = "Function: fnSetInitialReportInput"

gdConfig("report_file_path") = gdConfig("aut_rootfolder") & "\Output\Results\Report_" & gstrTestExeID & ".html"

'Initialize the input for the Report
gdRptInput("StartTime") = Now
gdRptInput("ReportFilePath") = gdConfig("report_file_path")
gdRptInput("EndTime") = ""
gdRptInput("AUT") = gdConfig("aut")
gdRptInput("TestEnv") = gdConfig("aut_environment")
gdRptInput("Tester") = gdConfig("tester")
gdRptInput("BatchTotal") = 0
gdRptInput("TSuitesTotal") = 0
gdRptInput("TCaseTotal") = 0
gdRptInput("TCasePassed") = 0
gdRptInput("TCaseFailed") = 0
gdRptInput("TCaseError") = 0
gdRptInput("TCaseDataError") = 0
gdRptInput("TCaseNoRun") = 0
gdRptInput("Message") = ""
gdRptInput("noRunCnt") = 0

'Define Reporting Parameter for Batch Level Information

grsBAResults.Fields.Append "BatchID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "BatchDesc", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "StartTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "EndTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "BatchStatus", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "ScreenshotPath", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "TSuiteTotal", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "TCaseTotal", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "TCasePassed", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "TCaseFailed", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "TCaseError", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "TCaseDataError", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "TCaseNoRun", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBAResults.Fields.Append "Message", gAD_VAR_CHAR, gMAX_CHARACTERS

grsBAResults.Open
'Define Reporting Parameter for TestSuite Level Information
grsTSResults.Fields.Append "BatchID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "TSuiteID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "TSuiteDesc", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "StartTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "EndTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "TSuiteStatus", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "ScreenshotPath", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "TCaseTotal", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "TCasePassed", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "TCaseFailed", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "TCaseError", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "TCaseDataError", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "TCaseNoRun", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Fields.Append "Message", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTSResults.Open

'Define Reporting Parameter for TestCase Level Information
grsTCResults.Fields.Append "BatchID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "TSuiteID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "TCaseID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "TCDescription", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "TCaseStatus", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "StartTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "EndTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "ScreenshotPath", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "TStepsTotal", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "TStepsPassed", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "TStepsFailed", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "TStepsError", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "TStepsNoRun", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "TStepsDataError", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Fields.Append "Message", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTCResults.Open

    
'Define Reporting Parameter for TestStep Level Information
grsTStepResults.Fields.Append "BatchID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "TSuiteID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "TCaseID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "TStepID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "TStepDesc", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "TStepStatus", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "StartTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "EndTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "ScreenshotPath", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "Action", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "TStepIsBC", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "ActionCompleteMsg", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "ActionMsg", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Fields.Append "Message", gAD_VAR_CHAR, gMAX_CHARACTERS
grsTStepResults.Open

'Define Reporting Parameter for Business Component Level Information
grsBCResults.Fields.Append "BatchID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "TSuiteID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "TCaseID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "TStepID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "BCID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "BCStatus", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "StartTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "EndTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "ScreenshotPath", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "BCStepsTotal", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "BCStepsPassed", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "BCStepsFailed", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "BCStepsNoRun", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "BCStepsError", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "BCStepsDataError", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Fields.Append "Message", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCResults.Open

'Define Reporting Parameter for Business Component Step Level Information
grsBCStepResults.Fields.Append "BatchID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "TSuiteID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "TCaseID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "TStepID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "Action", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "BCID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "BCStepID", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "BCStepStatus", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "BCStepDesc", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "StartTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "EndTime", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "ScreenshotPath", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "ActionCompleteMsg", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Fields.Append "ActionMsg", gAD_VAR_CHAR, gMAX_CHARACTERS
grsBCStepResults.Open

'-----------------------------------------------------
'Error Handling and Logging
'-----------------------------------------------------
 If Err.Number <> 0 Then
        strMsg = "Error Occured while setting Inital Report Input Error Details : Number:" _
               & Err.Number & " Description:- " & Err.Description
    Logger "FATAL", "RunTime Error", strMsg
    Err.Clear
    strStatus = "FAILURE"
Else
    strStatus = "SUCCESS"
    strMsg = "Successfuly set up Initial Report Input"
    Logger "INFO", "fnSetInitialReportInput", strMsg
End If

gstrFuncRtnMsg = strMsg
fnSetInitialReportInput = strStatus

End Function
''*****end of file
'
''Reporting File

'''''*********************************************************************************
Option Explicit
'***********************************************************************
'@ Name: CreateHTMLReport
'@ Purpose: Create a HTML Report
'@ Inputs : strFilePath : Path of the Report File whic his being created
'@ Returns : "Based on the execution result, it would result in PASS/FAIL/ERROR/DATA_ERROR"
'@ Example : Call fnExecuteBatch("BC003")
'@modifications:
' Raghu, 19th May 14, Initial
' Raghu, 10th June 14, Enhanced the Code with appropriate comments & minor logical changes
'***********************************************************************
Public Function CreateHTMLReport(strFilePath)
Dim fso
Dim RptFile
Dim intSlNo
Dim intBCStepNo
Dim strBreak
Dim idindex
Set fso = CreateObject("Scripting.FileSystemObject")
Set RptFile = fso.OpenTextFile(strFilePath, 2, True)
'********************************************************* Start : Include - Report Summary **************************************************************
RptFile.writeline ("")
RptFile.writeline ("")
RptFile.writeline ("

Test Execution Report

")
RptFile.writeline ("

Report Summary: " & gdRptInput("Message") & "

")

RptFile.writeline ("<table style=''width: 90%; border: #000000 1px solid;' border='1' cellspacing='0' cellpadding='0'>")
RptFile.writeline ("<tbody>")
RptFile.writeline ("<tr>")
RptFile.writeline ("<td valign='top' width='145' style='background-color:#BDB76B;color:#ffffff;'><p><strong>APPLICATION</strong></p></td>")
RptFile.writeline ("<td valign='top' width='180'><p align='center'>" & gdRptInput("AUT") & " </p></td>")
RptFile.writeline ("<td valign='top' width='138'style='background-color:#BDB76B;color:#00FF00;'><p ><strong>PASSED </strong></p></td>")
RptFile.writeline ("<td valign='top' width='120'><p align='center'><span style='color: #00FF00;'><strong>" & gdRptInput("TCasePassed") & "</strong></span></p></td>")
RptFile.writeline ("</tr>")
RptFile.writeline ("<tr>")
RptFile.writeline ("<td valign='top' width='145' style='background-color:#BDB76B;color:#ffffff;'><p><strong>ENVIRONMENT</strong></p></td>")
RptFile.writeline ("<td valign='top' width='180'><p align='center'>" & gdRptInput("TestEnv") & " </p></td>")
RptFile.writeline ("<td valign='top' width='138' style='background-color:#BDB76B;color:#0000ff;'><p><strong>NORUN </strong></p></td>")
RptFile.writeline ("<td valign='top' width='120'><p align='center'> <strong>" & gdRptInput("TCaseNoRun") & " </strong></p></td>")

RptFile.writeline ("</tr>")
RptFile.writeline ("<tr>")
RptFile.writeline ("<td valign='top' width='145' style='background-color:#BDB76B;color:#ffffff;'><p><strong>TESTER </strong></p></td>")
RptFile.writeline ("<td valign='top' width='180'><p align='center'><span style='color: #0000ff;'>" & gdRptInput("Tester") & "</span></p></td>")
RptFile.writeline ("<td valign='top' width='138' style='background-color:#BDB76B;color:#FF0000;'><p><strong>DATA-ERROR</strong></p></td>")
RptFile.writeline ("<td valign='top' width='120'><p align='center'><span style='color: #FF0000;'> <strong>" & gdRptInput("TCaseDataError") & " </strong></span></p></td>")
RptFile.writeline ("</tr>")
RptFile.writeline ("<tr>")
RptFile.writeline ("<td valign='top' width='145' style='background-color:#BDB76B;color:#ffffff;' ><p><strong>&nbsp;</strong></p></td>")
RptFile.writeline ("<td valign='top' width='180'><p align='center'>&nbsp;</p></td>")
RptFile.writeline ("<td valign='top' width='138'style='background-color:#BDB76B;color:#FF0000;'><p><strong>ERROR</strong></p></td>")
RptFile.writeline ("<td valign='top' width='120'><p align='center'><span style='color: #ff0000;'> <strong>" & gdRptInput("TCaseError") & " </strong></span></p></td>")
RptFile.writeline ("</tr>")
RptFile.writeline ("<tr>")
RptFile.writeline ("<td valign='top' width='145' style='background-color:#BDB76B;color:#ffffff;' ><p><strong>START-TIME</strong></p></td>")
RptFile.writeline ("<td valign='top' width='180'><p align='center'>" & gdRptInput("StartTime") & "</p></td>")
RptFile.writeline ("<td valign='top' width='138' style='background-color:#BDB76B;color:#FF0000;'><p><strong>FAILED</strong></p></td>")
RptFile.writeline ("<td valign='top' width='120'><p align='center'><span style='color: #ff0000;'> <strong>" & gdRptInput("TCaseFailed") & " </strong></span></p></td>")

RptFile.writeline ("</tr>")
RptFile.writeline ("<tr>")
RptFile.writeline ("<td valign='top' width='145' style='background-color:#BDB76B;color:#ffffff;'><p><strong>END-TIME</strong></p></td>")
RptFile.writeline ("<td valign='top' width='180'><p align='center'>" & gdRptInput("EndTime") & "</p></td>")
RptFile.writeline ("<td valign='top' width='138' style='background-color:#BDB76B;color:#660000;'><p ><strong>TOTAL</strong></p></td>")
RptFile.writeline ("<td valign='top' width='120'><p align='center'> <span style='color: #660000;'> <strong>" & gdRptInput("TCaseTotal") & " </strong></Span></p></td>")
RptFile.writeline ("</tr>")
RptFile.writeline ("</tbody>")
RptFile.writeline ("</table>")

'*********************************************************   End : Include  - Report Summary -  **************************************************************
'*********************************************************   Start  : Report -  Batch & TestSuite List -  **************************************************************
RptFile.writeline ("<p>&nbsp;<br /><br /></p>")
RptFile.writeline ("<p style='text-align: center;'><strong><span style='text-decoration: underline; color: #660000;'><Font size ='5'> Batch & TestSuite List </Font> </span></strong></p>")
RptFile.writeline ("<table style='width: 100%; border: #000000 1px solid;' border='1' cellspacing='0' cellpadding='0' align='left'>")
RptFile.writeline ("<tbody>")
RptFile.writeline ("<tr style='background-color:#BDB76B;color:#ffffff;'>")
RptFile.writeline ("<td rowspan='2' width='6%'><p align='center'><strong>BatchID</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='2%'><p align='center'><strong>Sl.No</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='8%'><p align='center'><strong>TestSuiteID</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='4%'><p align='center'><strong>Status</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='9%'><p align='center'><strong>StartTime</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='9%'><p align='center'><strong>EndTime</strong></p></td>")
RptFile.writeline ("<td rowspan='1' colspan='6' valign='bottom' nowrap='nowrap' width='18%'><p align='center'><strong>Testcase Count</strong></p></td>")
RptFile.writeline ("<td rowspan='2' colspan='1' width='13%'><p align='center'><strong>Remarks</strong></p></td>")
RptFile.writeline ("</tr>")
RptFile.writeline ("<tr style='background-color:#F3E2A9;'>")
RptFile.writeline ("<td width='3%'><span style='color: #660000;'><p align='center'><strong>Total </strong></p></Span></td>")
RptFile.writeline ("<td width='3%'> <span style='color: #006400;'><p align='center'><strong>Passed </strong></p></Span></td>")
RptFile.writeline ("<td width='3%'><span style='color: #FF0000;'><p align='center'><strong>Failed</strong></p></Span></td>")
RptFile.writeline ("<td width='3%'><span style='color: #FF0000;'><p align='center'><strong>Error</strong></p></Span></td>")
RptFile.writeline ("<td width='3%'><span style='color: #FF0000;'><p align='center'><strong>DataError</strong></p></Span></td>")
RptFile.writeline ("<td colspan='1' width='3%'><span style='color: #0000FF;'><p align='center'><strong>NoRun</strong></p></Span></td>")
RptFile.writeline ("</tr>")

grsBAResults.MoveFirst
Do Until grsBAResults.EOF
    grsTSResults.Filter = "BatchID = '" & grsBAResults("BatchID") & "'"
    
    RptFile.writeline ("<tr >")
    RptFile.writeline ("<td rowspan ='" & grsTSResults.RecordCount + 2 & "' width='8%'><p align='center'><a id = '" & grsBAResults("BatchID") & "'>" & grsBAResults("BatchID") & "<br>" & grsBAResults("BatchDesc") & "</a></p></td>")
    RptFile.writeline ("</tr >")
    intSlNo = 0
    Do Until grsTSResults.EOF
        intSlNo = intSlNo + 1
         RptFile.writeline ("<tr>")
        RptFile.writeline ("<td width='2%'><p align='center'>" & intSlNo & "</p></td>")
        RptFile.writeline ("<td width='8%'><p align='center'><a href='#" & grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") & "'  id='" & grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") & "_Back'>" & grsTSResults("TSuiteID") & "</a></p></td>")
        RptFile.writeline ("<td width='4%'><p align='center'>" & grsTSResults("TSuiteStatus") & "</p></td>")
        RptFile.writeline ("<td width='9%'><p align='center'>" & grsTSResults("StartTime") & " </p></td>")
        RptFile.writeline ("<td width='9%'><p align='center'>" & grsTSResults("EndTime") & "</p></td>")
        RptFile.writeline ("<td width='3%'><p align='center'>" & grsTSResults("TCaseTotal") & "</p></td>")
        RptFile.writeline ("<td width='3%'><p align='center'>" & grsTSResults("TCasePassed") & "</p></td>")
        RptFile.writeline ("<td width='3%'><p align='center'>" & grsTSResults("TCaseFailed") & "</p></td>")
        RptFile.writeline ("<td width='3%'><p align='center'>" & grsTSResults("TCaseError") & "</p></td>")
        RptFile.writeline ("<td width='3%'><p align='center'>" & grsTSResults("TCaseDataError") & "</p></td>")
        RptFile.writeline ("<td colspan='1' width='3%'><p align='center'>" & grsTSResults("TCaseNoRun") & "</p></td>")
        RptFile.writeline ("<td width='13%'><p align='center'>" & grsTSResults("Message") & "</p></td>")
        RptFile.writeline ("</tr>")
        grsTSResults.MoveNext

    Loop

    RptFile.writeline ("<tr style='background-color:#6E6E6E;color:#ffffff;'>")
    RptFile.writeline ("<td width='2%'><p align='center'><Strong>" & "TOTAL" & "</Strong></p></td>")
    RptFile.writeline ("<td width='6%'><p align='center'><Strong>" & grsTSResults.RecordCount & "</Strong></p></td>")
    RptFile.writeline ("<td width='7%'><p align='center'><Strong>" & grsBAResults("BatchStatus") & "</Strong></p></td>")
    RptFile.writeline ("<td width='9%'><p align='center'><Strong>" & grsBAResults("StartTime") & "</Strong> </p></td>")
    RptFile.writeline ("<td width='9%'><p align='center'><Strong>" & grsBAResults("EndTime") & "</Strong></p></td>")
    RptFile.writeline ("<td width='3%'><p align='center'><Strong>" & grsBAResults("TCaseTotal") & "</Strong></p></td>")
    RptFile.writeline ("<td width='3%'><p align='center'><Strong>" & grsBAResults("TCasePassed") & "</Strong></p></td>")
    RptFile.writeline ("<td width='3%'><p align='center'><Strong>" & grsBAResults("TCaseFailed") & "</Strong></p></td>")
    RptFile.writeline ("<td width='3%'><p align='center'><Strong>" & grsBAResults("TCaseError") & "</Strong></p></td>")
    RptFile.writeline ("<td width='3%'><p align='center'><Strong>" & grsBAResults("TCaseDataError") & "</Strong></p></td>")
    RptFile.writeline ("<td colspan='1' width='3%'><p align='center'><Strong>" & grsBAResults("TCaseNoRun") & "</Strong></p></td>")
    RptFile.writeline ("<td width='13%'><p align='center'><Strong>" & grsBAResults("Message") & "</Strong></p></td>")
    RptFile.writeline ("</tr>")

    grsBAResults.MoveNext
    grsTSResults.Filter = 0
Loop

RptFile.writeline ("</tbody>")
RptFile.writeline ("</table>")

'*********************************************************   End   : Report -  Batch & TestSuite List -  **************************************************************

'*********************************************************   Start  : Report -  Testcase List -  **************************************************************
RptFile.writeline ("<p>&nbsp;<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></p>")
RptFile.writeline ("<p style='text-align: center;'><strong><span style='text-decoration: underline; color: #660000;'><Font size ='5'> Testcase List </Font> </span></strong></p>")
RptFile.writeline ("<table style='width: 100%; border: #000000 1px solid;' border='1' cellspacing='0' cellpadding='0' align='left'>")
RptFile.writeline ("<tbody>")
RptFile.writeline ("<tr style='background-color:#BDB76B;color:#ffffff;'>")
RptFile.writeline ("<td rowspan='2' width='6%'><p align='center'><strong>BatchID & TestSuiteID</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='2%'><p align='center'><strong>Sl.No</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='8%'><p align='center'><strong>TestCaseID</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='8%'><p align='center'><strong>Test Description</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='4%'><p align='center'><strong>Status</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='9%'><p align='center'><strong>StartTime</strong></p></td>")
RptFile.writeline ("<td rowspan='2' width='9%'><p align='center'><strong>EndTime</strong></p></td>")
RptFile.writeline ("<td rowspan='1' colspan='6' valign='bottom' nowrap='nowrap' width='18%'><p align='center'><strong>TestStep Count</strong></p></td>")
RptFile.writeline ("<td rowspan='2' colspan='1' width='13%'><p align='center'><strong>Remarks</strong></p></td>")
RptFile.writeline ("</tr>")
RptFile.writeline ("<tr style='background-color:#F3E2A9;'>")
RptFile.writeline ("<td width='3%'><span style='color: #660000;'><p align='center'><strong>TotalSteps </strong></p></span></td>")
RptFile.writeline ("<td width='3%'><span style='color: #006400;'><p align='center'><strong>PassedSteps </strong></p></span></td>")
RptFile.writeline ("<td width='3%'><span style='color: #FF0000;'><p align='center'><strong>FailedSteps</strong></p></span></td>")
RptFile.writeline ("<td width='3%'><span style='color: #FF0000;'><p align='center'><strong>ErrorSteps</strong></p></span></td>")
RptFile.writeline ("<td width='3%'><span style='color: #FF0000;'><p align='center'><strong>DataErrorSteps</strong></p></span></td>")
RptFile.writeline ("<td colspan='1' width='3%'><span style='color: #0000FF;'><p align='center'><strong>NoRunSteps</strong></p></span></td>")
RptFile.writeline ("</tr>")

grsBAResults.MoveFirst
Do Until grsBAResults.EOF
    grsTSResults.Filter = "BatchID = '" & grsBAResults("BatchID") & "'"
    grsTSResults.MoveFirst
    Do Until grsTSResults.EOF
    
        grsTCResults.Filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'"
        RptFile.writeline ("<tr >")
        RptFile.writeline ("<td rowspan ='" & grsTCResults.RecordCount + 1 & "' width='8%'><p align='center'><a href ='#" & grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") & "_Back'" _
                                                & " id='" & grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") & "' >" & grsTCResults("BatchID") & "&lt;&lt;" & grsTCResults("TSuiteID") & "</a></p></td>")
        RptFile.writeline ("</tr >")
            intSlNo = 0
        grsTCResults.MoveFirst
        Do Until grsTCResults.EOF
    
        intSlNo = intSlNo + 1
        RptFile.writeline ("<tr>")
        RptFile.writeline ("<td width='2%'><p align='center'>" & intSlNo & "</p></td>")
        RptFile.writeline ("<td width='8%'><p align='center'><a href='#" & grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") & "_" & grsTCResults("TCaseID") & "' >" & grsTCResults("TCaseID") & "</a></p></td>")
        RptFile.writeline ("<td width='9%'><p align='center'>" & grsTCResults("TCDescription") & " </p></td>")
        RptFile.writeline ("<td width='4%'><p align='center'>" & grsTCResults("TCaseStatus") & " </p></td>")
        RptFile.writeline ("<td width='9%'><p align='center'>" & grsTCResults("StartTime") & " </p></td>")
        RptFile.writeline ("<td width='9%'><p align='center'>" & grsTCResults("EndTime") & "</p></td>")
        RptFile.writeline ("<td width='3%'><p align='center'>" & grsTCResults("TStepsTotal") & "</p></td>")
        RptFile.writeline ("<td width='3%'><p align='center'>" & grsTCResults("TStepsPassed") & "</p></td>")
        RptFile.writeline ("<td width='3%'><p align='center'>" & grsTCResults("TStepsFailed") & "</p></td>")
        RptFile.writeline ("<td width='3%'><p align='center'>" & grsTCResults("TStepsError") & "</p></td>")
        RptFile.writeline ("<td width='3%'><p align='center'>" & grsTCResults("TStepsDataError") & "</p></td>")
        RptFile.writeline ("<td colspan='1' width='3%'><p align='center'>" & grsTCResults("TStepsNoRun") & "</p></td>")
        RptFile.writeline ("<td width='13%'><p align='center'>" & grsTCResults("Message") & "</p></td>")
        RptFile.writeline ("</tr>")
        grsTCResults.MoveNext

        Loop
        RptFile.writeline ("<tr height ='6' style='background-color:#6E6E6E;' class='blank_row;' ><td colspan='14' ></td></tr>")
        grsTCResults.Filter = 0
        grsTSResults.MoveNext
    Loop
    grsBAResults.MoveNext
    grsTSResults.Filter = 0
Loop
grsBAResults.Filter = 0
RptFile.writeline ("</tbody>")
RptFile.writeline ("</table>")
'*********************************************************   End   : Report -  Testcase  **************************************************************


'*********************************************************   Start  : Report -  Testcase  Results **************************************************************


RptFile.writeline ("<p>&nbsp;<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>><br><br><br><br><br><br><br><br></p>")
RptFile.writeline ("<p style='text-align: center;'><strong><span style='text-decoration: underline; color: #660000;'><Font size ='5'> Testcase  Results </Font> </span></strong></p>")

'RptFile.writeline("

")

grsBAResults.MoveFirst
Do Until grsBAResults.EOF
    grsTSResults.Filter = "BatchID = '" & grsBAResults("BatchID") & "'"
    grsTSResults.MoveFirst
    Do Until grsTSResults.EOF
        grsTCResults.Filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'"
        grsTCResults.MoveFirst
        Do Until grsTCResults.EOF
            grsTCResults.Filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'" & "AND TCaseID = '" & grsTCResults("TCaseID") & "'"
        
            RptFile.writeline ("<p align='left'><a href ='#" & grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") & "_Back'" _
                                                    & " id='" & grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") & "' >" & grsTCResults("BatchID") & "&lt;&lt;" & grsTCResults("TSuiteID") & "</a>  &lt;&lt; " _
                                                    & "<a href ='#" & grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") & "_" & grsTCResults("TCaseID") & "_Back'" _
                                                    & " id='" & grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") & "_" & grsTCResults("TCaseID") & "' >" & grsTCResults("TCaseID") & "</a></p>")

            RptFile.writeline ("<p align='left'><b>TC Description : </b>" & grsTCResults("TCDescription") & "</p>")

             intSlNo = 0
             strBreak = "<br>"
            RptFile.writeline ("<table style='width: 100%; border: #000000 1px solid;' border='1' cellspacing='0' cellpadding='0' align='left'>")
            RptFile.writeline ("<tbody>")
            RptFile.writeline ("<tr style='background-color:#BDB76B;color:#ffffff;'>")
            RptFile.writeline ("<td width='2%'><p align='center'><strong>Sl.No</strong></p></td>")
            RptFile.writeline ("<td  width='4%'><p align='center'><strong>TestStepID</strong></p></td>")
            RptFile.writeline ("<td  width='8%'><p align='center'><strong>Description</strong></p></td>")
            RptFile.writeline ("<td  width='4%'><p align='center'><strong>Action</strong></p></td>")
            RptFile.writeline ("<td  width='4%'><p align='center'><strong>Status</strong></p></td>")
            RptFile.writeline ("<td  width='8%'><p align='center'><strong>Remarks</strong></p></td>")
            RptFile.writeline ("<td  width='8%'><p align='center'><strong>More Details</strong></p></td>")
            RptFile.writeline ("<td  width='3%'><p align='center'><strong>StartTime</strong></p></td>")
            RptFile.writeline ("<td  width='3%'><p align='center'><strong>EndTime</strong></p></td>")
            RptFile.writeline ("</tr>")

            grsTStepResults.MoveFirst

            grsTStepResults.Filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'" & "AND TCaseID = '" _
                                                             & grsTCResults("TCaseID") & "'"
                                                             
            Do Until grsTStepResults.EOF

' grsTStepResults.filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'" & "AND TCaseID = '" _
' & grsTCResults("TCaseID") & "'" & "AND TStepID = '" & grsTStepResults("TStepID") & "'"
'

          idindex = grsBAResults("BatchID") & "_" & grsTSResults("TSuiteID") & "_" & grsTCResults("TCaseID") & "_" & grsTStepResults("TStepID")
                            
                intSlNo = intSlNo + 1
                strBreak = strBreak & "<br><br><br>"
                RptFile.writeline ("<tr>")
                RptFile.writeline ("<td width='2%'><p align='center'>" & intSlNo & "</p></td>")
                If UCase(grsTStepResults("TStepIsBC")) = "TRUE" Then
                            'RptFile.writeline ("<td width='4%'><p align='center'><a >" & grsTStepResults("TStepID")  & "</a></p></td>")
                            RptFile.writeline ("<td width='4%'><p align='center'><a onclick=" & Chr(34) & "javascript:ShowHide('HiddenDiv" & idindex & "')" & Chr(34) & "> <u>" & grsTStepResults("TStepID") & "</u></a></p></td>")
                Else
                            RptFile.writeline ("<td width='4%'><p align='center'><a >" & grsTStepResults("TStepID") & "</a></p></td>")
                End If
    
                
                RptFile.writeline ("<td width='8%'><p align='center'>" & grsTStepResults("TStepDesc") & " </p></td>")
                RptFile.writeline ("<td width='4%'><p align='center'>" & grsTStepResults("Action") & " </p></td>")
                RptFile.writeline ("<td width='4%'><p align='center'>" & grsTStepResults("TStepStatus") & " </p></td>")
                RptFile.writeline ("<td width='8%'><p align='center'>" & grsTStepResults("ActionMsg") & " </p></td>")
                RptFile.writeline ("<td width='8%'><p align='center'>" & grsTStepResults("ActionCompleteMsg") & " </p></td>")
                RptFile.writeline ("<td width='3%'><p align='center'>" & grsTStepResults("StartTime") & " </p></td>")
                RptFile.writeline ("<td width='3%'><p align='center'>" & grsTStepResults("EndTime") & "</p></td>")
                RptFile.writeline ("</tr>")

                If UCase(grsTStepResults("TStepIsBC")) = "TRUE" Then
                    RptFile.writeline ("<tr>")
                   ' RptFile.writeline ("<td colspan =9>")
                    'RptFile.writeline ("<div class=" & Chr(34) & "mid" & Chr(34) & " id=" & Chr(34) & "HiddenDiv" & idindex  & Chr(34) & " style=" & Chr(34) & "display:none;" & Chr(34) & ">")
                    'RptFile.writeline ("<table style = 'width: 100%;' >")
                                    '*********************************************************   Start   : Report -  Business Componet Results -  **************************************************************
                    grsBCResults.MoveFirst
                    grsBCResults.Filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'" _
                                                                    & "AND TCaseID = '" & grsTCResults("TCaseID") & "'" & "AND TStepID = '" & grsTStepResults("TStepID") & "'"
                                                                    
                    Do Until grsBCResults.EOF

' grsBCResults.filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'" _
' & "AND TCaseID = '" & grsTCResults("TCaseID") & "'" & "AND TStepID = '" & grsTStepResults("TStepID") & "'"

                        grsBCStepResults.MoveFirst
                        intBCStepNo = 0
                
                        grsBCStepResults.Filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'" _
                                                                    & "AND TCaseID = '" & grsTCResults("TCaseID") & "'" & "AND TStepID = '" & grsTStepResults("TStepID") & "'" _
                                                                    & "AND BCID = '" & grsBCResults("BCID") & "'"
                                                                                                
                        Do Until grsBCStepResults.EOF

' grsBCStepResults.filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'" _
' & "AND TCaseID = '" & grsTCResults("TCaseID") & "'" & "AND TStepID = '" & grsTStepResults("TStepID") & "'" _
' & "AND BCID = '" & grsBCResults("BCID") & "'" & "AND BCStepID = '" & grsBCStepResults("BCStepID") & "'"

                                intBCStepNo = intBCStepNo + 1
                                strBreak = strBreak & "<br><br><br><br><br>"
                                RptFile.writeline ("<tr bgcolor = '#A9A9A9'>")
                                RptFile.writeline ("<td width='2%'><p align='center'>" & intSlNo & "_" & intBCStepNo & "</p></td>")
                                RptFile.writeline ("<td width='4%'><p align='center'><a >" & grsBCStepResults("BCStepID") & "</a></p></td>")
                                RptFile.writeline ("<td width='8%'><p align='center'>" & grsBCStepResults("BCStepDesc") & " </p></td>")
                                RptFile.writeline ("<td width='4%'><p align='center'>" & grsBCStepResults("Action") & " </p></td>")
                                RptFile.writeline ("<td width='4%'><p align='center'>" & grsBCStepResults("BCStepStatus") & " </p></td>")
                                RptFile.writeline ("<td width='8%'><p align='center'>" & grsBCStepResults("ActionMsg") & " </p></td>")
                                RptFile.writeline ("<td width='8%'><p align='center'>" & grsBCStepResults("ActionCompleteMsg") & " </p></td>")
                                RptFile.writeline ("<td width='3%'><p align='center'>" & grsBCStepResults("StartTime") & " </p></td>")
                                RptFile.writeline ("<td width='3%'><p align='center'>" & grsBCStepResults("EndTime") & "</p></td>")
                                RptFile.writeline ("</tr>")
                                
                                grsBCStepResults.MoveNext
                        Loop
                        grsBCStepResults.Filter = 0
                        grsBCResults.MoveNext
                    Loop

                   ' RptFile.writeline ("</table>")
                    'RptFile.writeline ("</div>")
                    'RptFile.writeline ("</td>")
                    'RptFile.writeline ("</tr>")
                    
                        grsBCResults.Filter = 0
                    '*********************************************************   End    : Report -  Business Componet Results -  **************************************************************
                End If
                
                grsTStepResults.MoveNext
            Loop

' RptFile.writeline("

")
RptFile.writeline ("")
RptFile.writeline ("")
grsTStepResults.Filter = 0
grsTCResults.MoveNext
RptFile.writeline ("









" & strBreak & "

")
Loop

        grsTCResults.Filter = 0
        grsTSResults.MoveNext

' RptFile.writeline ("


" & strBreak & "

")'new one
Loop
grsBAResults.MoveNext
grsTSResults.Filter = 0
RptFile.writeline ("


" & strBreak & "

") 'new one
Loop
grsBAResults.Filter = 0

'*********************************************************   End   : Report -  Testcase  Results -  **************************************************************

RptFile.writeline ("<p style='text-align: center;'><span style='font-family: arial,helvetica,sans-serif; color: #006400; font-size: small; '><strong>**************END OF FILE *********************</strong></span></p>")
RptFile.writeline ("<script type= " & Chr(34) & "text/javascript" & Chr(34) & " >// <![CDATA[")
RptFile.writeline ("function ShowHide(divId)")
RptFile.writeline ("{")
RptFile.writeline ("if(document.getElementById(divId).style.display == 'none')")
RptFile.writeline ("{")
RptFile.writeline ("document.getElementById(divId).style.display='block';")
RptFile.writeline ("}")
RptFile.writeline ("else")
RptFile.writeline ("{")
RptFile.writeline ("document.getElementById(divId).style.display = 'none';")
RptFile.writeline ("}")
RptFile.writeline ("}")
RptFile.writeline ("" & Chr(47) & Chr(47) & " ]]></script>")
RptFile.writeline ("</body>")
RptFile.writeline ("</html>")

RptFile.Close

End Function

'Public Function CreateBCReport(ByRef RptFile)
' '
' '********************************************************* Start : Report - Business Componet Results - **************************************************************
' grsBCResults.MoveFirst
' Do Until grsBCResults.EOF
' grsBCResults.filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'" _
' & "AND TCaseID = '" & grsTCResults("TCaseID") & "'" & "AND TStepID = '" & grsTStepResults("TStepID") & "'"
' grsBCStepResults.MoveFirst
' intSlNo = 0
' Do Until grsBCStepResults.EOF
' grsBCStepResults.filter = "BatchID = '" & grsBAResults("BatchID") & "' AND TSuiteID = '" & grsTSResults("TSuiteID") & "'" _
' & "AND TCaseID = '" & grsTCResults("TCaseID") & "'" & "AND TStepID = '" & grsTStepResults("TStepID") & "'" _
' & "AND BCID = '" & grsBCResults("BCID") & "'" & "AND BCStepID = '" & grsBCStepResults("BCStepID") & "'"
'
' intSlNo = intSlNo + 1
'
' RptFile.writeline ("")
' RptFile.writeline ("

" & intSlNo & "

")
' RptFile.writeline ("

" & grsBCStepResults("BCStepID") & "

")
' RptFile.writeline ("

" & grsBCStepResults("BCStepDesc") & "

")
' RptFile.writeline ("

" & grsBCStepResults("Action") & "

")
' RptFile.writeline ("

" & grsBCStepResults("BCStepStatus") & "

")
' RptFile.writeline ("

" & grsBCStepResults("ActionMsg") & "

")
' RptFile.writeline ("

" & grsBCStepResults("ActionCompleteMsg") & "

")
' RptFile.writeline ("

" & grsBCStepResults("StartTime") & "

")
' RptFile.writeline ("

" & grsBCStepResults("EndTime") & "

")
' RptFile.writeline ("")
'
' grsBCStepResults.MoveNext
' Loop
' grsBCStepResults.Filter = 0
' grsBCResults.MoveNext
' Loop
' grsBCResults.Filter = 0
' '********************************************************* End : Report - Business Componet Results - **************************************************************
'End Function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant