public abstract class LogExtensionAdapter extends LogAdapter
Implementors should only write the following methods to get the desired log results they wish to design.
public void initLog()
public void closeLog()
public void writeLog(ILogMessage message)
Sample implementation of the subclass is shown below to get the sample text log output of a sample script
Sample Text Log
July 23, 2007 8:30:12 PM IST :Script Name Script1.java Result :INFO Event SCRIPT START headlind Script start [Script1]
Property Name =line_number Property Value =1
Property Name =script_name Property Value =Script1
Property Name =script_id Property Value =Script1.java
July 23, 2007 8:30:12 PM IST :Script Name Script1.java Result :PASS Event SCRIPT END headlind Script end [Script1]
Property Name =line_number Property Value =-1
Property Name =script_name Property Value =Script1
Property Name =script_id Property Value =Script1.java
Modifier and Type | Class and Description |
---|---|
protected class |
LogExtensionAdapter.ImageMetadata |
Modifier and Type | Field and Description |
---|---|
protected float |
MAX_IMAGE_DIMENSION |
ASTERISK, DOT, spaceDelimeter
KEY_POST_EXECUTION_END_MESSAGE, KEY_PRE_EXECUTION_START_MESSAGE, MASKED_PROP_GUI_ACTION_METHOD_ARGS, MASKED_PROP_GUI_ACTION_METHOD_NAME, PROP_ACTUAL, PROP_ADDITIONAL_INFO, PROP_APPLICATION, PROP_APPTYPE, PROP_ARGUMENTS, PROP_ASSIGNEDVARIABLE_NAME, PROP_BASELINE, PROP_BUFFERED_SNAPSHOT, PROP_DATAPOOL_STORE, PROP_DEFAULT_SCRIPT_DATAPOOL_NAME, PROP_ELAPSED_TIME, PROP_EXCEPTION_CONTEXT, PROP_EXCEPTION_MESSAGE, PROP_EXCEPTION_NAME, PROP_EXCEPTION_STACK, PROP_EXECUTABLE, PROP_EXPECTED, PROP_FAILURE_DESCRIPTION, PROP_ITERATION_COUNT, PROP_LINENUMBER, PROP_NAME, PROP_PROPERTY_NAME, PROP_PROPERTY_VALUE, PROP_SCREEN_SNAPSHOT, PROP_SCRIPT_ID, PROP_SCRIPT_NAME, PROP_SCRIPT_SOURCE_UID, PROP_SIMPLIFIEDSCRIPT_GRPNAME, PROP_SIMPLIFIEDSCRIPT_LINE, PROP_SIMPLIFIEDSCRIPT_LINENUMBER, PROP_TESTCASE_DESCRIPTION, PROP_TESTCASE_NAME, PROP_USER_SCREEN_SNAPSHOT, PROP_VP_TYPE, PROP_WORKINGDIRECTORY, SCREEN_SNAPSHOT_FILE_BASE, SCREEN_SNAPSHOT_FILE_EXT, SCREEN_SNAPSHOT_FILE_NAME, USER_SCREEN_SNAPSHOT_FILE_BASE, VP_TYPE_ALPHA_NUM, VP_TYPE_CLIPBOARD, VP_TYPE_FILE_COMPARE, VP_TYPE_FILE_EXIST, VP_TYPE_FULL_IMAGE, VP_TYPE_MENU, VP_TYPE_MODULE_EXIST, VP_TYPE_OBJECT_DATA, VP_TYPE_OBJECT_PROP, VP_TYPE_OCR_IMAGE, VP_TYPE_REGION_IMAGE, VP_TYPE_WEBSITE_COMPARE, VP_TYPE_WEBSITE_SCAN, VP_TYPE_WINDOW_EXIST, VP_TYPE_WINDOW_IMAGE
DISABLE_LOGGING, EVENT_APPLICATION_END, EVENT_APPLICATION_START, EVENT_APPLICATON_ACTION, EVENT_CALL_SCRIPT, EVENT_CONFIGURATION, EVENT_CUSTOM, EVENT_EXPORT, EVENT_GENERAL, EVENT_SCRIPT_END, EVENT_SCRIPT_START, EVENT_TIMER_END, EVENT_TIMER_START, EVENT_VP, LOG_DISABLE_GUI_ACTION, LOG_DISABLE_GUI_SNAPSHOT_ACTION, LOG_ENABLE_GUI_ACTION, LOG_ENABLE_GUI_SNAPSHOT_ACTION, LOG_FAILURE, LOG_FAILURES, LOG_FAILURES_WARNINGS, LOG_FAILURES_WARNINGS_PASS, LOG_FAILURES_WARNINGS_PASS_INFO, LOG_INFORMATION, LOG_PASS, LOG_WARNING
Constructor and Description |
---|
LogExtensionAdapter() |
LogExtensionAdapter(java.lang.String logName) |
Modifier and Type | Method and Description |
---|---|
void |
applicationStart(java.lang.String name,
int status,
java.lang.String description,
java.lang.String language)
Writes an application start message into the log.
|
void |
applicationStart(java.lang.String name,
java.lang.String language)
Write an application start message into the log.
|
void |
callScript(java.lang.String name,
java.lang.String language)
Write a call script message into the log
|
void |
close()
Closes the log, thereby releasing internal resources.
|
abstract void |
closeLog()
The abstract method that needs to be overridden by sub classes to close their custom logs
|
void |
configuration(java.lang.String language)
Write the system configuration into the log.
|
ILogMessage |
createApplicationStartMessage(java.lang.String name,
int status,
java.lang.String description,
java.lang.String language)
Return a application start message.
|
ILogMessage |
createConfigurationMessage(java.lang.String language)
Create a system configuration message.
|
ILogMessage |
createTestResultMessage(java.lang.String headline,
boolean passed,
java.lang.String additionalInfo)
Creates a test result message.
|
ILogMessage |
createTimerEndMessage(java.lang.String name,
java.lang.String language)
Return an end timer message.
|
ILogMessage |
createTimerStartMessage(java.lang.String name,
java.lang.String language)
Return a start timer message.
|
ILogMessage |
createVPMessage(int resultCode,
java.lang.String type,
java.lang.String name,
java.lang.String language)
Return a verification point message.
|
void |
exception(java.lang.String note,
java.lang.String context,
java.lang.String throwableName,
java.lang.String throwableMessage,
java.lang.String scriptName,
int line,
java.lang.String stackTrace,
java.lang.String language)
Write an exception message.
|
void |
exception(java.lang.String note,
java.lang.String context,
java.lang.String throwableName,
java.lang.String throwableMessage,
java.lang.String scriptName,
int line,
java.lang.String stackTrace,
java.lang.String language,
java.awt.image.BufferedImage screenSnapshot)
Write an exception message.
|
java.lang.String |
getLogFilename()
Returns the log file for the log.
|
static java.lang.String |
getTimestamp()
Gets the current locale timestamp that can be logged
|
abstract void |
initLog()
The abstract method that needs to be overridden by the sub classes to initialize their custom logs
|
void |
open()
Opens the log and initializes internal resources.
|
protected void |
persistImage(ILogMessage message)
Persist the screen snap shot if present in the message
|
void |
scriptEnd(java.lang.String name,
java.lang.String language)
Write a script end message into the log
|
void |
scriptStart(java.lang.String name,
IScriptDefinition scriptDef)
Write a script start message into the log
|
void |
setLogDirectory(java.lang.String logDirectory)
Sets the directory the log is beging written to.
|
void |
setLogName(java.lang.String log_Name)
Sets the log name the log is beging written to.
|
void |
timerEnd(java.lang.String name,
java.lang.String language)
Write an end timer message into the log.
|
void |
timerStart(java.lang.String name,
java.lang.String language)
Write a start timer message into the log.
|
void |
write(ILogMessage message)
Perform internal tasks to write log messages.
|
void |
write(int resultCode,
int eventCode,
java.lang.String note)
Perform internal write tasks that should not called by extenders/implementors.
|
abstract void |
writeLog(ILogMessage message)
The abstract method that needs to be overridden by sub classes to handle the log events in the form
of ILogMessage
|
appendLogProperties, createApplicationStartMessage, createAssignActionMessage, createGUIActionMessage, createGUIActionMessage, createLogParticipantMessage, createMessage, createMessage, createTimerEndMessage, ensureLogDirectory, getCurrentDatapool, getCurrentLogFilter, getCurrentScriptResult, getLastScriptResult, getLogDirectory, getLogName, getLogType, getNextUserSnapshotName, getNextUserSnapshotNumber, getScreenShotFile, getScriptName, getScriptPlaybackParams, getSimplifiedScriptElement, getSSGroupForLine, getSummaryEvent, getTestResult, getTimerAndEnd, getTimerValue, info, isLoggingEnabled, isLogGuiActionEnabled, isLogScreenSnapshotActionEnabled, logRootException, processPostGuiAction, processPreGuiAction, setCurrentLogFilter, setLogGUIAction, setLogScreenSnapshotAction, setLogType, setScriptPlaybackParams, setTopResult, shouldBringUpLog, timerEnd, viewerKnowsHowToBringUpComparator, writeGUIAction
openLogViewer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
openLogViewer
protected final float MAX_IMAGE_DIMENSION
public LogExtensionAdapter(java.lang.String logName)
public LogExtensionAdapter()
protected void persistImage(ILogMessage message)
message
- The message that is to be loggedpublic final void write(ILogMessage message)
write
in interface ISimpleLog
write
in class SimpleLogAdapter
message
- The message that is to be loggedISimpleLog.LOG_FAILURE
,
ISimpleLog.LOG_PASS
,
ISimpleLog.LOG_WARNING
,
ISimpleLog.LOG_INFORMATION
,
ISimpleLog.EVENT_SCRIPT_START
,
ISimpleLog.EVENT_SCRIPT_END
,
ISimpleLog.EVENT_VP
,
ISimpleLog.EVENT_CALL_SCRIPT
,
ISimpleLog.EVENT_APPLICATION_START
,
ISimpleLog.EVENT_APPLICATION_END
,
ISimpleLog.EVENT_TIMER_START
,
ISimpleLog.EVENT_TIMER_END
,
ISimpleLog.EVENT_CONFIGURATION
,
ISimpleLog.EVENT_GENERAL
public final void write(int resultCode, int eventCode, java.lang.String note)
write
in interface ISimpleLog
write
in class SimpleLogAdapter
message
- The message that is to be loggedISimpleLog.LOG_FAILURE
,
ISimpleLog.LOG_PASS
,
ISimpleLog.LOG_WARNING
,
ISimpleLog.LOG_INFORMATION
,
ISimpleLog.EVENT_SCRIPT_START
,
ISimpleLog.EVENT_SCRIPT_END
,
ISimpleLog.EVENT_VP
,
ISimpleLog.EVENT_CALL_SCRIPT
,
ISimpleLog.EVENT_APPLICATION_START
,
ISimpleLog.EVENT_APPLICATION_END
,
ISimpleLog.EVENT_TIMER_START
,
ISimpleLog.EVENT_TIMER_END
,
ISimpleLog.EVENT_CONFIGURATION
,
ISimpleLog.EVENT_GENERAL
public final void setLogDirectory(java.lang.String logDirectory)
setLogDirectory
in class LogAdapter
public final void setLogName(java.lang.String log_Name)
setLogName
in class LogAdapter
public final void scriptStart(java.lang.String name, IScriptDefinition scriptDef)
scriptStart
in interface ILog
scriptStart
in class LogAdapter
name
- The script name.language
- The language used for the script ( i.e. java )public final void scriptEnd(java.lang.String name, java.lang.String language)
scriptEnd
in interface ILog
scriptEnd
in class LogAdapter
name
- The script name.language
- The language used for the script ( i.e. java )public final void callScript(java.lang.String name, java.lang.String language)
callScript
in interface ILog
callScript
in class LogAdapter
name
- The script being called.language
- The language used for the script ( i.e. java )public final void applicationStart(java.lang.String name, java.lang.String language)
applicationStart
in interface ILog
applicationStart
in class LogAdapter
name
- The application's name.language
- The language used for the script ( i.e. java )public final void applicationStart(java.lang.String name, int status, java.lang.String description, java.lang.String language)
applicationStart
in interface ILog
applicationStart
in class LogAdapter
name
- The application's namestatus
- Result of starting the application
(@see ISimpleLog.LOG_FAILUREdescription
- Additional text for the status
(e.g. reason for failure)language
- The language used for the script ( i.e. java )ISimpleLog.LOG_WARNING
,
ISimpleLog.LOG_INFORMATION
public final ILogMessage createApplicationStartMessage(java.lang.String name, int status, java.lang.String description, java.lang.String language)
createApplicationStartMessage
in interface ILog
createApplicationStartMessage
in class LogAdapter
name
- The application's name.status
- Result of starting the application
(@see ISimpleLog.LOG_FAILUREdescription
- Additional text for the status
(e.g. reason for failure)language
- The language used for the script ( i.e. java )ISimpleLog.LOG_WARNING
,
ISimpleLog.LOG_INFORMATION
public void timerStart(java.lang.String name, java.lang.String language)
timerStart
in interface ILog
timerStart
in class LogAdapter
name
- The timer name.language
- The language used for the script ( i.e. java )public final ILogMessage createTimerStartMessage(java.lang.String name, java.lang.String language)
createTimerStartMessage
in interface ILog
createTimerStartMessage
in class LogAdapter
name
- The timer name.language
- The language used for the script ( i.e. java )public void timerEnd(java.lang.String name, java.lang.String language)
timerEnd
in interface ILog
timerEnd
in class LogAdapter
name
- The timer name.language
- The language used for the script ( i.e. java )public final ILogMessage createTimerEndMessage(java.lang.String name, java.lang.String language)
createTimerEndMessage
in interface ILog
createTimerEndMessage
in class LogAdapter
name
- The timer name.language
- The language used for the script ( i.e. java )public final ILogMessage createVPMessage(int resultCode, java.lang.String type, java.lang.String name, java.lang.String language)
createVPMessage
in interface ILog
createVPMessage
in class LogAdapter
resultCode
- One of the ILog.LOG_ codes.type
- One of the VP_TYPE_ codes.name
- The verification point name.language
- The language used for the script ( i.e. java )public final void configuration(java.lang.String language)
configuration
in interface ILog
configuration
in class LogAdapter
language
- The language used for the script ( i.e. java )public final ILogMessage createConfigurationMessage(java.lang.String language)
createConfigurationMessage
in interface ILog
createConfigurationMessage
in class LogAdapter
language
- The language used for the script ( i.e. java )public final void exception(java.lang.String note, java.lang.String context, java.lang.String throwableName, java.lang.String throwableMessage, java.lang.String scriptName, int line, java.lang.String stackTrace, java.lang.String language)
exception
in interface ILog
exception
in class LogAdapter
public final void exception(java.lang.String note, java.lang.String context, java.lang.String throwableName, java.lang.String throwableMessage, java.lang.String scriptName, int line, java.lang.String stackTrace, java.lang.String language, java.awt.image.BufferedImage screenSnapshot)
exception
in interface ILog
exception
in class LogAdapter
public final ILogMessage createTestResultMessage(java.lang.String headline, boolean passed, java.lang.String additionalInfo)
createTestResultMessage
in interface ILog
createTestResultMessage
in class LogAdapter
headline
- The headline describing the testpassed
- A boolean indicating if the test
passed or failed.additionalInfo
- Additional information about the testpublic static final java.lang.String getTimestamp()
public void open()
open
in interface ISimpleLog
open
in class SimpleLogAdapter
public void close()
close
in interface ISimpleLog
close
in class SimpleLogAdapter
public java.lang.String getLogFilename()
getLogFilename
in interface ILog
getLogFilename
in class LogAdapter
public abstract void initLog() throws LogException
LogException
public abstract void closeLog()
public abstract void writeLog(ILogMessage message)
message
- The log Message Structure that contains information of log events and properties