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
All Methods Static Methods Concrete Methods 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 voidplayMaryAudio(String value)plays audio using marytts librarystatic voidplayWatsonAudio(String value)watson audiostatic 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 Detail
-
ENABLE_EXTENT_SUBSTEPS
public static final String ENABLE_EXTENT_SUBSTEPS
- See Also:
- Constant Field Values
-
ENABLE_DEBUG
public static final String ENABLE_DEBUG
- See Also:
- Constant Field Values
-
IS_LOG_LIMIT
public static final String IS_LOG_LIMIT
- See Also:
- Constant Field Values
-
LOG_MAX_LIMIT
public static final String LOG_MAX_LIMIT
- See Also:
- Constant Field Values
-
LOG_SKIP_CONSOLE
public static final String LOG_SKIP_CONSOLE
- See Also:
- Constant Field Values
-
WATSON
public static String WATSON
-
MARY
public static String MARY
-
LOG4JPATH
public static final String LOG4JPATH
-
-
Method Detail
-
ConsoleLogNoLimit
public static void ConsoleLogNoLimit(String value, Object... args)
logs to console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
ConsoleLog
public static void ConsoleLog(String value, Object... args)
logs to console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
ConsoleLogWarn
public static void ConsoleLogWarn(String value, Object... args)
logs warning to console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
ConsoleLogDebug
public static void ConsoleLogDebug(String value, Object... args)
debug logs to console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
ConsoleLogError
public static void ConsoleLogError(String value, Object... args)
error logs to console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
Background
public static void Background(String value, Object... args)
logs to extent report as background node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
But
public static void But(String value, Object... args)
logs to extent report as but node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
Given
public static void Given(String value, Object... args)
logs to extent report as given node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
When
public static void When(String value, Object... args)
logs to extent report as when node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
And
public static void And(String value, Object... args)
logs to extent report as and node- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
Then
public static void Then(String value, Object... args)
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
public static void setPassSubTestStep(String subStep)
sets substep as pass- Parameters:
subStep- the substep node value
-
attachVideoLog
public static void attachVideoLog(String path, boolean isVideoAttached)
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
public static void attachVideoLogToReportPortal(File video)
link video file to report portal currently attaching avi files does not work properly, hence linking url instead- Parameters:
path-
-
logPass
public static void logPass(String value, Object... args)
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
public static void logFail(String value, Object... args)
sets fail log for extent report and console- Parameters:
value- value to logargs- additional arguments for logging to be formatted
-
logWarning
public static void logWarning(String value, Object... args)
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
public static String formatMessageNoLimit(String value, Object... args)
- Parameters:
value- value to logargs- additional arguments for logging to be formatted- Returns:
- formatted message based on value and arguments
-
formatMessage
public static String formatMessage(String value, Object... args)
- Parameters:
value- value to logargs- additional arguments for logging to be formatted- Returns:
- formatted message based on value and arguments
-
formatMessage
public static String formatMessage(String value, boolean isLimitMessage, Object... args)
- Parameters:
value- value to logargs- additional arguments for logging to be formatted- Returns:
- formatted message based on value and arguments
-
setMaxLength
public static String setMaxLength(String value)
limites the max value size- Parameters:
value- value to log- Returns:
- truncated message to maximum length
-
setMaxLength
public static String setMaxLength(String value, int length)
- 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
public static void playAudio(String value)
plays audio file based on text value- Parameters:
value- text value to play back
-
playMaryAudio
public static void playMaryAudio(String value)
plays audio using marytts library- Parameters:
value- text value to play back
-
playWatsonAudio
public static void playWatsonAudio(String value)
watson audio- 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
public static void printBatchClassToConsole(String classType)
prints class level logs to console prints only once- Parameters:
classType-
-
printBatchToConsole
public static void printBatchToConsole(String testId)
prints batch class to console based on testId- Parameters:
testId-
-
printLogs
public static void printLogs(List<LogObject> logs)
prints current test logs- Parameters:
logs- list of log objects
-
printLogs
public static void printLogs(List<LogObject> testLog, String testId)
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
-
-