Skip to content

This is a sample project to demonstrate high readable test automation implementation with Selenium + Page Factory and Fluent Interface Design Patterns + TestNG + Java.

Notifications You must be signed in to change notification settings

osandadeshan/selenium-testng-page-factory-extended

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Selenium TestNG Page Factory Extended

This is a sample project to demonstrate high readable test automation implementation with Selenium + Page Factory and Fluent Interface Design Patterns + TestNG + Java.

Old approach using page object/page factory design pattern

  • Object usages are high
  • Test readability and clarity is less
@Category(SIGN_IN)
@Test(description = "Verify that a valid user can login to the application")
public void testValidUserLogin(){
    loginpage.setEmail("[email protected]");
    loginpage.setPassword("1qaz2wsx@");
    loginpage.clickOnSignInButton();
    Assert.assertEquals(commonPage.getBrowserTabTitle(), "My account - My Store");
    Assert.assertEquals(homepage.getLoggedInUsername(), "Osanda Nimalarathna");
}

Extended approach using page object/page factory and fluent interface design patterns

  • Object usages are less
  • Test readability and clarity is high
@Category(SIGN_IN)
@Test(description = "Verify that a valid user can login to the application")
public void testValidUserLogin(){
    fragments().getLoginFragment()
        .login(USER_EMAIL, USER_PASSWORD)
        .checkHomePageTitle()
        .getNavigationBlock()
        .checkLoggedInUsername(FULL_USER_NAME);
}

About

This is a sample project to demonstrate high readable test automation implementation with Selenium + Page Factory and Fluent Interface Design Patterns + TestNG + Java.

Topics

Resources

Stars

Watchers

Forks

Languages