Class TestScenarioLogCollection

java.lang.Object
de.qytera.qtaf.core.log.model.collection.TestScenarioLogCollection

public class TestScenarioLogCollection extends Object
This class works as a collection for log messages that are produced during a test execution.
  • Method Details

    • createTestScenarioLogCollection

      public static TestScenarioLogCollection createTestScenarioLogCollection(int featureId, String scenarioId, String scenarioName)
      Factory method. Creates new test log collection. If a collection with the given ID exists then return the existing collection. This method has to be synchronized so that it works correctly when using multiple threads.
      Parameters:
      featureId - Unique collection ID
      scenarioId - Method Id (packageName + className + methodName)
      scenarioName - Test ID
      Returns:
      test log collection
    • fromQtafTestEventPayload

      public static TestScenarioLogCollection fromQtafTestEventPayload(IQtafTestEventPayload iQtafTestEventPayload)
      Factory method that creates new log collection from test event payload This method has to be synchronized so that it works correctly when using multiple threads.
      Parameters:
      iQtafTestEventPayload - test event payload
      Returns:
      test log collection
    • equals

      public boolean equals(Object o)
      Override equals to compare two TestScenarioLogCollection objects
      Overrides:
      equals in class Object
      Parameters:
      o - Object to compare with this instance
      Returns:
      true if both are equal, false otherwise
    • hashCode

      public int hashCode()
      Calculate hash code for this instance. The contains() methods of the collections use the hash code to check if object is already stored.
      Overrides:
      hashCode in class Object
      Returns:
      hash code
    • getFeatureId

      public int getFeatureId()
      Get uniqueId
      Returns:
      uniqueId
    • buildId

      public static String buildId(String methodId, String testId)
      Build ID
      Parameters:
      methodId - Method ID
      testId - Test ID
      Returns:
      ID
    • getScenarioId

      public String getScenarioId()
      Get test ID
      Returns:
      test ID
    • getScenarioName

      public String getScenarioName()
      Get testId
      Returns:
      testId TestId
    • getStatus

      Get status
      Returns:
      status Status
    • setStatus

      Set test status
      Parameters:
      status - test status
      Returns:
      this
    • setDescription

      public TestScenarioLogCollection setDescription(String description)
      Set test description
      Parameters:
      description - test description
      Returns:
      this
    • setGroupDependencies

      public TestScenarioLogCollection setGroupDependencies(String[] groupDependencies)
      Set test group dependencies
      Parameters:
      groupDependencies - test group dependencies
      Returns:
      this
    • setMethodDependencies

      public TestScenarioLogCollection setMethodDependencies(String[] methodDependencies)
      Set test method dependencies
      Parameters:
      methodDependencies - test method dependencies
      Returns:
      this
    • getLogMessages

      public ArrayList<LogMessage> getLogMessages()
      Get logMessages
      Returns:
      logMessages LogMessages
    • addLogMessage

      public TestScenarioLogCollection addLogMessage(LogMessage logMessage)
      Add log message object This methods needs to run synchronized because of the check for existence.
      Parameters:
      logMessage - log message object
      Returns:
      this
    • addLogMessage

      public TestScenarioLogCollection addLogMessage(LogLevel level, String message)
      Add log message
      Parameters:
      level - log level
      message - log message
      Returns:
      this
    • getScreenshotPaths

      public ArrayList<String> getScreenshotPaths()
      Get screenshotPaths
      Returns:
      screenshotPaths
    • addScreenshotPath

      public TestScenarioLogCollection addScreenshotPath(String filepath)
      Add screenshot path to test scenario log
      Parameters:
      filepath - Path to screenshot file
      Returns:
      this
    • getScreenshotBefore

      public String getScreenshotBefore()
      Get screenshotBefore
      Returns:
      screenshotBefore
    • setScreenshotBefore

      public TestScenarioLogCollection setScreenshotBefore(String screenshotBefore)
      Set screenshotBefore
      Parameters:
      screenshotBefore - ScreenshotBefore
      Returns:
      this
    • getScreenshotAfter

      public String getScreenshotAfter()
      Get screenshotAfter
      Returns:
      screenshotAfter
    • setScreenshotAfter

      public TestScenarioLogCollection setScreenshotAfter(String screenshotAfter)
      Set screenshotAfter
      Parameters:
      screenshotAfter - ScreenshotAfter
      Returns:
      this
    • getTags

      public Map<String,String> getTags()
      Get tags
      Returns:
      tags
    • addTag

      public TestScenarioLogCollection addTag(String key, String value)
      Add tag to test scenario log
      Parameters:
      key - Tag key
      value - Tag value
      Returns:
      this
    • debug

      public TestScenarioLogCollection debug(String message)
      Add debug message
      Parameters:
      message - message
      Returns:
      this
    • info

      public TestScenarioLogCollection info(String message)
      Add info message
      Parameters:
      message - message
      Returns:
      this
    • warn

      public TestScenarioLogCollection warn(String message)
      Add warn message
      Parameters:
      message - message
      Returns:
      this
    • error

      public TestScenarioLogCollection error(String message)
      Add error message
      Parameters:
      message - message
      Returns:
      this
    • getDescription

      public String getDescription()
      Get description
      Returns:
      description
    • getGroupDependencies

      public String[] getGroupDependencies()
      Get groupDependencies
      Returns:
      groupDependencies
    • getMethodDependencies

      public String[] getMethodDependencies()
      Get methodDependencies
      Returns:
      methodDependencies
    • getStart

      public Date getStart()
      Get start
      Returns:
      start
    • setStart

      public TestScenarioLogCollection setStart(Date start)
      Set start
      Parameters:
      start - Start
      Returns:
      this
    • getEnd

      public Date getEnd()
      Get end
      Returns:
      end
    • setEnd

      public TestScenarioLogCollection setEnd(Date end)
      Set end
      Parameters:
      end - End
      Returns:
      this
    • getThreadId

      public long getThreadId()
      Get threadId
      Returns:
      threadId
    • setThreadId

      public TestScenarioLogCollection setThreadId(long threadId)
      Set threadId
      Parameters:
      threadId - ThreadId
      Returns:
      this
    • getThreadName

      public String getThreadName()
      Get threadName
      Returns:
      threadName
    • setThreadName

      public TestScenarioLogCollection setThreadName(String threadName)
      Set threadName
      Parameters:
      threadName - ThreadName
      Returns:
      this
    • getGroups

      public String[] getGroups()
      Get groups
      Returns:
      groups
    • setGroups

      public TestScenarioLogCollection setGroups(String[] groups)
      Set groups
      Parameters:
      groups - Groups
      Returns:
      this
    • getDuration

      public long getDuration()
      Get duration
      Returns:
      duration
    • setDuration

      public TestScenarioLogCollection setDuration(long duration)
      Set duration
      Parameters:
      duration - Duration
      Returns:
      this
    • addParameters

      public TestScenarioLogCollection addParameters(Parameter[] parameters, Object[] values)
      Add test parameters to log
      Parameters:
      parameters - method parameters
      values - method values
      Returns:
      this
    • exists

      public static boolean exists(TestScenarioLogCollection scenarioLogCollection)
      Check if index already has this ScenarioLogCollection
      Parameters:
      scenarioLogCollection - Scenario log collection
      Returns:
      true if exists, false otherwise
    • getIndexSize

      public static int getIndexSize()
      Count the number of scenario log collections saved in the index
      Returns:
      number of scenario log collections saved in the index
    • clearIndex

      public static void clearIndex()
      Remove all scenario log collections