Capturing the test run date and time of a log item in a script
Hi,
I need to create a customised log satisfying our requirements from existing logs.
In the summary of the log, I need the following information.
1) Timestamp (Date and Time of the test run) - Pls refer the screenshot
2) Log Item Name
3) Status
I was able to get the name and the status, however I don't know how to capture the test run time. I have used the following code, where I get the last log run, and get it's name and status. For now I'm just printing the current time. But instead of current time, what I want is the actual test run time, so that if required, I can refer back to the details test log in the folder where the log is saved.
# Getting the log of the last test run
LastLog = Project.Logs.LogItem[Count-1]
# getting the status of the last log
LogStatus = LastLog.Status
if (LogStatus == 0):
Status = "Passed"
elif (LogStatus == 1):
Status = "Warning"
elif (LogStatus ==2):
Status = "Failed"
# Writing the Time, Name and Status of the last test run to the exported log file
ExportFile.WriteLine(aqConvert.DateTimeToFormatStr(aqDateTime.Now(),"%d/%m/%y %H:%M:%S"))
ExportFile.WriteLine("Test Log Name: " +aqConvert.VarToStr(LastLog.Name))
ExportFile.WriteLine("Test Log Status: " +Status)
Appreciate if someone can help me with this.
Thank you !
Below topic discussed your question and got some answers. Please refer