Package core.support.logger
Class TestLog
java.lang.Object
core.support.logger.TestLog
public class TestLog extends Object
-
Field Summary
Fields Modifier and Type Field Description static StringENABLE_DEBUGstatic StringENABLE_EXTENT_SUBSTEPSstatic StringIS_LOG_LIMITstatic StringLOG_MAX_LIMITstatic StringLOG_SKIP_CONSOLEstatic StringLOG4JPATHstatic StringMARYstatic StringWATSON -
Constructor Summary
Constructors Constructor Description TestLog() -
Method Summary
Modifier and Type Method Description static voidAnd(String value, Object... args)logs to extent report as and nodestatic voidattachVideoLog(String path, boolean isVideoAttached)adds video and video link to the sub stepstatic voidattachVideoLogToReportPortal(File video)link video file to report portal currently attaching avi files does not work properly, hence linking url insteadstatic voidBackground(String value, Object... args)logs to extent report as background nodestatic voidBut(String value, Object... args)logs to extent report as but nodestatic booleancheckLatestAutonomx()compares autonomx latest version from maven central against current maven version.static booleancheckLatestAutonomxMavenVersion()compares autonomx latest version from maven central against current maven version.static voidConsoleLog(String value, Object... args)logs to consolestatic voidConsoleLogDebug(String value, Object... args)debug logs to consolestatic voidConsoleLogError(String value, Object... args)error logs to consolestatic voidConsoleLogNoLimit(String value, Object... args)logs to consolestatic voidConsoleLogWarn(String value, Object... args)logs warning to consolestatic StringformatMessage(String value, boolean isLimitMessage, Object... args)static StringformatMessage(String value, Object... args)static StringformatMessageNoLimit(String value, Object... args)static com.aventstack.extentreports.ExtentTestgetTestScenario()static voidGiven(String value, Object... args)logs to extent report as given nodestatic voidlogFail(String value, Object... args)sets fail log for extent report and consolestatic voidlogPass(String value, Object... args)log pass is used for test steps for extend report, enable if properties option enableDetailedReport is truestatic voidlogWarning(String value, Object... args)sets warning log for extent report and consolestatic voidplayAudio(String value)plays audio file based on text valuestatic voidprintBatchClassToConsole(String classType)prints class level logs to console prints only oncestatic voidprintBatchLogsToConsole()prints out the entire test log for csv file at once Occurs When number of csv files are greater than 1static voidprintBatchToConsole(String testId)prints batch class to console based on testIdstatic voidprintLogoOnSuccess()static voidprintLogs(List<LogObject> logs)prints current test logsstatic voidprintLogs(List<LogObject> testLog, String testId)prints logs to console removes logs from list after printing to consolestatic voidremoveLogUtilHandler()removes handler for java.util.logging removes logs from third party jars such as webdriverstatic StringsetMaxLength(String value)limites the max value sizestatic StringsetMaxLength(String value, int length)static voidsetPassSubTestStep(String subStep)sets substep as passstatic voidsetTestStep(core.support.logger.TestLog.gherkins gherkinState, String value, Object... args)sets test step based on the gherkins language steps: given, when, then, and, but, backgroundstatic voidsetupLog4j()sets up log4j logginstatic voidThen(String value, Object... args)logs to extent report as then nodestatic voidWhen(String value, Object... args)logs to extent report as when node
-
Field Details
-
ENABLE_EXTENT_SUBSTEPS
- See Also:
- Constant Field Values
-
ENABLE_DEBUG
- See Also:
- Constant Field Values
-
IS_LOG_LIMIT
- See Also:
- Constant Field Values
-
LOG_MAX_LIMIT
- See Also:
- Constant Field Values
-
LOG_SKIP_CONSOLE
- See Also:
- Constant Field Values
-
WATSON
-
MARY
-
LOG4JPATH
-
-
Constructor Details
-
TestLog
public TestLog()
-
-
Method Details
-
ConsoleLogNoLimit
logs to console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
ConsoleLog
logs to console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
ConsoleLogWarn
logs warning to console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
ConsoleLogDebug
debug logs to console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
ConsoleLogError
error logs to console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
Background
logs to extent report as background node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
But
logs to extent report as but node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
Given
logs to extent report as given node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
When
logs to extent report as when node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
And
logs to extent report as and node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
Then
logs to extent report as then node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
setTestStep
public static void setTestStep(core.support.logger.TestLog.gherkins gherkinState, String value, Object... args)sets test step based on the gherkins language steps: given, when, then, and, but, background- Parameters:
gherkinState- given, when, then, and, but, backgroundvalue- value to logargs- additional arguments for logging to be formatted
-
setPassSubTestStep
sets substep as pass- Parameters:
subStep- the substep node value
-
attachVideoLog
adds video and video link to the sub step- Parameters:
path- relative path to the video fileisVideoAttached- if the video is going to be attached to the extent report path : relative path to the video file
-
attachVideoLogToReportPortal
link video file to report portal currently attaching avi files does not work properly, hence linking url instead- Parameters:
path-
-
logPass
log pass is used for test steps for extend report, enable if properties option enableDetailedReport is true- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
logFail
sets fail log for extent report and console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
logWarning
sets warning log for extent report and console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
getTestScenario
public static com.aventstack.extentreports.ExtentTest getTestScenario()- Returns:
- gets the test scenario node
-
formatMessageNoLimit
- Parameters:
value- value to logargs- additional arguments for logging to be formatted- Returns:
- formatted message based on value and arguments
-
formatMessage
- Parameters:
value- value to logargs- additional arguments for logging to be formatted- Returns:
- formatted message based on value and arguments
-
formatMessage
- Parameters:
value- value to logargs- additional arguments for logging to be formatted- Returns:
- formatted message based on value and arguments
-
setMaxLength
limites the max value size- Parameters:
value- value to log- Returns:
- truncated message to maximum length
-
setMaxLength
- Parameters:
value- value to loglength- length to truncate message to- Returns:
- truncated message to maximum length
-
removeLogUtilHandler
public static void removeLogUtilHandler()removes handler for java.util.logging removes logs from third party jars such as webdriver -
setupLog4j
public static void setupLog4j()sets up log4j loggin -
playAudio
plays audio file based on text value- Parameters:
value- text value to play back
-
printBatchLogsToConsole
public static void printBatchLogsToConsole()prints out the entire test log for csv file at once Occurs When number of csv files are greater than 1 -
printBatchClassToConsole
prints class level logs to console prints only once- Parameters:
classType-
-
printBatchToConsole
prints batch class to console based on testId- Parameters:
testId-
-
printLogs
prints current test logs- Parameters:
logs- list of log objects
-
printLogs
prints logs to console removes logs from list after printing to console- Parameters:
testLog- list of logstestId- id of the test
-
printLogoOnSuccess
public static void printLogoOnSuccess() -
checkLatestAutonomxMavenVersion
public static boolean checkLatestAutonomxMavenVersion()compares autonomx latest version from maven central against current maven version. lets user know a new version of autonomx is available- Throws:
XPathExpressionException
-
checkLatestAutonomx
public static boolean checkLatestAutonomx()compares autonomx latest version from maven central against current maven version. lets user know a new version of autonomx is available- Throws:
XPathExpressionException
-