Forum Discussion
6 Replies
Sort By
Hi Elise,
In TestComplete, you can implement an event handler for the OnStopTest event to export your test log to the needed location after the test execution is completed. For example:function GeneralEvents_OnStopTest(Sender)
{
Log.SaveResultsAs("c:\\MyFolder\\myLog.mht", 2);
}
Please see the Log.SaveResultsAs and 'Handling Events' TestComplete help topics for more information. Also, please note that you will need to disable the 'Activate after test run' option described in the 'Log Options Dialog' help topic in TestExecute.- mazhar555ContributorHi,
I am using the following code, actually trying to bind the current date and time with Log File and saving it on a network location, but it does not save the log. Any idea what would be the problem with that code.
Sub GeneralEvents_OnStopTest(Sender)
FolderPath = "P:\\QA Activity\\01. AUTOMATION\\08 - Test Scripts\\Test Result\\"
strDate = aqConvert.DateTimeToStr(Date)
strDate = aqString.Replace(strDate,"/","-")
LogName = FolderPath&"("&Sys.UserName&")-CDB-"&strDate&"-"&Time&".mht"
Log.SaveResultsAs LogName,2
End Sub
Thanks in advance.
Regards,
Hi Muhammad,
You need to make two corrections to your script.
1. Replace all double slashes with single ones in FolderPath:
FolderPath = "P:\QA Activity\01. AUTOMATION\08 - Test Scripts\Test Result\"
2. Remove colons in the result returned by Time, as filenames cannot contain them. To do this, modify the line starting with 'LogName' in the following way:
LogName = FolderPath&"("&Sys.UserName&")-CDB-"&strDate&"-"&aqString.Replace(Time,":","")&".mht"- mazhar555ContributorThanks David.
- mgaertNew ContributorHallo @all,
Is it posible use the Log.SaveResultsAs to save it on a server path?JScript:
function GeneralEvents_OnStopTest(Sender)
{
Log.SaveResultsAs("\\server\path_on_server\myLog.mht", 2);
}
Thanks for Help!
Michael
Hi Michael,
Yes, but it is necessary to double slashes in the path, as you are using JScript:
function GeneralEvents_OnStopTest(Sender)
{
Log.SaveResultsAs("\\\\server\\path_on_server\\myLog.mht", 2);
}
Related Content
Recent Discussions
- 8 hours agoSubhraDas
- 2 days agotramuntana