TestComplete gives plenty of features to log the progress and significant outcomes of a test run using Logging in TestComplete.
To add to this functionality and have a customized deliverable at the end of every test run, I customized logging to log to a text file the progress and results from my test run.
Here is a VBScript sample.
'--------------------------------------------------------------------------------------
'LOG FILE UTILTIES
DIM theLogFile
FUNCTION Log_Start(ByVal msg_start, ByVal filePath)
CALL lib_CreateFile(filePath)
SET theLogFile = lib_OpenFileForWriting(filePath)
theLogFile.WriteLine(now & vbTab & "INF" & vbTab & msg_start)
END FUNCTION
FUNCTION Log_End(ByVal msg_end)
CALL Log_Write("INFO",msg_end)
theLogFile .Close
END FUNCTION
FUNCTION Log_Write(ByVal Msg_Type, ByVal Msg)
SELECT CASE UCASE(Msg_Type)
CASE "INFO"
theLogFile.WriteLine (now & vbTab & "INF" & vbTab & Msg)
CASE "WARNING"
theLogFile.WriteLine (now & vbTab & "WRN" & vbTab & Msg)
CASE "ERROR"
theLogFile.WriteLine (now & vbTab & vbTab & "ERR" & vbTab & vbTab & Msg)
CASE "SUCCESS"
theLogFile.WriteLine (now & vbTab & vbTab & "SCS" & vbTab & vbTab & Msg)
CASE "BREAK"
theLogFile.WriteLine (Msg)
CASE ELSE
Log.Error("Could not recognize message type:" & Msg_Type)
END SELECT
END FUNCTION
'--------------------------------------------------------------------------------------
The functions lib_CreateFile and lib_OpenFileForWriting are library functions I wrote that use the VBScript FileSystemObject to create a file and open the file for writing text respectively. Here is the documentation for that.
Here is how I use the function and how the log file looks like which I submit when asked, "What did/does your automation test test?"
FUNCTION Login
' Log into the website
CALL Log_Write("INFO", "Logging into the webpage")
IF LoginSuccess THEN
CALL Log_Write("SUCCESS", "Logging into the webpage")
ELSE
CALL Log_Write("ERROR", "Logging failed")
END IF
END FUNCTION
I keep track of passed and failed test cases and log them too along with a final testing status at the end
Sample Log file created:
11/11/2015 8:34:39 AM INF LOGGING START : 11/11/2015 8:34:39 AM
11/11/2015 8:34:40 AM INF <<<<<<< TEST CASE >>>>>>>
11/11/2015 8:34:40 AM INF Test Identifier: CardActivation_01-ActivateCard_ValidSrNo_FD
11/11/2015 8:34:40 AM INF >>>>>>> TEST CASE >>>>>>>
11/11/2015 8:35:38 AM INF STEP::Verifying if displayed page is :LoginHome
11/11/2015 8:35:41 AM SCS STEP::Verifying if displayed page is :LoginHome
11/11/2015 8:35:41 AM INF Access: Logout from the VTS website
11/11/2015 8:35:46 AM INF STEP::Verifying if displayed page is :Home
11/11/2015 8:35:48 AM SCS STEP::Verifying if displayed page is :Home
11/11/2015 8:35:48 AM SCS Access: Logout from the VTS website
11/11/2015 8:35:48 AM INF REPORT:##### CURRENT TEST CASE REPORT #####
11/11/2015 8:35:48 AM INF REPORT:Test Complete : True
11/11/2015 8:35:48 AM INF REPORT:Test Passed : True
11/11/2015 8:35:48 AM INF REPORT:# of Test Steps : 3
11/11/2015 8:35:48 AM INF REPORT:# of Test Points Passed : 3
11/11/2015 8:35:48 AM INF REPORT:# of Test Errors Found : 0
11/11/2015 8:35:48 AM INF REPORT:##### FINAL TEST STATUS #####
11/11/2015 8:35:48 AM INF REPORT:Test:CardActivation_01-ActivateCard_ValidSrNo_FD:COMPLETE ; PASSED.
11/11/2015 8:35:48 AM INF REPORT##### END TEST STATUS #####
'
'
'
11/11/2015 8:37:15 AM INF -----------------------------------------------------------------
11/11/2015 8:37:15 AM INF ##### FINAL #####
11/11/2015 8:37:15 AM INF ##### TEST REPORT #####
11/11/2015 8:37:15 AM INF REPORT:: Total Tests Run = 2
11/11/2015 8:37:15 AM INF REPORT:: Pass/Fail Ratio = 2/0
11/11/2015 8:37:15 AM INF REPORT:: Total Test Points = 8
11/11/2015 8:37:15 AM INF ######################################################
11/11/2015 8:37:15 AM INF LOGGING END : 11/11/2015 8:37:15 AM
To add to this functionality and have a customized deliverable at the end of every test run, I customized logging to log to a text file the progress and results from my test run.
Here is a VBScript sample.
'--------------------------------------------------------------------------------------
'LOG FILE UTILTIES
DIM theLogFile
FUNCTION Log_Start(ByVal msg_start, ByVal filePath)
CALL lib_CreateFile(filePath)
SET theLogFile = lib_OpenFileForWriting(filePath)
theLogFile.WriteLine(now & vbTab & "INF" & vbTab & msg_start)
END FUNCTION
FUNCTION Log_End(ByVal msg_end)
CALL Log_Write("INFO",msg_end)
theLogFile .Close
END FUNCTION
FUNCTION Log_Write(ByVal Msg_Type, ByVal Msg)
SELECT CASE UCASE(Msg_Type)
CASE "INFO"
theLogFile.WriteLine (now & vbTab & "INF" & vbTab & Msg)
CASE "WARNING"
theLogFile.WriteLine (now & vbTab & "WRN" & vbTab & Msg)
CASE "ERROR"
theLogFile.WriteLine (now & vbTab & vbTab & "ERR" & vbTab & vbTab & Msg)
CASE "SUCCESS"
theLogFile.WriteLine (now & vbTab & vbTab & "SCS" & vbTab & vbTab & Msg)
CASE "BREAK"
theLogFile.WriteLine (Msg)
CASE ELSE
Log.Error("Could not recognize message type:" & Msg_Type)
END SELECT
END FUNCTION
'--------------------------------------------------------------------------------------
The functions lib_CreateFile and lib_OpenFileForWriting are library functions I wrote that use the VBScript FileSystemObject to create a file and open the file for writing text respectively. Here is the documentation for that.
Here is how I use the function and how the log file looks like which I submit when asked, "What did/does your automation test test?"
FUNCTION Login
' Log into the website
CALL Log_Write("INFO", "Logging into the webpage")
IF LoginSuccess THEN
CALL Log_Write("SUCCESS", "Logging into the webpage")
ELSE
CALL Log_Write("ERROR", "Logging failed")
END IF
END FUNCTION
I keep track of passed and failed test cases and log them too along with a final testing status at the end
Sample Log file created:
11/11/2015 8:34:39 AM INF LOGGING START : 11/11/2015 8:34:39 AM
11/11/2015 8:34:40 AM INF <<<<<<< TEST CASE >>>>>>>
11/11/2015 8:34:40 AM INF Test Identifier: CardActivation_01-ActivateCard_ValidSrNo_FD
11/11/2015 8:34:40 AM INF >>>>>>> TEST CASE >>>>>>>
11/11/2015 8:35:38 AM INF STEP::Verifying if displayed page is :LoginHome
11/11/2015 8:35:41 AM SCS STEP::Verifying if displayed page is :LoginHome
11/11/2015 8:35:41 AM INF Access: Logout from the VTS website
11/11/2015 8:35:46 AM INF STEP::Verifying if displayed page is :Home
11/11/2015 8:35:48 AM SCS STEP::Verifying if displayed page is :Home
11/11/2015 8:35:48 AM SCS Access: Logout from the VTS website
11/11/2015 8:35:48 AM INF REPORT:##### CURRENT TEST CASE REPORT #####
11/11/2015 8:35:48 AM INF REPORT:Test Complete : True
11/11/2015 8:35:48 AM INF REPORT:Test Passed : True
11/11/2015 8:35:48 AM INF REPORT:# of Test Steps : 3
11/11/2015 8:35:48 AM INF REPORT:# of Test Points Passed : 3
11/11/2015 8:35:48 AM INF REPORT:# of Test Errors Found : 0
11/11/2015 8:35:48 AM INF REPORT:##### FINAL TEST STATUS #####
11/11/2015 8:35:48 AM INF REPORT:Test:CardActivation_01-ActivateCard_ValidSrNo_FD:COMPLETE ; PASSED.
11/11/2015 8:35:48 AM INF REPORT##### END TEST STATUS #####
'
'
'
11/11/2015 8:37:15 AM INF -----------------------------------------------------------------
11/11/2015 8:37:15 AM INF ##### FINAL #####
11/11/2015 8:37:15 AM INF ##### TEST REPORT #####
11/11/2015 8:37:15 AM INF REPORT:: Total Tests Run = 2
11/11/2015 8:37:15 AM INF REPORT:: Pass/Fail Ratio = 2/0
11/11/2015 8:37:15 AM INF REPORT:: Total Test Points = 8
11/11/2015 8:37:15 AM INF ######################################################
11/11/2015 8:37:15 AM INF LOGGING END : 11/11/2015 8:37:15 AM