Class TestObject

java.lang.Object
core.support.objects.TestObject

public class TestObject extends Object
testInfo columns: testID testName isFirstRun testClass currentDriver ... 1 testA true classA A DriverA 2 testB true classA B DriverB
Author:
CAEHMAT
  • Field Details

    • IS_PROPERTIES_DISABLED

      public static boolean IS_PROPERTIES_DISABLED
    • PROXY_ENABLED

      public static final String PROXY_ENABLED
      See Also:
    • PROXY_HOST

      public static final String PROXY_HOST
      See Also:
    • PROXY_PORT

      public static final String PROXY_PORT
      See Also:
    • PROXY_USER

      public static final String PROXY_USER
      See Also:
    • PROXY_PASS

      public static final String PROXY_PASS
      See Also:
    • PROXY_PROTOCOL

      public static final String PROXY_PROTOCOL
      See Also:
    • BEFORE_SUITE_PREFIX

      public static String BEFORE_SUITE_PREFIX
    • AFTER_SUITE_PREFIX

      public static String AFTER_SUITE_PREFIX
    • BEFORE_CLASS_PREFIX

      public static String BEFORE_CLASS_PREFIX
    • AFTER_CLASS_PREFIX

      public static String AFTER_CLASS_PREFIX
    • BEFORE_METHOD_PREFIX

      public static String BEFORE_METHOD_PREFIX
    • BEFORE_TEST_FILE_PREFIX

      public static String BEFORE_TEST_FILE_PREFIX
    • AFTER_TEST_FILE_PREFIX

      public static String AFTER_TEST_FILE_PREFIX
    • PARENT_PREFIX

      public static String PARENT_PREFIX
    • DATAPROVIDER_TEST_SUFFIX

      public static String DATAPROVIDER_TEST_SUFFIX
    • DEFAULT_TEST

      public static final String DEFAULT_TEST
      See Also:
    • DEFAULT_TEST_THREAD_PREFIX

      public static final String DEFAULT_TEST_THREAD_PREFIX
      See Also:
    • RANDOM_STRING

      public static final String RANDOM_STRING
      See Also:
    • START_TIME_STRING

      public static final String START_TIME_STRING
      See Also:
    • UUID_STATIC_STRING

      public static final String UUID_STATIC_STRING
      See Also:
    • DEFAULT_APP

      public static final String DEFAULT_APP
      See Also:
    • SUITE_NAME

      public static String SUITE_NAME
    • APP_IDENTIFIER

      public static String APP_IDENTIFIER
    • TEST_APP_API

      public static final String TEST_APP_API
      See Also:
    • webDriverList

      public List<org.openqa.selenium.WebDriver> webDriverList
    • app

      public String app
    • type

      public TestObject.testType type
    • testId

      public String testId
    • testName

      public String testName
    • className

      public String className
    • deviceName

      public String deviceName
    • testFileClassName

      public String testFileClassName
    • currentDriver

      public DriverObject currentDriver
    • isFirstRun

      public Boolean isFirstRun
    • isForcedRestart

      public Boolean isForcedRestart
    • login

      public LoginObject login
    • runCount

      public int runCount
    • isTestPass

      public Boolean isTestPass
    • isTestFail

      public Boolean isTestFail
    • isTestComplete

      public Boolean isTestComplete
    • log

      public org.apache.logging.log4j.Logger log
    • currentTestIndex

      public int currentTestIndex
    • testCountInCsvFile

      public int testCountInCsvFile
    • testCsvFileName

      public String testCsvFileName
    • serviceObject

      public ServiceObject serviceObject
    • activeServiceObject

      public ServiceObject activeServiceObject
    • description

      public org.junit.runner.Description description
    • caughtThrowable

      public Throwable caughtThrowable
    • failTrace

      public ArrayList<String> failTrace
    • failedTests

      public ArrayList<org.testng.ITestResult> failedTests
    • testFeature

      public com.aventstack.extentreports.ExtentTest testFeature
    • testScenerio

      public com.aventstack.extentreports.ExtentTest testScenerio
    • testSteps

      public List<com.aventstack.extentreports.ExtentTest> testSteps
    • testSubSteps

      public List<String> testSubSteps
    • missingConfigVars

      public List<String> missingConfigVars
    • screenRecorder

      public org.monte.screenrecorder.ScreenRecorder screenRecorder
    • isScreenRecorderInitiated

      public boolean isScreenRecorderInitiated
    • testLog

      public List<LogObject> testLog
    • testLogAll

      public List<LogObject> testLogAll
    • languageMap

      public Map<String,String> languageMap
    • apiMap

      public Map<String,ServiceObject> apiMap
    • config

      public Map<String,Object> config
    • configKeys

      public com.google.common.collect.Multimap<String,String> configKeys
    • testObjects

      public List<TestObject> testObjects
    • currentTestName

      public static ThreadLocal<String> currentTestName
    • currentTestId

      public static ThreadLocal<String> currentTestId
    • language

      public String language
    • softAssert

      public org.testng.asserts.SoftAssert softAssert
    • testInfo

      public static Map<String,TestObject> testInfo
  • Constructor Details

    • TestObject

      public TestObject()
  • Method Details

    • withWebDriver

      public TestObject withWebDriver(org.openqa.selenium.WebDriver webdriver)
    • initializeTest

      public static void initializeTest(String testId)
      once per test, initialize test object maps driver with the test associates current driver with test
    • initializeTest

      public static void initializeTest(DriverObject driver, String testId)
      once per test, initialize test object maps driver with the test associates current driver with test
    • inheritParent

      public static TestObject inheritParent(DriverObject driver, String testId)
      Inheritance structure for test object before suite -> before class -> test method before suite -> before class -> after class before suite -> after suite Service test hierarchy: before suite -> before class -> csv file name object -> csv tests before suite -> before class -> after class before suite -> after suite note: before method inheritance not supported
      Returns:
    • getTestObjectInheritence

      public static TestObject getTestObjectInheritence(DriverObject driver, String testId)
      Inheritance structure for test object before suite -> before class -> test method before suite -> before class -> after class before suite -> after suite
      Returns:
    • isFirstRun

      public static boolean isFirstRun()
      returns true if webdriver has not started else returns true if isFirstRun is set to true
      Returns:
    • getTestInfo

      public static TestObject getTestInfo()
      testInfo is a static list containing hashmap of test objects with test name as key if testObject is empty for testId, Then default test is initialized And used
      Returns:
    • getGlobalTestInfo

      public static TestObject getGlobalTestInfo()
      gets default test object if not exist, create default test object
      Returns:
    • getParentTestInfo

      public static TestObject getParentTestInfo(ServiceObject serviceObject)
      get parent test object parent id is unique for each csv test file in service tests user for inheritance of config and log files
      Parameters:
      serviceObject -
      Returns:
    • setupDefaultDriver

      public static void setupDefaultDriver()
    • updateAppName

      public static void updateAppName(DriverObject driver)
      updates default test app name to driver app name default test object tracks the test run app name used for report name
      Parameters:
      driver -
    • getTestState

      public static TestObject.testState getTestState(String testName)
      get the state of the test object can be suite, testClass, testMethod
      Parameters:
      testName -
      Returns:
    • setTestName

      public static void setTestName(String testName)
    • setTestId

      public static void setTestId(String testId)
    • setTestId

      public static void setTestId(String testclass, String testname)
    • getTestId

      public static String getTestId()
    • isTestObjectSet

      public static boolean isTestObjectSet(String testId)
      return true if testId is registered
      Parameters:
      testId -
      Returns:
    • isTestObjectSet

      public static boolean isTestObjectSet()
    • hasTestStarted

      public static boolean hasTestStarted()
      TODO: Remove is test runner returns true if test is running, not before class, or after class based on testid: classname - testname
      Returns:
    • setLogging

      public static void setLogging()
    • getTestInfo

      public static TestObject getTestInfo(String testId)
    • isBeforeTest

      public static boolean isBeforeTest(String testId)
    • isValidTestId

      public static boolean isValidTestId(String testId)
    • getTestInvocationCount

      public static int getTestInvocationCount(String testname)
      returns the invocation count for the data provider test format class-testname-test1
      Parameters:
      testname -
      Returns:
    • getApiDef

      public static ServiceObject getApiDef(String key)
      gets api object from api keywords each keyword is associated with a api call use api keywords csv files for definitions
      Parameters:
      key -
      Returns:
    • withIsFirstRun

      public TestObject withIsFirstRun(Boolean isFirstRun)
    • withIsForcedRestart

      public TestObject withIsForcedRestart(Boolean isForcedRestart)
    • withCurrentDriver

      public TestObject withCurrentDriver(DriverObject currentDriver)
    • withTestId

      public TestObject withTestId(String testId)
    • withTestName

      public TestObject withTestName(String testName)
    • withClassName

      public TestObject withClassName(String className)
    • withIsTestComplete

      public TestObject withIsTestComplete(boolean isTestComplete)
    • withTestFileClassName

      public TestObject withTestFileClassName(String testFileClassName)
    • withWebDriverList

      public TestObject withWebDriverList(List<org.openqa.selenium.WebDriver> webDriverList)
    • getTestName

      public String getTestName()
      * testname is grabbed from test id test id is in format of "class - testname" if is before class And no testname exists, empty string is returned
      Returns:
    • getClassName

      public String getClassName()
    • withRunCount

      public TestObject withRunCount(int rerunCount)
    • withLog

      public TestObject withLog(org.apache.logging.log4j.Logger log)
    • incremenetRunCount

      public TestObject incremenetRunCount()
    • withIsTestPass

      public TestObject withIsTestPass(Boolean isTestPass)
    • withDescription

      public TestObject withDescription(org.junit.runner.Description description)
    • withCaughtThrowable

      public TestObject withCaughtThrowable(Throwable caughtThrowable)
    • withFailTrace

      public TestObject withFailTrace(ArrayList<String> failTrace)
    • withTestScenario

      public TestObject withTestScenario(com.aventstack.extentreports.ExtentTest testScenerio)
    • withApp

      public TestObject withApp(String app)
    • getDefaultTestObjectId

      public static String getDefaultTestObjectId()