|
|
| View previous topic :: View next topic |
| Author |
Message |
JonathanOSX Auberlord

Joined: 30 Jun 2003 Posts: 1119 Location: Colorado
|
Posted: Thu Jul 12, 2007 2:30 pm Post subject: How do I filter Errors and Warning from the Test Run |
|
|
How do I filter Errors and Warning from the Test Run?
The ScriptResults() function returns all the results for the current script (or optionally the name of a scripted passed in).
These results are stored in a list from the first run through to the last run. For this example we ONLY look at the latest run. We can easily filter the results by parsing the log file.
| Code: |
(* InterestingResults -- Returns an Array of Log Lines With Errors or Warnings for the latest run of the current script (or passed in script name) *)
params scriptName
set returnResults to empty
if scriptName is empty then
put logfile of last item of ScriptResults() into latestLogFile
else
put logfile of last item of ScriptResults(scriptName) into latestLogFile
end if
repeat with each line logLine of file latestLogFile
put item 2 delimited by tab of logLine into Command
if Command equals "logerror" or Command equals "logwarning" then insert logLine after returnResults
end repeat
return returnResults
|
| Description: |
| InterestingResults -- Returns an Array of Log Lines With Errors or Warnings for the latest run of the current script (or passed in script name) |
|
 Download |
| Filename: |
InterestingResults.script |
| Filesize: |
616 Bytes |
| Downloaded: |
726 Time(s) |
|
|
| Back to top |
|
 |
suhasbharadwaj Earl of Eggplant
Joined: 08 Dec 2008 Posts: 6 Location: Bangalore
|
Posted: Mon Dec 08, 2008 1:21 am Post subject: Unable to get results for Interestingresults.script |
|
|
Hi Jonathan,
I am new to Eggplant.
Tried to execute your script InterestingResults for getting only logwarning and logerrors out of the latest executed logfile, but unfortunately i couldnt get anything.
Can you please briefly explain what parametrs need to be passed to your scripts by considering Hello.script as my input file.
Best Regards,
Suhas
|
|
| Back to top |
|
 |
SenseTalkDoug Auberlord

Joined: 27 Jun 2003 Posts: 603 Location: Colorado
|
Posted: Mon Dec 08, 2008 3:22 pm Post subject: |
|
|
Here's a script that uses the InterestingResults script to display the "interesting" log entries from the last run of a script called Hello.script:
| Code: | put interestingResults("Hello") into interesting
repeat with each logEntry of interesting
put logEntry split by tab into (time, command, img, message)
put command & ": " & message & " (" & time & ")"
end repeat
|
Suppose the Hello script looks like this: | Code: | logWarning "About to change the RWI"
set the remoteWorkInterval to 1.1 -- this will make a log entry
log "This is unimportant -- not really interesting."
logWarning "This message is definitely interesting"
logError "This will cause the script to fail !"
log "Still running, but doomed"
|
Each line in this Hello script will produce an entry in the log file, but running the first script above will show only the interesting entries, like this:
logwarning: Just changed the RWI (2008-12-08 16:09:45.233 -0700)
logwarning: This message is definitely interesting (2008-12-08 16:09:45.235 -0700)
logerror: This will cause the script to fail (2008-12-08 16:09:45.235 -0700)
|
|
| Back to top |
|
 |
suhasbharadwaj Earl of Eggplant
Joined: 08 Dec 2008 Posts: 6 Location: Bangalore
|
Posted: Tue Dec 09, 2008 2:00 am Post subject: |
|
|
Thanks a Lot...
Regards,
Suhas
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|
|