Part 4 Using Page Objects with Behavior Driven Development in an Agile Environment Demonstration

Part 4: Mock Two Week Sprint Day 5, Day 6 and Day 7

Day 5 of the Sprint

Daily Scrum
Automation Tasks Day 5 – The automation team members would continue creating test cases to verify the Acceptance Criteria has been meet and creating needed test data and test suite(s). The team members would also continue updating the Page Objects as code is delivered, and refactoring as needed. At this point the Sprint team could also start any Exploratory testing required. As new code is created, it should be checked into the CMS.

Acceptance Criteria Two Test:
/*----------------------------------------------------------------------
 * Filename: RememberMeTest.java
 *
 *
 */

package com.cos.selenium.admin.test;

import static org.testng.AssertJUnit.assertTrue;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.testng.annotations.Test;
import com.fl.flpi.selenium.admin.pages.LoginPage;
import com.fl.flpi.selenium.admin.pages.WelcomePage;
import com.fl.flpi.selenium.admin.common.CommonPage;

import com.fl.flpi.selenium.common.BaseCosTest;

public class RemeberMeTest extends BaseCosTest {

    private LoginPage loginPage  = new loginPage ();
    private WelcomePage welcomePage = new WelcomePage();
    private CommonPage commonPage = new CommonPage();

    @Test
    public void RememberMeCheckedTests() throws FindFailed {

        String testId = "Remember Me Test";

        entered(testId);

        String userName = testData.getString("LOGIN_ONE_USERNAME");
        String pass = testData.getString(“LOGIN_ONE_PASSWORD”);

        loginPage.setValueInUsernameField(userName);
        loginPage.setValueInPasswordField(pass);
        loginPage. clickRememberMeCheckbox();
        loginPage.clickLoginBtn();
        assertTrue(driver.getTitle().contains("Welcome to Widgets of America"));
        welcomePage.clickLogout();
        commonPage.getLoginUrl();
        assertTrue(driver.findElement(By.id("rememberMeCheckbox")).isSelected());
        loginPage.clickLoginBtn();
        assertTrue(driver.getTitle().contains("Welcome to Widgets of America"));


        leaving(testId);

    }



}

Day 6 of the Sprint

Daily Scrum
Automation Tasks Day 6 – The automation team members would continue creating test cases to verify the Acceptance Criteria has been meet and creating needed test data and test suite(s). The team members would also continue updating the Page Objects as code is delivered, and refactoring as needed. Any needed exploratory testing would continue. As new code is created, it should be checked into the CMS.

Acceptance Criteria Three Test:
/*----------------------------------------------------------------------
 * Filename: RememberMeTestTwo.java
 *
 *
 */

package com.cos.selenium.admin.test;

import static org.testng.AssertJUnit.assertTrue;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.testng.annotations.Test;
import com.fl.flpi.selenium.admin.pages.LoginPage;
import com.fl.flpi.selenium.admin.pages.WelcomePage;
import com.fl.flpi.selenium.admin.common.CommonPage;
import com.fl.flpi.selenium.common.BaseCosTest;

public class RemeberMeTestTwo extends BaseCosTest {

    private LoginPage loginPage  = new loginPage ();
    private WelcomePage welcomePage = new WelcomePage();
    private CommonPage commonPage = new CommonPage();

    @Test
    public void Remember Me Not Checked Test() throws FindFailed {

        String testId = "Remember Me Not Checked Test";

        entered(testId);

        String userName = testData.getString("LOGIN_ONE_USERNAME");
        String pass = testData.getString(“LOGIN_ONE_PASSWORD”);

        loginPage.setValueInUsernameField(userName);
        loginPage.setValueInPasswordField(pass);
        commonPage.ensureRememberMeNotChecked();
        loginPage.clickLoginBtn();
        assertTrue(driver.getTitle().contains("Welcome to Widgets of America"));
        welcomePage.clickLogout();
        commonPage.getLoginUrl();
        assertFalse(driver.findElement(By.id("rememberMeCheckbox")).isSelected());
        


        leaving(testId);

    }



}

Day 7 of the Sprint

Daily Scrum
Requirements Workshop – The objective of the requirements workshop is to discuss any new requirements or changes to existing requirements that have emerged since the previous session.

Automation Tasks Day 7 – The automation team members would continue creating test cases to verify the Acceptance Criteria has been meet and creating needed test data and test suite(s). The team members would also continue updating the Page Objects as code is delivered, and refactoring as needed. Any needed exploratory testing would continue. As new code is created, it should be checked into the CMS.

Acceptance Criteria Four Test:
/*----------------------------------------------------------------------
 * Filename: BadUsernameTest.java
 *
 *
 */

package com.cos.selenium.admin.test;

import static org.testng.AssertJUnit.assertTrue;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.testng.annotations.Test;
import com.fl.flpi.selenium.admin.pages.LoginPage;
import com.fl.flpi.selenium.common.BaseCosTest;

public class BadUserNameTest extends BaseCosTest {

    private LoginPage loginPage  = new loginPage ();

    @Test
    public void BadUsernameMessageTest() throws FindFailed {

        String testId = "Bad UserName Message Test";

        entered(testId);

        String userName = testData.getString("LOGIN_BAD_USERNAME");
        String pass = testData.getString(“LOGIN_ONE_PASSWORD”);

        loginPage.setValueInUsernameField(userName);
        loginPage.setValueInPasswordField(pass);
        loginPage.clickLoginBtn();
        assertTrue(driver.switchTo().alert().getText().contains("Unrecognized user     
name, please try again"));
        

        leaving(testId);

    }

}
Acceptance Criteria Five Test:
/*----------------------------------------------------------------------
 * Filename: BadPasswordTest.java
 *
 *
 */

package com.cos.selenium.admin.test;

import static org.testng.AssertJUnit.assertTrue;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.testng.annotations.Test;
import com.fl.flpi.selenium.admin.pages.LoginPage;
import com.fl.flpi.selenium.common.BaseCosTest;

public class BadPasswordTest extends BaseCosTest {

    private LoginPage loginPage  = new loginPage ();

    @Test
    public void BadPasswordMessageTest() throws FindFailed {

        String testId = "Bad Password Message Test";

        entered(testId);

        String userName = testData.getString("LOGIN_ONE_USERNAME");
        String pass = testData.getString(“LOGIN_BAD_PASSWORD”);

        loginPage.setValueInUsernameField(userName);
        loginPage.setValueInPasswordField(pass);
        loginPage.clickLoginBtn();
        assertTrue(driver.switchTo().alert().getText().contains("Incorrect password, please try again "));
        

        leaving(testId);

    }

}
Posted in automation, Uncategorized

Download and extend ATF...

ATF Is Now Open Source

Join this 10 week program anytime...

DevOps Mastery Program

Get your DevOps health check now...

Free DevOps Assessment

X