A Log That Readable and is Pleasant to Read
I write to one file when an error happens another when it works as expected.
1. How do I programmatically purge the data. or
Or can I read a nextvalue from a sequence or Insert a date time stamp so it is unique.
******oFile.Write(aqDateTime.Now())*****
2. How do I add a carriage return so the file is not all one line.
I am using Python
if DateCheck == 'Y':
#aqFile.WriteToTextFile("C:\Users\Schofem\CheckChecks.txt", "One", aqFile.ctANSI)
oFile = aqFile.OpenTextFile("C:\\Users\\Schofem\\Logs\\CheckChecks.txt", aqFile.faWrite, aqFile.ctANSI, False)
oFile.Write(DDT.CurrentDriver.Value[0])
oFile.Write(" - ")
oFile.Write(DDT.CurrentDriver.Value[26])
oFile.Write(" - ")
oFile.Write(DDT.CurrentDriver.Value[27])
oFile.Write(" - ")
oFile.Write("PassedDateCheck")
oFile.Write("The Test")
oFile.Close()
# else:
#aqFile.WriteToTextFile("C:\Users\Schofem\CheckChecks.txt", "One", aqFile.ctANSI)
# oFile = aqFile.OpenTextFile("C:\\Users\\Schofem\\BadChecks.txt", aqFile.faWrite, aqFile.ctANSI, False)
# oFile.Write(DDT.CurrentDriver.Value[0])
# oFile.Write(" - ")
# oFile.Write(DDT.CurrentDriver.Value[26])
# oFile.Write(" - ")
# oFile.Write(DDT.CurrentDriver.Value[27])
# oFile.Write(" - ")
# oFile.Write("FailedDateCheck")
# oFile.Write("The Test")
# oFile.Close()
For #1, you already know how to get Today. To write it here I think you will need to convert it to a string
For #2, you can use WriteLine instead of Write
https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqfile/opentextfile.html