Easy to use TestNG & Allure Report
Requirment:
- Install Allure Report https://docs.qameta.io/allure/
- IDE Eclipse, Intellij, VsCode etc IDE For Java.
- Install Docker https://docs.docker.com/get-docker/
- Selenium Grid On Docker File
docker-compose.yml
Directory
src/test/java/config
> Folder location for all Your Configsrc/test/java/object
> Folder location for all function reuseablesrc/test/java/testcases
> Folder location for all Your Testcasessrc/test/java/utility
> Folder location for all Your Read Excel,csv etc.
How To use
@BeforeMethod
Before your test run, For Setup your preferences Browser Setting@AfterMethod
After your Test run, For Setup Close Browser & Take Screenshoot your test
- Change
String baseUrl = "Your BASE URL"
- Function
defaultUrl
For visit yourbaseUrl
setup - Function
urls
For visit any page your web
- Function
byId
Validate text with selectorID
- Function
byClass
Validate text with selectorCLASSNAME
- Function
byXpath
Validate text with selectorXPATH
- Function
byCss
Validate text with selectorCSS SELECTOR
- Function
byTagName
Validate text with selectorTAG NAME
- Function
byLinkText
Validate text with selectorLINK TEXT
- Function
byName
Validate text with selectorName
package testcases;
import object.Alert;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Alert alert = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Validate Text")
alert.byId("Your Selector", "Your Expected Text Validate");
}
}
- Function
byIdByIndex
Validate text with selectorID
- Function
byClassByIndex
Validate text with selectorCLASSNAME
- Function
byXpathByIndex
Validate text with selectorXPATH
- Function
byCssByIndex
Validate text with selectorCSS SELECTOR
- Function
byTagByIndex
Validate text with selectorTAG NAME
- Function
byLinkTextByIndex
Validate text with selectorLINK TEXT
- Function
byNameByIndex
Validate text with selectorName
package testcases;
import object.Alert;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Alert alert = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Validate Text BY Index")
alert.byIdByIndex("Your Selector", index, "Your Expected Text Validate");
}
}
- Function
byIdDisplay
Validate text with selectorID
- Function
byClassDisplay
Validate text with selectorCLASSNAME
- Function
byXpathDisplay
Validate text with selectorXPATH
- Function
byCssDisplay
Validate text with selectorCSS SELECTOR
- Function
byTagDisplay
Validate text with selectorTAG NAME
- Function
byLinkTextDisplay
Validate text with selectorLINK TEXT
- Function
byNameDisplay
Validate text with selectorName
package testcases;
import object.Alert;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Alert alert = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Validate Element Display")
// true = for element display
// false = for element not display
alert.byIdDisplay("Your Selector", true);
}
}
- Function
byIdGetText
Validate text with selectorID
- Function
byClassGetText
Validate text with selectorCLASSNAME
- Function
byXpathGetText
Validate text with selectorXPATH
- Function
byCssGetText
Validate text with selectorCSS SELECTOR
- Function
byTagGetText
Validate text with selectorTAG NAME
- Function
byLinkGetText
Validate text with selectorLINK TEXT
- Function
byNameGetText
Validate text with selectorName
package testcases;
import object.Alert;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Alert alert = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Get Text");
alert.byIdGetText("Your Selector");
}
}
- Function
byIdGetTextIndex
Validate text with selectorID
- Function
byClassGetTextIndex
Validate text with selectorCLASSNAME
- Function
byXpathGetTextIndex
Validate text with selectorXPATH
- Function
byCssGetTextIndex
Validate text with selectorCSS SELECTOR
- Function
byTagGetTextIndex
Validate text with selectorTAG NAME
- Function
byLinkTextGetTextIndex
Validate text with selectorLINK TEXT
- Function
byNameGetTextIndex
Validate text with selectorName
package testcases;
import object.Alert;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Alert alert = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Get Text By Index");
alert.byIdGetTextIndex("Your Selector", index, "Your Expected Text Validate");
}
}
- Function
byIdReturnText
Validate text with selectorID
- Function
byClassReturnText
Validate text with selectorCLASSNAME
- Function
byXpathReturnText
Validate text with selectorXPATH
- Function
byCssReturnText
Validate text with selectorCSS SELECTOR
- Function
byTagReturnText
Validate text with selectorTAG NAME
- Function
byLinkTextReturnText
Validate text with selectorLINK TEXT
- Function
byNameReturnText
Validate text with selectorName
package testcases;
import object.Alert;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Alert alert = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Return Text");
alert.byIdRetunText("Your Selector");
}
}
- Function
byIdReturnTextIndex
Validate text with selectorID
- Function
byClassReturnTextIndex
Validate text with selectorCLASSNAME
- Function
byXpathReturnTextIndex
Validate text with selectorXPATH
- Function
byCssReturnTextIndex
Validate text with selectorCSS SELECTOR
- Function
byTagReturnTextIndex
Validate text with selectorTAG NAME
- Function
byLinkTextReturnTextIndex
Validate text with selectorLINK TEXT
- Function
byNameReturnTextIndex
Validate text with selectorName
package testcases;
import object.Alert;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Alert alert = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Return Text By Index");
alert.byIdReturnTextIndex("Your Selector", index);
}
}
- Function
byIdContains
Validate text with selectorID
- Function
byClassContains
Validate text with selectorCLASSNAME
- Function
byXpathContains
Validate text with selectorXPATH
- Function
byCssContains
Validate text with selectorCSS SELECTOR
- Function
byTagContains
Validate text with selectorTAG NAME
- Function
byLinkTextContains
Validate text with selectorLINK TEXT
- Function
byNameContains
Validate text with selectorName
package testcases;
import object.Alert;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Alert alert = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Validate Text Contains");
alert.byIdContains("Your Selector", "Your Expected Text Validate");
}
}
- Function
byIdContainsIndex
Validate text with selectorID
- Function
byClassContainsIndex
Validate text with selectorCLASSNAME
- Function
byXpathContainsIndex
Validate text with selectorXPATH
- Function
byCssContainsIndex
Validate text with selectorCSS SELECTOR
- Function
byTagNameContainsIndex
Validate text with selectorTAG NAME
- Function
byLinkTextContainsIndex
Validate text with selectorLINK TEXT
- Function
byNameContainsIndex
Validate text with selectorName
package testcases;
import object.Alert;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Alert alert = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Validate Text Contains BY Index");
alert.byIdContainsIndex("Your Selector", index, "Your Expected Text Validate");
}
}
- Function
urlValidate
For Return Url
package testcases;
import object.Alert;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Alert alert = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Validate Text BY Index");
alert.urlValidate("Expected Your Url");
}
}
- Function
byId
Validate text with selectorID
- Function
byClass
Validate text with selectorCLASSNAME
- Function
byXpath
Validate text with selectorXPATH
- Function
byCss
Validate text with selectorCSS SELECTOR
- Function
byTag
Validate text with selectorTAG NAME
- Function
byLinkText
Validate text with selectorLINK TEXT
- Function
byName
Validate text with selectorName
package testcases;
import object.Button;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Button button = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Click Button");
button.byId("Your Selector");
}
}
- Function
byIdByIndex
Validate text with selectorID
- Function
byClassByIndex
Validate text with selectorCLASSNAME
- Function
byXpathByIndex
Validate text with selectorXPATH
- Function
byCssByIndex
Validate text with selectorCSS SELECTOR
- Function
byTagByIndex
Validate text with selectorTAG NAME
- Function
byLinkTextByIndex
Validate text with selectorLINK TEXT
- Function
byNameByIndex
Validate text with selectorName
package testcases;
import object.Button;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Button button = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Click Button By Index");
button.byIdByIndex("Your Selector", index);
}
}
- Function
byIdEnabled
Validate text with selectorID
- Function
byClassEnabled
Validate text with selectorCLASSNAME
- Function
byXpathEnabled
Validate text with selectorXPATH
- Function
byCssEnabled
Validate text with selectorCSS SELECTOR
- Function
byTagEnabled
Validate text with selectorTAG NAME
- Function
byLinkTextEnabled
Validate text with selectorLINK TEXT
- Function
byNameEnabled
Validate text with selectorName
package testcases;
import object.Button;
import config.Setup;
import config.Url;
public class objectAlert extends Setup {
public void testName() {
Button button = PageFactory.initElements(driver, Alert.class);
Url url = new Url(driver);
url.urls("/Your Page Need Click Button By Index");
button.byIdEnabled("Your Selector", true or false);
}
}