Find out more about eggPlant

Forum IndexForum Index
Forums FAQForums FAQ
Search ForumsSearch Forums
MemberlistMemberlist
UsergroupsUsergroups
RegisterRegister
Your ProfileYour Profile
Log inLog in
How do I filter Errors and Warning from the Test Run

 
Post new topic   Reply to topic   Printer-Friendly View    Forum Index -> Eggplant Examples
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
Reply with quote

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



InterestingResults.script
 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
View user's profile Send private message
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
Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
SenseTalkDoug
Auberlord


Joined: 27 Jun 2003
Posts: 603
Location: Colorado

Posted: Mon Dec 08, 2008 3:22 pm
Post subject:
Reply with quote

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
View user's profile Send private message
suhasbharadwaj
Earl of Eggplant


Joined: 08 Dec 2008
Posts: 6
Location: Bangalore

Posted: Tue Dec 09, 2008 2:00 am
Post subject:
Reply with quote

Thanks a Lot...

Regards,
Suhas
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   Printer-Friendly View    Forum Index -> Eggplant Examples All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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
 
TestPlant
©TestPlant Ltd 2009. All rights reserved.