Package core.support.objects
Class TestObject
java.lang.Object
core.support.objects.TestObject
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 ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic ThreadLocal<String> intstatic ThreadLocal<String> static Stringstatic final Stringstatic final Stringstatic final Stringorg.junit.runner.DescriptionArrayList<org.testng.ITestResult> static booleanbooleanorg.apache.logging.log4j.Loggerstatic Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringintorg.monte.screenrecorder.ScreenRecorderorg.testng.asserts.SoftAssertstatic final Stringstatic Stringstatic final Stringintcom.aventstack.extentreports.ExtentTeststatic Map<String, TestObject> com.aventstack.extentreports.ExtentTestList<com.aventstack.extentreports.ExtentTest> static final StringList<org.openqa.selenium.WebDriver> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ServiceObjectgets api object from api keywords each keyword is associated with a api call use api keywords csv files for definitionsstatic Stringstatic TestObjectgets 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 Stringstatic TestObjecttestInfo 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-test1* 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 booleanTODO: Remove is test runner returns true if test is running, not before class, or after class based on testid: classname - testnamestatic 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 booleanreturns true if webdriver has not started else returns true if isFirstRun is set to truestatic booleanstatic booleanisTestObjectSet(String testId) return true if testId is registeredstatic booleanisValidTestId(String testId) static voidstatic voidstatic voidstatic voidsetTestName(String testName) static voidstatic voidupdateAppName(DriverObject driver) updates default test app name to driver app name default test object tracks the test run app name used for report namewithCaughtThrowable(Throwable caughtThrowable) withClassName(String className) withCurrentDriver(DriverObject currentDriver) withDescription(org.junit.runner.Description description) withFailTrace(ArrayList<String> failTrace) withIsFirstRun(Boolean isFirstRun) withIsForcedRestart(Boolean isForcedRestart) withIsTestComplete(boolean isTestComplete) withIsTestPass(Boolean isTestPass) withLog(org.apache.logging.log4j.Logger log) withRunCount(int rerunCount) withTestFileClassName(String testFileClassName) withTestId(String testId) withTestName(String testName) withTestScenario(com.aventstack.extentreports.ExtentTest testScenerio) withWebDriver(org.openqa.selenium.WebDriver webdriver) withWebDriverList(List<org.openqa.selenium.WebDriver> webDriverList)
-
Field Details
-
IS_PROPERTIES_DISABLED
public static boolean IS_PROPERTIES_DISABLED -
PROXY_ENABLED
- See Also:
-
PROXY_HOST
- See Also:
-
PROXY_PORT
- See Also:
-
PROXY_USER
- See Also:
-
PROXY_PASS
- See Also:
-
PROXY_PROTOCOL
- See Also:
-
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:
-
DEFAULT_TEST_THREAD_PREFIX
- See Also:
-
RANDOM_STRING
- See Also:
-
START_TIME_STRING
- See Also:
-
UUID_STATIC_STRING
- See Also:
-
DEFAULT_APP
- See Also:
-
SUITE_NAME
-
APP_IDENTIFIER
-
TEST_APP_API
- See Also:
-
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
-