โ๏ธ : Vignesh Dhakshnamoorthy ( Senior Software Quality Analyst )
๐ง : KMD.Vignesh@outlook.com / VigneshDhakshnamoorthy@gmail.com
// download KMDVFramework.jar from above link and save in Project folder
// add that as a dependency
<dependency>
<groupId>org.KMDV</groupId>
<artifactId>KMDV-Java-Framework</artifactId>
<version>1.0.6</version>
<scope>system</scope>
<systemPath>${project.basedir}/KMDVFramework.jar</systemPath>
</dependency>
GroupId | ArtifactId | Version |
org.testng | testng | 7.5 |
org.seleniumhq.selenium | selenium-java | 4.1.1 |
io.github.bonigarcia | webdrivermanager | 5.1.1 |
org.apache.poi | poi | 5.2.2 |
org.apache.poi | poi-ooxml | 5.2.2 |
com.aventstack | extentreports | 5.0.9 |
org.projectlombok | lombok | 1.18.24 |
com.googlecode.json-simple | json-simple | 1.1.1 |
javax.mail | 1.4.5 | |
io.rest-assured | rest-assured | 5.0.1 |
com.aventstack | extentreports-testng-adapter | 1.2.2 |
org.bytedeco | javacv-platform | 1.5.3 |
API : TestCase
public class demo extends TestBase {
@Author(Name = "Dhakshna")
@Test
public void demoAPI() {
String baseURI ="https://reqres.in/";
RestAPIUtil restAPI= RestAPI(baseURI);
restAPI.Log( restAPI.getStatusCode() );
}
}
API : Helper Methods
restAPI.getStatusCode
restAPI.getBody
restAPI.getMethodName
restAPI.Log
restAPI.logC
restAPI.logE
restAPI.IntToString
restAPI.StringToInt
restAPI.StringEquals
restAPI.Today
restAPI.Yesterday
restAPI.Tomorrow
restAPI.localDate
restAPI.toCharArray
restAPI.getRandom
BrowserName = chrome
waitTime = 15
BrowserStack = off
Local Browsers |
chrome firefox edge opera firefoxheadless chromeheadless |
---|
USERNAME =
ACCESS_KEY =
os = Windows
os_version = 10
browser = Chrome
browser_version = latest
Username_id = user-name
to get the value : Locators.get("Username_id")
WEB : PageObject
public class LoginPage extends PageBase {
private final By password = By.xpath("*//[@id='password']");
@FindBy(id="login-button") private WebElement loginbutton;
public LoginPage Login() {
selenium.type(Locators.get("Username_id"), "standard_user");
selenium.type(password, "secret_sauce");
selenium.click(loginbutton);
return this;
}
WEB : TestCase
public class demo extends TestBase {
@Author(Name = "Vignesh")
@Test
public void demoWEB() {
String webURL ="https://www.saucedemo.com/";
SeleniumUtil selenium = Selenium(webURL);
new LoginPage().Login();
selenium.Log("Logged in successfully");
}
}
WEB : Helper Methods
selenium.Log()
selenium.logConsole()
selenium.logExtent()
selenium.logList()
selenium.logCList()
selenium.logEList()
selenium.findBy_ClassName()
selenium.findBy_CssSelector()
selenium.findBy_ID()
selenium.findBy_LinkText()
selenium.findBy_Name()
selenium.findBy_PartialLinkText()
selenium.findBy_Xpath()
selenium.findAll_ClassName()
selenium.findAll_CssSelector()
selenium.findAll_ID()
selenium.findAll_LinkText()
selenium.findAll_Name()
selenium.findAll_PartialLinkText()
selenium.findAll_Xpath()
selenium.getShadowRoot()
selenium.getShadowContent()
selenium.getElement()
selenium.getElements()
selenium.getList()
selenium.getBY()
selenium.refreshElement()
selenium.getLocatorString()
selenium.getAttribute()
selenium.setAttribute()
selenium.click()
selenium.type()
selenium.typeENTER()
selenium.typeTAB()
selenium.back()
selenium.clear()
selenium.clickList()
selenium.clickSleep()
selenium.forward()
selenium.getCurrentUrl()
selenium.getDriver()
selenium.getLocation()
selenium.getMethodName()
selenium.getPageSource()
selenium.getText()
selenium.getTitle()
selenium.isDisplayed()
selenium.isEnabled()
selenium.isSelected()
selenium.maximize()
selenium.minimize()
selenium.navigateTo()
selenium.refresh()
selenium.screenHeight()
selenium.screenWidth()
selenium.windowDimension()
selenium.getDropDownSelectValue()
selenium.selectDropDown()
selenium.sleep()
selenium.sleepMilliSeconds()
selenium.waitDisplayed()
selenium.waitEnabled()
selenium.waitPageLoad()
selenium.waitSelected()
selenium.elementScreenShot()
selenium.pageScreenShot()
selenium.defaultFrame()
selenium.parentFrame()
selenium.switchFrame()
selenium.getTabs()
selenium.switchTab()
selenium.countTabs()
selenium.currentTab()
selenium.acceptAlert()
selenium.dismissAlert()
selenium.getAlert()
selenium.textAlert()
selenium.typeAlert()
selenium.jsClick()
selenium.jsType()
selenium.scrollTO_XY()
selenium.scrollBY_XY()
selenium.scrollIntoView()
selenium.executeScript()
selenium.actionClick()
selenium.actionDOWN()
selenium.actionENTER()
selenium.actionESCAPE()
selenium.actionLEFT()
selenium.actionRETURN()
selenium.actionRIGHT()
selenium.actionTAB()
selenium.actionType()
selenium.actionUP()
selenium.contextClick()
selenium.doubleClick()
selenium.dragAndDrop()
selenium.mouseLeftClick()
selenium.mouseMove()
selenium.mouseRightClick()
selenium.moveTo()
selenium.robotBACKSPACE()
selenium.robotCOPY()
selenium.robotCUT()
selenium.robotDOWN()
selenium.robotENTER()
selenium.robotESCAPE()
selenium.robotLEFT()
selenium.robotPASTE()
selenium.robotRIGHT()
selenium.robotSELECT()
selenium.robotTAB()
selenium.robotUP()
selenium.countList()
selenium.compare()
selenium.IntToString()
selenium.getRandom()
selenium.localDate()
selenium.listContains()
selenium.StringEquals()
selenium.StringToInt()
selenium.toCharArray()
selenium.Today()
selenium.Tomorrow()
selenium.Yesterday()
selenium.waitUNtil().alertIsPresent()
selenium.waitUNtil().attributeContains()
selenium.waitUNtil().attributeToBe()
selenium.waitUNtil().attributeToBeNotEmpty()
selenium.waitUNtil().elementSelectionStateToBe()
selenium.waitUNtil().elementToBeClickable()
selenium.waitUNtil().elementToBeSelected()
selenium.waitUNtil().frameToBeAvailableAndSwitchToIt()
selenium.waitUNtil().invisibilityOf()
selenium.waitUNtil().invisibilityOfAllElements()
selenium.waitUNtil().invisibilityOfElementLocated()
selenium.waitUNtil().invisibilityOfElementWithText()
selenium.waitUNtil().javaScriptThrowsNoExceptions()
selenium.waitUNtil().jsReturnsValue()
selenium.waitUNtil().numberOfElementsToBe()
selenium.waitUNtil().numberOfElementsToBeLessThan()
selenium.waitUNtil().numberOfElementsToBeMoreThan()
selenium.waitUNtil().numberOfWindowsToBe()
selenium.waitUNtil().presenceOfAllElementsLocatedBy()
selenium.waitUNtil().presenceOfElementLocated()
selenium.waitUNtil().presenceOfNestedElementLocatedBy()
selenium.waitUNtil().presenceOfNestedElementsLocatedBy()
selenium.waitUNtil().stalenessOf()
selenium.waitUNtil().textToBe()
selenium.waitUNtil().textToBePresentInElementLocated()
selenium.waitUNtil().textToBePresentInElement()
selenium.waitUNtil().textToBePresentInElementValue()
selenium.waitUNtil().titleContains()
selenium.waitUNtil().titleIs()
selenium.waitUNtil().urlContains()
selenium.waitUNtil().urlToBe()
selenium.waitUNtil().visibilityOf()
selenium.waitUNtil().visibilityOfAllElements()
selenium.waitUNtil().visibilityOfElementLocated()
selenium.waitUNtil().visibilityOfAllElementsLocatedBy()
selenium.waitUNtil().visibilityOfNestedElementsLocatedBy()
SuitesXML can store testRunner XML files |
src / test / resources / Properties First Time Auto Generate : browser.properties, browserStack.properties, locators.properties |
src / test / resources / TestData Excel JSON Others Text can store xlsx, json, txt, etc... Report-Screenshot / ExtentReport Each Time Auto Generate : Extent.Html Report-Screenshot / Screenshots Failed Passed Skipped Passed - Manual , Failed - Auto , Skipped - Auto |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="KMDV Automation" parallel="methods" thread-count="5">
<test name="KMDV Test">
<classes>
<class name="testCase.demo"></class>
</classes>
</test>
</suite>
Helper Class : ExcelUtil
String path = Path.fileFromExcelTestData("sample.xlsx");
ExcelUtil excelUtil = new ExcelUtil (path) ;
excelUtil.getCellDataByValue
excelUtil.getFullExcelData
excelUtil.getRowColNumbers
excelUtil.getRowNumber
excelUtil.getColumnNumber
excelUtil.getRowCount
excelUtil.getCellCount
excelUtil.getCellDataByNum
excelUtil.setCellData
excelUtil.fillGreenColor
excelUtil.fillRedColor
Helper Class : JsonUtil
String path = Path.fileFromJsonTestData("sample.json");
JsonUtil jsonUtil = new JsonUtil (path) ;
jsonUtil.getPojo
jsonUtil.getObject
jsonUtil.getValue
jsonUtil.getKeys
jsonUtil.getArray
jsonUtil.getObjFromArray
Helper Class : PropertiesUtil
String path = Path.fileFromProperties("sample.properties");
PropertiesUtil propertiesUtil = new PropertiesUtil (path) ;
propertiesUtil.getValue
propertiesUtil.getKeys
propertiesUtil.getMAP
Helper Class : TextUtil
String path = Path.fileFromTextTestData("sample.txt");
TextUtil textUtil = new TextUtil (path) ;
textUtil.readLines
textUtil.writeLine