BTAC :: Custom Automation Libraries for Reusability + Time Saving ~Yagnesh Shah

Blended Test Automation Concepts (BTAC)

Database

 MySqlUpdateQueryExecutor (String queryMessage, String[] queryStatements)

 oracleUpdateQueryExecutor (String queryMessage, String[] queryStatements)

 add more based on database operations like DML, DDL, DCL operations

Files And Folders

 getPropValue(String key) -- from config.properties file

 getPropValues (String[] key) -- from config.properties file

 readExcel (String sheetName, String uniqueValue)

 readExcel (String filePath, String sheetName, String uniqueValue)

 readExcelNextRowOfUniqueValue (String sheetName, String uniqueValue)

 readExcelNextRowOfUniqueValue (String filePath, String sheetName, String uniqueValue)

 showCsvTxtFileContent

 getTestDataBaseDirectory

 getScriptsBaseDirectory

 createFolderWithDateTimeStamp

 createCustomFolder

 createFileWithDateTimeStamp

 createCustomFile

 copyFolder

 askUserToSelectFileOnRunTime

 searchFileForString

 searchFileForStringAdvanced

Currency And Dates

 dateInFormat

  dd MMMM yyyy

  dd/MM/yyyy

  MM/dd/yyyy

  dd MMMM yyyy

  yyyy-MM-dd

 yesterday ()

 nextWeekSameDay ()

 tomorrow ()

 datePastYears (int years)

 differenceBetweenDates (String date1,String date2)

 currencyCommaFormat

 numberToDollarsAndCents

 dollarsToNumber

 secIntoElapsedTimeFormat: Convert seconds X into proper time format "%H:%M:%S"

Image and OCR

 readTextFromRectangle

 getTextInRegion

 ImageIsAboveAndLeftOf

 ImageIsAboveAndRightOf

 ImageIsBelow

 ImageIsBelowAndLeftOf

 ImageIsBelowAndRightOf

 ImageIsLeftOf

 ImageCountShouldBe

String Manipulation

 askUserToInputStringOnRunTime

 deleteCharFromString

 splitString

 joinString

 ReplaceCharsInString

 charUsageStats

 wordUsageStats

 quoteString

 normalizedSpacingInData

 stripLeadingAndTrailingSpaceFromString

System Tools

 getSUTPlatformInfo

 listScriptNames

Random Data Generator

 randomUniqueFileName

 randomNumberValue

 randomNumberWithDecimalsValues

 randomSocialSecurityNumber

 randomFirstName

 randomFullNameAsText

Reporting

 Master / Child builds for Ant,TestNG

 SMS and Email Notifications

 Report Parser And Google Doc Updator

Mobile Common Methods

 launch App

 app Signin

 setContentsOfField

 getContentsOfField

 clear Field

 swipe for N times

 swipe until object found

 brute Force Attack

 These custom library is specific for Selenium/Appium. It can be common for any other tool.

(launch App, app Signin, setContentsOfField, getContentsOfField, clear Field, swipe for N times, swipe until object found, brute Force Attack)

Web Common Methods

 screenshot(String methodName)

 setContentsOfField

 getContentsOfField

 waitSeconds (int seconds)

 waitingForTheElementToLoad (WebElement element)

 waitForElementToBeSelected (WebElement element)

 waitForElementToBeClickable (WebElement element)

 ImplicitSleep()

 isElementPresent (WebElement element)

 isElementPresent (WebDriver driver, By by)

 Retrieve Td Value (from HTML Table)

 Retrieve Heading Tr Value (from HTML Table)

 selectDropdown (WebElement element, String value)

 getDropdownItems (WebElement element)

 getSelectedDropdownItem (WebElement element)

 deselectDropDown (WebElement element)

 selectDropdownItemBootStrap (WebElement dropdown, String itemName)

 checkItemNotPresentInDropdownItems (WebElement dropdown, WebElement dropdownList, String itemName)

 setCheckBox (WebElement element, String status)

 setRadioButton (WebElement element, String status)

 toggleCheckBox (WebElement element)

 downloadpopup ()

 logEventInFile

 These custom library is specific for Selenium/Appium. It can be common for any other tool.

(screenshot(String methodName), setContentsOfField, getContentsOfField, waitSeconds (int seconds), waitingForTheElementToLoad (WebElement element), waitForElementToBeSelected (WebElement element), waitForElementToBeClickable (WebElement element), ImplicitSleep(), isElementPresent (WebElement element), isElementPresent (WebDriver driver, By by), Retrieve Td Value (from HTML Table), Retrieve Heading Tr Value (from HTML Table), selectDropdown (WebElement element, String value), getDropdownItems (WebElement element), getSelectedDropdownItem (WebElement element), deselectDropDown (WebElement element), selectDropdownItemBootStrap (WebElement dropdown, String itemName), checkItemNotPresentInDropdownItems (WebElement dropdown, WebElement dropdownList, String itemName) , setCheckBox (WebElement element, String status), setRadioButton (WebElement element, String status), toggleCheckBox (WebElement element), downloadpopup (), logEventInFile)

Mouse And Keyboard Actions

 scrollup (String xValue)

 scrollDown (String yValue)

 scrollToElementViaJavascript (WebElement element)

 scroll To Element Via Coordinate

 Scroll Down Untill Object Found

 Keyboard Shortcuts (dynamic based on OS)

  copy

  paste

  selectAll

  clearField

 myClickImage

Browser Actions

 windowMax ()

 deletecookies ()

 openURL based on DB domain ()

 reloadPage

 quit ()

Select Browser

 firefox

 firefoxIronWasp

 firefoxWithZap

 firefoxUbuntu64

 htmlunitdriver

 ieWinx32

 ieWinx64

 safari

 chromeWinx32

 chromeMac32

 chromeLinux64

Mindmap by: Yagnesh Shah https://yagnesh23.wordpress.com/pandoras-box/