Class TestLog

java.lang.Object
core.support.logger.TestLog

public class TestLog
extends Object
  • Field Details

  • Constructor Details

    • TestLog

      public TestLog()
  • Method Details

    • ConsoleLogNoLimit

      public static void ConsoleLogNoLimit​(String value, Object... args)
      logs to console
      Parameters:
      value - value to log
      args - additional arguments for logging to be formatted
    • ConsoleLog

      public static void ConsoleLog​(String value, Object... args)
      logs to console
      Parameters:
      value - value to log
      args - additional arguments for logging to be formatted
    • ConsoleLogWarn

      public static void ConsoleLogWarn​(String value, Object... args)
      logs warning to console
      Parameters:
      value - value to log
      args - additional arguments for logging to be formatted
    • ConsoleLogDebug

      public static void ConsoleLogDebug​(String value, Object... args)
      debug logs to console
      Parameters:
      value - value to log
      args - additional arguments for logging to be formatted
    • ConsoleLogError

      public static void ConsoleLogError​(String value, Object... args)
      error logs to console
      Parameters:
      value - value to log
      args - 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 log
      args - 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 log
      args - 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 log
      args - 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 log
      args - 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 log
      args - 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 log
      args - 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, background
      value - value to log
      args - 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 file
      isVideoAttached - 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 log
      args - 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 log
      args - 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 log
      args - 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 log
      args - 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 log
      args - 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 log
      args - 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 log
      length - 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
    • 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 logs
      testId - 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