mmcdonald
15 years agoOccasional Contributor
searching text files
I'm testing a product and want to create a checkpoint which can check for events within the product's log files while the product test runs.
The log files are simple text files with a time and date stamp on each line followed by the event eg:
16/02/10 12:01:17 Connecting to Server on 127.0.0.1 port 12001
16/02/10 12:01:17 Connected to Server
16/02/10 12:04:39 Error creating a new run
so far I have been opening the log in notepad and using a property check point similar to:
Call aqObject.CompareProperty(Aliases.notepad.wndNotepad.Edit.wText, cmpContains, "error connecting", false)
However obviously this is only good for checking if there has ever been an error anywhere in the log. Is there anyway I can check specific lines of a text file? For example could I use the aqDateTime.Time() to get the current time and then check if there is an error line in the log files at the current time (whilst ignoring any previous errors which might have occured)? Or is there another way I haven't thought of?
The log files are simple text files with a time and date stamp on each line followed by the event eg:
16/02/10 12:01:17 Connecting to Server on 127.0.0.1 port 12001
16/02/10 12:01:17 Connected to Server
16/02/10 12:04:39 Error creating a new run
so far I have been opening the log in notepad and using a property check point similar to:
Call aqObject.CompareProperty(Aliases.notepad.wndNotepad.Edit.wText, cmpContains, "error connecting", false)
However obviously this is only good for checking if there has ever been an error anywhere in the log. Is there anyway I can check specific lines of a text file? For example could I use the aqDateTime.Time() to get the current time and then check if there is an error line in the log files at the current time (whilst ignoring any previous errors which might have occured)? Or is there another way I haven't thought of?