Forum Discussion
Rather than generating from a commandline, consider using Log.SaveResultsAs. Add that code to the very end of your project and indicate to save the file as XML. Reference. https://support.smartbear.com/testcomplete/docs/testing-with/log/working-with/exporting/about.html#xml
Hi Robert,
Thank you for your suggession. But I have already tried that. I faced following issues with that.
1) The generated XML files does not contain valueable information such as errors.
2) Even if I give a different log file name, it does not add the logs of the next run to the same folder. ( I need all the logs to be saved in the specified folder after each run)
3) The XML file does not contain timestamp (SumoLogic requires timestamp to display the details properly in dashboard)
Appreciate if an alternate method can be suggested.
Thank you
- baxatob7 years agoCommunity Hero
Hi,
The standard TestComplete log file contains datestamp, but in Unix (Epoch) format. So you should perform some conversions to use it for your needs.
Anyway your requirement looks like rather complex task to the moment. You need a script, which will find a proper xml data among all log files, parse data, make all required conversions, make correct structure etc...
- AlexKaras7 years agoChampion Level 3
Hi,
https://support.smartbear.com/testcomplete/docs/testing-with/log/working-with/from-tests.html might provide some useful info/code samples.
- shantlk7 years agoContributor
Hi Alex,
Thank you for the link. I was able to generate a customized log by modifying the given sample code.
Thanks a lot everyone for their help too.
below is a peice of my script which I used to get the timestamp and the log message for each row of the test log.
# Checks the data type of the log data
if LogDataType == ldtTable:
# Obtain the total number of rows in the dataset
Num = DataSet.RowCount
for i in range(0, Num):
Row = DataSet.Rows[i]
# Obtai the time of the current row & write this to the log file
TimeVal = Row.ValueByName["Time"]
ExportFile.WriteLine(aqConvert.VarToStr(TimeVal))
# Obtain the message of the current row & write this to the log file
MsgVal = Row.ValueByName["Message"]
ExportFile.WriteLine(aqConvert.VarToStr(MsgVal))
- tristaanogre7 years agoEsteemed Contributor
As for containing errors, the Log.SaveResultsAs generates ALL the data that is in the TestComplete log. So, if there is an error logged, it will contain that error. Again, you will need to parse the information out as it doesn't show up "neat" as strictly errors. You will need to look for that information. AlexKaras link might help with that.
Related Content
- 6 years ago
- 2 years ago
- 4 years ago
Recent Discussions
- 11 hours ago