Package core.support.objects
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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTestObject.testStatestatic classTestObject.testType -
Field Summary
-
Constructor Summary
Constructors Constructor Description TestObject() -
Method Summary
Modifier and Type Method Description static ServiceObjectgetApiDef(String key)gets api object from api keywords each keyword is associated with a api call use api keywords csv files for definitionsStringgetClassName()static StringgetDefaultTestObjectId()static TestObjectgetGlobalTestInfo()gets default test object if not exist, create default test objectstatic TestObjectgetParentTestInfo(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 filesstatic StringgetTestId()static TestObjectgetTestInfo()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 usedstatic TestObjectgetTestInfo(String testId)static intgetTestInvocationCount(String testname)returns the invocation count for the data provider test format class-testname-test1StringgetTestName()* 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 returnedstatic TestObjectgetTestObjectInheritence(DriverObject driver, String testId)Inheritance structure for test object before suite -> before class -> test method before suite -> before class -> after class before suite -> after suitestatic TestObject.testStategetTestState(String testName)get the state of the test object can be suite, testClass, testMethodstatic booleanhasTestStarted()TODO: Remove is test runner returns true if test is running, not before class, or after class based on testid: classname - testnameTestObjectincremenetRunCount()static TestObjectinheritParent(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 supportedstatic voidinitializeTest(DriverObject driver, String testId)once per test, initialize test object maps driver with the test associates current driver with teststatic voidinitializeTest(String testId)once per test, initialize test object maps driver with the test associates current driver with teststatic booleanisBeforeTest(String testId)static booleanisFirstRun()returns true if webdriver has not started else returns true if isFirstRun is set to truestatic booleanisTestObjectSet()static booleanisTestObjectSet(String testId)return true if testId is registeredstatic booleanisValidTestId(String testId)static voidsetLogging()static voidsetTestId(String testId)static voidsetTestId(String testclass, String testname)static voidsetTestName(String testName)static voidsetupDefaultDriver()static voidupdateAppName(DriverObject driver)updates default test app name to driver app name default test object tracks the test run app name used for report nameTestObjectwithApp(String app)TestObjectwithCaughtThrowable(Throwable caughtThrowable)TestObjectwithClassName(String className)TestObjectwithCurrentDriver(DriverObject currentDriver)TestObjectwithDescription(org.junit.runner.Description description)TestObjectwithFailTrace(ArrayList<String> failTrace)TestObjectwithIsFirstRun(Boolean isFirstRun)TestObjectwithIsForcedRestart(Boolean isForcedRestart)TestObjectwithIsTestComplete(boolean isTestComplete)TestObjectwithIsTestPass(Boolean isTestPass)TestObjectwithLog(org.apache.logging.log4j.Logger log)TestObjectwithRunCount(int rerunCount)TestObjectwithTestFileClassName(String testFileClassName)TestObjectwithTestId(String testId)TestObjectwithTestName(String testName)TestObjectwithTestScenario(com.aventstack.extentreports.ExtentTest testScenerio)TestObjectwithWebDriver(org.openqa.selenium.WebDriver webdriver)TestObjectwithWebDriverList(List<org.openqa.selenium.WebDriver> webDriverList)
-
Field Details
-
IS_PROPERTIES_DISABLED
public static boolean IS_PROPERTIES_DISABLED -
PROXY_ENABLED
- See Also:
- Constant Field Values
-
PROXY_HOST
- See Also:
- Constant Field Values
-
PROXY_PORT
- See Also:
- Constant Field Values
-
PROXY_USER
- See Also:
- Constant Field Values
-
PROXY_PASS
- See Also:
- Constant Field Values
-
PROXY_PROTOCOL
- See Also:
- Constant Field Values
-
BEFORE_SUITE_PREFIX
-
AFTER_SUITE_PREFIX
-
BEFORE_CLASS_PREFIX
-
AFTER_CLASS_PREFIX
-
BEFORE_METHOD_PREFIX
-
BEFORE_TEST_FILE_PREFIX
-
AFTER_TEST_FILE_PREFIX
-
PARENT_PREFIX
-
DATAPROVIDER_TEST_SUFFIX
-
DEFAULT_TEST
- See Also:
- Constant Field Values
-
DEFAULT_TEST_THREAD_PREFIX
- See Also:
- Constant Field Values
-
RANDOM_STRING
- See Also:
- Constant Field Values
-
START_TIME_STRING
- See Also:
- Constant Field Values
-
UUID_STATIC_STRING
- See Also:
- Constant Field Values
-
DEFAULT_APP
- See Also:
- Constant Field Values
-
SUITE_NAME
-
APP_IDENTIFIER
-
TEST_APP_API
- See Also:
- Constant Field Values
-
webDriverList
-
app
-
type
-
testId
-
testName
-
className
-
deviceName
-
testFileClassName
-
currentDriver
-
isFirstRun
-
isForcedRestart
-
login
-
runCount
public int runCount -
isTestPass
-
isTestFail
-
isTestComplete
-
log
public org.apache.logging.log4j.Logger log -
currentTestIndex
public int currentTestIndex -
testCountInCsvFile
public int testCountInCsvFile -
testCsvFileName
-
serviceObject
-
activeServiceObject
-
description
public org.junit.runner.Description description -
caughtThrowable
-
failTrace
-
failedTests
-
testFeature
public com.aventstack.extentreports.ExtentTest testFeature -
testScenerio
public com.aventstack.extentreports.ExtentTest testScenerio -
testSteps
-
testSubSteps
-
missingConfigVars
-
screenRecorder
public org.monte.screenrecorder.ScreenRecorder screenRecorder -
isScreenRecorderInitiated
public boolean isScreenRecorderInitiated -
testLog
-
testLogAll
-
languageMap
-
apiMap
-
config
-
configKeys
-
testObjects
-
currentTestName
-
currentTestId
-
language
-
softAssert
public org.testng.asserts.SoftAssert softAssert -
testInfo
-
-
Constructor Details
-
TestObject
public TestObject()
-
-
Method Details
-
withWebDriver
-
initializeTest
once per test, initialize test object maps driver with the test associates current driver with test -
initializeTest
once per test, initialize test object maps driver with the test associates current driver with test -
inheritParent
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
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
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
gets default test object if not exist, create default test object- Returns:
-
getParentTestInfo
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
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
get the state of the test object can be suite, testClass, testMethod- Parameters:
testName-- Returns:
-
setTestName
-
setTestId
-
setTestId
-
getTestId
-
isTestObjectSet
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
-
isBeforeTest
-
isValidTestId
-
getTestInvocationCount
returns the invocation count for the data provider test format class-testname-test1- Parameters:
testname-- Returns:
-
getApiDef
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
-
withIsForcedRestart
-
withCurrentDriver
-
withTestId
-
withTestName
-
withClassName
-
withIsTestComplete
-
withTestFileClassName
-
withWebDriverList
-
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
-
withRunCount
-
withLog
-
incremenetRunCount
-
withIsTestPass
-
withDescription
-
withCaughtThrowable
-
withFailTrace
-
withTestScenario
-
withApp
-
getDefaultTestObjectId
-