SlideShare a Scribd company logo
1CONFIDENTIAL
Out of box Page Object
Design Pattern, Java
Anton Semenchenko
2CONFIDENTIAL
1. Page Object – just to β€œrefresh”
2. State-less or state-full solution - just to β€œrefresh”
3. How to select a proper PO implementation?
Agenda, part 1 (to refresh)
3CONFIDENTIAL
1. Hypothetical project context
2. Compare complexity
3. Compare β€œtech” limitations
4. Compare β€œbusiness” limitations
5. Rationale β€œbusiness” limitations
6. How to find and β€œupdate” a balance for your own project?
Agenda, part 2 (to refresh)
4CONFIDENTIAL
1. β€œraw” Selenium Page Objects
2. Page Factory from Selenium library
3. HMTL Element framework from Yandex
4. Selenide
5. JDI framework from EPAM
6. SWD Page Recorder
Agenda, part 3 (solutions)
5CONFIDENTIAL
1. A real-life example
2. β€œHomework”
3. β€œRules” and principles
4. A set of useful links
5. What’s next?
6. Questions
Agenda, part 4 (take away points)
6CONFIDENTIAL
1. Page Objects – encapsulates the way of identification and logical grouping of widgets.
2. Page Object == Logical Page
3. Page Object != Physical Page
Page Object – just to β€œrefresh”
7CONFIDENTIAL
Page Object – β€œexample” 
8CONFIDENTIAL
Page Object – β€œexample” 
9CONFIDENTIAL
1. Let’s compare:
– Photo
β€’ Share – looks like parallelism (easy parallelism).
– Video
β€’ Share – looks like parallelism (not trivial parallelism).
State-less or state-full solution?
10CONFIDENTIAL
1. How easy transform solution from β€œsingle” to β€œmulti” threading (to decrease β€œQA
Automation Windows”)
– State-less – like share a photo
β€’ Just 5 minutes of work.
– State-full – like share a video
β€’ Not trivial task, could be a night mare.
2. Summary
– prefer state-less solutions to state-full solutions in mooooost cases;
– before start implementation a state-full solution, please, take a break for a minute, and re-
thing everything again, possibly you can find a proper state-less solution.
State-less or state-full solution?
11CONFIDENTIAL
1. Static class
– could be implemented as a state-less solution easily
2. Object
– State-full solution in 99,99% cases
3. Summary
– prefer static class based solutions (state-less) to object based (state-full) in mooooost cases;
– before start implementation based on objects, please, take a break for a minute, and re-thing
everything again, possibly you can find a proper solution based on static classes.
Object or static class  State-full or state-less solution?
12CONFIDENTIAL
1. Too complicated business logic due to Domain
2. Too complicated business logic due to System size (thousands test-cases)
3. Too many β€œcontexts”
– Browser versions
– Environments
– Customers with a tiny nuances of functionality
– Platforms (cross-browser Web plus cross-platform Mobile)
– Combination 
4. Combination 
Page Objects – state-full, general case
13CONFIDENTIAL
1. Web UI that behaves like a Wizard
2. Web UI in combination with Mobile in one use case
3. Internet of Things (in most cases)
4. More then 1 page during 1 test (for example several portals or several instances of one
portal to implement one β€œbusiness use case”):
– Really seldom;
– Looks like integration tests (in most cases):
β€’ Std solution- some type of White Box Testing.
5. Many others β€œspecial cases”
Page Objects – state-full, special cases
14CONFIDENTIAL
How to select a proper PO implementation?
15CONFIDENTIAL
1. 30 Physical Pages
2. Standard Header, footer and search functionality for all physical pages
3. Each Physical Page consists of
– Header – H
– Footer – F
– Search – S
– Some functionality, specific for the Page – U (unique)
Hypothetical project context – to compare
16CONFIDENTIAL
1. 33 Static Page Objects = Logical Pages
2. 0 explicit and 30 implicit Physical Pages
3. Just share 33 Static Page Objects between 30 implicit Physical Pages
– For example, Header Static Page Object (static class) is used in test cases for all 30 Physical
Page Objects
4. Complexity – just 33 static state-less entities (plus limitations due to state-less solutions)
Compare complexity – Static Page Object based
17CONFIDENTIAL
1. 33 Dynamic Page Objects = Logical Pages
2. It depends on implementation (one of the ways):
– 0 explicit and 30 implicit Physical Pages
– implicit Physical Page implements on Action layer (limitations example)
– Action for Physical Page aggregates all necessary Dynamic Logical Pages
β€’ Physical Pages are implemented in a next way: create all necessary instances of logical pages, aggregate in
some way, use Action layer as an point of aggregation in most cases, free resources
Compare complexity – Dynamic Page Object based (option 1)
18CONFIDENTIAL
1. 120 objects (min), each with some state, dynamically created and frees to implement
necessary behavior - to implement 30 implicit Physical Pages
2. Complexity – 120 dynamic, state-full entities min (plus some limitations due to state-full
solution implementation nuances)
Compare complexity – Dynamic Page Object based (option 1)
19CONFIDENTIAL
1. 33 Dynamic Page Objects = Logical Pages
2. It depends on implementation (another way):
– 30 explicit Physical Pages
– Multiple Interface inheritance
– Combine Page Objects and Actions layer (in most cases)
– Action-Physical Page (limitations example)
β€’ Implements all Logical Pages interfaces using aggregation and β€œdelegation”
β€’ Aggregate all Dynamic Logical Page Objects
β€’ Create and frees resources (Dynamic Logical Page Objects)
Compare complexity – Dynamic Page Object based (option 2)
20CONFIDENTIAL
1. 150 objects, each with some state, dynamically created and frees to implement necessary
behavior - to implement 30 explicit Physical Pages
2. Complexity – 150 dynamic, state-full not trivial entities with a multiple interface
inheritance (plus some limitations due to state-full solution implementation nuances)
Compare complexity – Dynamic Page Object based (option 2)
21CONFIDENTIAL
1. Can be used together with next Design Patterns  Approaches
– Action (both static – preferable and dynamic)
– Key-word driven
– DSL – external only
– BDD – partially, it depends on exact BDD engine implementation limitations
2. Can’t be used together with next Design Patterns
– Factory
– Flow (Fluent Interface)
– Navigator (for Web)
Compare β€œtech” limitations - Static Page Object based
22CONFIDENTIAL
1. No limitations, but …
– For example, in most cases it’s hard to isolate Action and Page Objects layers
Compare β€œtech” limitations - Dynamic Page Object based
23CONFIDENTIAL
1. Too complicated business logic due to Domain
2. Too complicated business logic due to System size (thousands test-cases)
3. Too many β€œcontexts”
– Browser versions
– Environments
– Customers with a tiny nuances of functionality
– Platforms (cross-browser Web plus cross-platform Mobile)
– Combination 
4. Combination 
Compare β€œbusiness” limitations - Static
24CONFIDENTIAL
1. State-less approach - you have a conditional that chooses different behavior depending on
…
2. Solution to simplify the project – refactoring β€œReplace Conditional with Polymorphism”
3. Polymorphism = object = State-full approach
Rationale β€œbusiness” limitations - Static
25CONFIDENTIAL
1. β€œFrom refactoring to Patterns”
– There is a set of specific Design Patterns
2. The trickiest part – find a balance for your project now and update point of balance in time
Rationale β€œbusiness” limitations - Static
26CONFIDENTIAL
1. Relatively simple business logic due to Domain
2. Relatively simple business logic due to System size (hundreds test-cases)
3. Not so many β€œcontexts”
– Browser versions
– Environments
– Customers with a tiny nuances of functionality
– Platforms (cross-browser Web plus cross-platform Mobile)
Compare β€œbusiness” limitations - Dynamic
27CONFIDENTIAL
1. State-full approach - you have a set of objects  classes, which developed, possibly, using
several Design Patterns to implement necessary functionality – to choose different behavior
depending on …
2. Solution to simplify the project – refactoring β€œReplace Polymorphism with Conditional”
3. Polymorphism ~= object ~= State-full approach
4. No Polymorphism ~= no objects ~= State-less approach
Rationale β€œbusiness” limitations - Dynamic
28CONFIDENTIAL
1. β€œFrom Patterns to refactoring”
– There is no need to use a set of specific Design Patterns
2. The trickiest part – find a balance for your project now and update point of balance in time
Rationale β€œbusiness” limitations - Dynamic
29CONFIDENTIAL
Find and β€œupdate” a balance for your own project
30CONFIDENTIAL
Page Factory from Selenium library
31CONFIDENTIAL
Page Factory - definition
1. Page Factory is an inbuilt page object model concept for Selenium WebDriver but it is very
optimized.
2. We use initElements method to initialize web elements
3. Additionally with the help of PageFactory class - use annotations @FindBy to find WebElement.
4. @FindBy can accept as attributes:
1. tagName
2. name
3. partialLinkText
4. linkText
5. Id
6. Css
7. className
8. Xpath
32CONFIDENTIAL
Page Factory - notes
1. If you use the PageFactory, you can assume that the fields are initialized. If you don't use the
PageFactory, then NullPointerExceptions will be thrown if you make the assumption that the fields
are already initialized.
2. List<WebElement> fields are decorated if and only if they have @FindBy or @FindBys annotation.
Default search strategy "by id or name" that works for WebElement fields is hardly suitable for
lists because it is rare to have several elements with the same id or name on a page.
33CONFIDENTIAL
Page Factory - notes
1. WebElements are evaluated lazily. That is, if you never use a WebElement field in a PageObject,
there will never be a call to "findElement" for it.
2. The functionality works using dynamic proxies. This means that you shouldn't expect a
WebElement to be a particular subclass, even if you know the type of the driver. For example, if
you are using the HtmlUnitDriver, you shouldn't expect the WebElement field to be initialized with
an instance of HtmlUnitWebElement.
34CONFIDENTIAL
Login Page
1.public class LoginPage {
2. private WebDriver driver;
3. @FindBy(id = "id_username")
4. private WebElement usernameInput;
5. @FindBy(id = "id_password")
6. private WebElement passwordInput;
7. @FindBy(id = "main_action_form_button")
8. private WebElement loginButton;
9.}
35CONFIDENTIAL
Login Page
1. public class LoginPage {
2. public LoginPage(WebDriver driver) {
3. this.driver = driver;
4. PageFactory.initElements(driver, this);
5. }
6. public void login(String username, String password) {
7. usernameInput.sendKeys(username);
8. passwordInput.sendKeys(password);
9. loginButton.click();
10. }
11.}
36CONFIDENTIAL
Home Page
1. public class HomePage {
2. private WebDriver driver;
3. @FindBy(css = "a[href*="login"]")
4. private WebElement loginButton;
5. public HomePage(WebDriver driver) {
6. this.driver = driver;
7. PageFactory.initElements(driver, this);
8. }
9. }
37CONFIDENTIAL
Home Page
1. public class HomePage {
2. public void login() {
3. login(Creds.username, Creds.password);}
4. private LoginPage clickLoginButton() {
5. loginButton.click();
6. return new LoginPage(driver);}
7. private void login(String username, String password) {
8. LoginPage loginPage = clickLoginButton();
9. loginPage.login(username, password);
38CONFIDENTIAL
Login test
1. public class LoginTest {
2. private WebDriver driver;
3. @BeforeMethod
4. public void setup() {
5. driver = new FirefoxDriver();
6. driver.manage().window().maximize();
7. driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
8. driver.get("https://www.pandadoc.com/");}
9. @AfterMethod
10. public void teardown() {
11. driver.close();}}
39CONFIDENTIAL
Login test
1. public class LoginTest {
2. private void assertSignedUp() {
3. new WebDriverWait(driver,
30000).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("
.header-avatar")));}
4. @Test
5. public void loginTest() {
6. HomePage homePage = new HomePage(driver);
7. homePage.login();
8. assertSignedUp();}}
40CONFIDENTIAL
Implementation is based on
β€’ Reflection
β€’ Annotation
β€’ Templates
41CONFIDENTIAL
Page Factory from Selenium library - info
1. Page Object Model and Page Factory
2. Page Factory detailed desription
3. Page Object (Page Factory context)
4. AjaxElementLocatorFactory (obsolete)
5. Source code example
6. PageFactory.java (source code)
7. Book with a brief summary of Selenium WebDriver plus Java bindings (Ru only)
42CONFIDENTIAL
HMTL Elements framework from Yandex
1. Designed to provide easy-to-use way of interaction with web-page elements in your tests.
2. It may be considered as an extension of WebDriver Page Object (PageFactory).
3. With the help of Html Elements framework you can group web-page elements into blocks (Logical
Pages), encapsulate logic of interaction with them and then easily use created blocks in page
objects (Physical Pages).
43CONFIDENTIAL
HMTL Element framework from Yandex
1. Dividing page on blocks using @Block annotation
2. Separating different types of elements (button, checkbox)
3. Provides an ability to annotate methods as steps – annotation @Step for work in step-based style
4. Provides a set of helpful matchers to use with web-page elements and blocks
44CONFIDENTIAL
Login Page
1. public class LoginPage {
2. private WebDriver driver;
3. @FindBy(id = "id_username")
4. private static TextInput usernameInput;
5. @FindBy(id = "id_password")
6. private static TextInput passwordInput;
7. @FindBy(id = "main_action_form_button")
8. private static Button loginButton;
9. }
45CONFIDENTIAL
Login Page
1. public class LoginPage {
2. public LoginPage(WebDriver driver) {
3. this.driver = driver;
4. HtmlElementLoader.populatePageObject(this, driver);
5. }
6. public void login(String username, String password) {
7. usernameInput.sendKeys(username);
8. passwordInput.sendKeys(password);
9. loginButton.click();
10. }
11.}
46CONFIDENTIAL
Home Page
1. public class HomePage {
2. private WebDriver driver;
3. @FindBy(css = "a[href*="login"]")
4. private static Button loginButton;
5. public HomePage(WebDriver driver) {
6. this.driver = driver;
7. HtmlElementLoader.populatePageObject(this, driver);
8. }
9. }
47CONFIDENTIAL
Home Page
1. public class HomePage {
2. public void login() {
3. login(Creds.username, Creds.password); }
4. private LoginPage clickLoginButton() {
5. loginButton.click();
6. return new LoginPage(driver); }
7. private void login(String username, String password) {
8. LoginPage loginPage = clickLoginButton();
9. loginPage.login(username, password);}}
48CONFIDENTIAL
Login test
1. public class LoginTest {
2. private WebDriver driver;
3. @BeforeMethod
4. public void setup() {
5. driver = new FirefoxDriver();
6. driver.manage().window().maximize();
7. driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
8. driver.get("https://www.pandadoc.com/"); }
9. @AfterMethod
10. public void teardown() {
11. driver.close(); }}
49CONFIDENTIAL
Login test
1. public class LoginTest {
2. private WebDriver driver;
3. private void assertSignedUp() {
4. new WebDriverWait(driver,
30000).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("
.header-avatar"))); }
5. @Test
6. public void loginTest() {
7. HomePage homePage = new HomePage(driver);
8. homePage.login();
9. assertSignedUp(); }}
50CONFIDENTIAL
Implementation is based on
β€’ Reflection
β€’ Annotation
β€’ Templates
51CONFIDENTIAL
HMTL Elements framework from Yandex - info
1. Official site of the tool
2. Examples
3. Source code example
4. Book with a brief summary of Selenium WebDriver plus Java bindings (Ru only)
52CONFIDENTIAL
Selenide
Selenide is a wrapper for Selenium Webdriver, oriented, as Geb, on fast and laconic automation but
using Java. Just focus on your business logic and let Selenide do the rest! Main advantages of that
tool:
1. Concise fluent API for tests
2. True Page Objects
53CONFIDENTIAL
Selenide
1. Webdriver access
2. jQuery style selectors
3. Ajax support for stable tests
4. Auto-start and browser destructions
5. You don't need to think how to shutdown browser, handle timeouts and StaleElement Exceptions
or search for relevant log lines, debugging your tests.
54CONFIDENTIAL
Login Page
1. public class LoginPage {
2. private static final By USERNAME_INPUT = By.id("id_username");
3. private static final By PASSWORD_INPUT = By.id("id_password");
4. private static final By LOGIN_BUTTON =
By.id("main_action_form_button");
5. public void login(String username, String password) {
6. $(USERNAME_INPUT).val(username);
7. $(PASSWORD_INPUT).val(password);
8. $(LOGIN_BUTTON).click();
9. }}
55CONFIDENTIAL
Login Page
Source code – where …?
56CONFIDENTIAL
Home Page
1. public class HomePage {
2. private static final By LOGIN_BUTTON =
By.cssSelector("a[href*="login"]");
3. public void login() {
4. login(Creds.username, Creds.password); }
5. private LoginPage clickLoginButton() {
6. $(LOGIN_BUTTON).click();
7. return page(LoginPage.class);}
8. private void login(String username, String password) {
9. LoginPage loginPage = clickLoginButton();
10. loginPage.login(username, password); }}
57CONFIDENTIAL
Home Page
Source code – where …?
58CONFIDENTIAL
Login test
public class LoginTest {
private HomePage homePage;
private void assertSignedUp() {
$(By.cssSelector(".header-avatar")).waitUntil(Condition.visible, 30000); }
@BeforeMethod
public void setup() {
Configuration.timeout = 10000;
homePage = open("https://www.pandadoc.com/", HomePage.class); }
@Test
public void loginTest() {
homePage.login();
assertSignedUp(); } }
59CONFIDENTIAL
Login test
Source code – where …?
60CONFIDENTIAL
Implementation is based on
β€’ Reflection
β€’ Annotation
β€’ Templates
61CONFIDENTIAL
Selenide - info
1. Official site of the tool
2. Examples
3. Source code example
4. Book with a brief summary of Selenium WebDriver plus Java bindings (Ru only)
62CONFIDENTIAL
GDI – from EPAM Systems
JDI Goals
1. Accumulate best practices of UI automation (open source, page objects, logging, parallelism etc.)
2. Multiplatform framework
3. Intuitive test framework
4. Stable framework
5. Flexible framework
63CONFIDENTIAL
GDI features
β€’ Interfaces based elements
β€’ Complex UI Objects
β€’ Simple + Complex UI elements + standard Forms = 31
β€’ Cascade UI Objects Initialization
β€’ Multiplatform
β€’ Logging for all actions
β€’ Stabilization mechanism
β€’ Wide Customization abilities
β€’ Module-based architecture
β€’ Parallel test runs support
64CONFIDENTIAL
PageObject β€œinfrastructure”
UI Objects
– UI elements for Web (Button, Label, Table…)
– IU elements for other platforms (any UI)
– β€œStandard” PageObjects
β€’ Form
β€’ Search
β€’ Pagination
β€’ Login
β€’ others
Page Objects
– UI elements
– Actions with UI elements
65CONFIDENTIAL
Simple UI Elements – 10
1. Text
2. Button/Label
3. Link
4. Image
5. Checkbox
6. TextField
7. DatePicker
8. FileInput
9. TextArea
10. And others :)
66CONFIDENTIAL
Complex UI Elements – 12
β€’ Selector
β€’ RadioButtons
β€’ Dropdown
β€’ Tabs/Menu
β€’ CheckList
β€’ DropList
β€’ ComboBox
β€’ TextList
β€’ Table
β€’ Tree
β€’ Range
β€’ And others :)
67CONFIDENTIAL
Standard Pages - 9
β€’ Page
β€’ Section
β€’ Form
β€’ Pop
β€’ PopupForm
β€’ Search
β€’ Pagination
β€’ NavigationPane
68CONFIDENTIAL
PageObject std example, 1 (GDI)
@JPage(url = "http://www.epam.com")
public class JacketPage extends WebPage {
@FindBy(css=β€œsomeSelector") public Menu menu;
@FindBy(css="someSelector") public CheckList sizes;
@FindBy(css=" someSelector") public Button searchButton;
@FindBy(css=" someSelector") public Table results;
}
69CONFIDENTIAL
Test std example, 1 (GDI)
1. @Test
2. public void menuTest() {
3. menu.select("Man");
4. sizes.check("M", "L");
5. searchButton.click();
6. Assert.areEquals(results.rows().count(), 4);
7. Assert.isNotEmpty(results.row("Best Jacket", column("Title")));
8. }
70CONFIDENTIAL
PageObject std example, 1 (Selenium)
public class JacketPage {
@FindBy(css="") public List<WebElement> menuElements;
@FindBy(css="") public WebElement menuIsSelected;
@FindBy(css="") public List<WebElement> sizesElements;
@FindBy(css="") public WebElement sizesIsChecked;
@FindBy(css="") public List<WebElement> sizesLabels;
@FindBy(css="") public WebElement searchButton;
@FindBy(css="") public List<WebElement> resultsColumnHeaders;
@FindBy(css="") public List<WebElement> resultsRowsHeaders;
@FindBy(css="") public List<WebElement>resultsCellsHeaders;
@FindBy(css="") public List<WebElement> resultsColumn;
@FindBy(css="") public List<WebElement> resultsRow;
…
}
71CONFIDENTIAL
PageObject std example, 1 (Selenium)
public class JacketPage {
@FindBy(css="") public List<WebElement> menuElements;
...
@FindBy(css="") public List<WebElement> resultsRow;
public void selectElementFromMenu(String name) { … }
public String getSelectedMenuItem() { … }
public boolean isMenuItemSelected(String name) { … }
public void selectElementFromMenu(String name) { … }
…
public int getResultsCount() { … }
public boolean isResultPresent(String name) { … }
public WebElement getSomeAttributeForResult(String name) { … }
…
public List<WebElement> findAllResultsMatch(String name) { … }
}
72CONFIDENTIAL
PageObject std example, 2 (GDI)
1. @JPage(url = "/login", title = "EPAM - Login page")
2. public class LoginPage extends PageForm {
3. @FindBy(css = β€œ.login”) private ITextField login;
4. @FindBy(css = β€œ.password”) private ITextField password;
5. @FindBy(css = β€œ.loginButton”) private IButton loginButton;
6. }
73CONFIDENTIAL
Test std sexample, 2 (GDI)
1. @Test
2. public void exampleTest(String searchText) {
3. loginPage.login(client);
4. searchPage.search(searchText);
5. resultsPage.results.eachContains(searchText);
6. resultsPage.openFirstResult();
7. productPage.check.productHasNoEmptyData();
8. }
74CONFIDENTIAL
Test std example, 3 (GDI)
@Test
public void shopTest() {
loginPage.open();
loginForm.login(new User(β€œuser", "password"));
search.find("best jacket");
productForm.submit(Products.TestJacket);
pagination.next();
pagination.selectPage(5);
}
75CONFIDENTIAL
PageObject std example, 4 (GDI, β€œmodel” based)
1. public class LoginForm extends Form<User> {
2. @FindBy(css=β€œsomeLocator")
3. public TextField name;
4. @FindBy(css=β€œsomeLocator")
5. public TextField password;
6. @FindBy(css=β€œsomeLocator")
7. public Button loginButton;
8. }
76CONFIDENTIAL
PageObject std example, 4 (GDI , β€œmodel” based)
public class User {
public String name;
public String password;
public User(String name,
String password) {
this.name = name;
this.password = password;
}
}
77CONFIDENTIAL
PageObject std example, 5 (GDI)
1. @JSite(domain = "https://www.epam.com")
2. public class EpamSite extends WebSite {
3. @JPage(url = "/")
4. public static HomePage homePage;
5. @JPage(url = "/careers", title = "Careers")
6. public static CareerPage careerPage;
7. @JPage(url = "/careers/job-listings", title = "Job Listings",
8. urlCheckType = CONTAIN, titleCheckType = CONTAIN)
9. public static JobPage jobPage;
10....
11.}
WebSite.init(EpamSite.class);
78CONFIDENTIAL
β€œForms” Page Object (GDI)
1. public class AddCVForm extends Form<Attendee> {
2. @FindBy(css = β€œ.first-nameβ€œ) private ITextField name;
3. @FindBy(css = β€œ.last-nameβ€œ) private ITextField lastName;
4. @FindBy(css = β€œ.emailβ€œ) private ITextField email;
5. @FindBy(css = β€œ.file-uploadβ€œ) private RFileInput cv;
6. @FindBy(css = β€œ.comment-inputβ€œ) private ITextArea comment;
7. @FindBy(xpath = β€œ//*[.='Submit']β€œ) private IButton submit;
8. @FindBy(xpath = β€œ//*[.='Cancel']β€œ) private IButton cancel;
9. }
79CONFIDENTIAL
Entities driven testing (GDI)
@Test(dataProvider = β€œattendees”)
public void menuTest(Attendee attendee) {
searchFilter.fill(attendee);
checkSuggestionsContains(attendee);
searchFilter.search(attendee);
assertEquals(results.rows().count(), 1);
results.row(attendee.name, column(β€œName”))
addCVForm.submit(attendee.cv);
checkCVInDB(attendee.cv);
previewForm.verify(attendee);
}
80CONFIDENTIAL
Java examples
public class HomePage extends WebPage {
@FindBy(css="div.tabs-ui[data-path*=
'/content/epam/en/jcr:content/content_container/
section_4/section-par/tabs']")
public EpamCoreSection epamCoreSection;
}
81CONFIDENTIAL
Java examples
public class EpamCoreSection extends Section {
@FindBy(css="div.tab-1>div.text>div.text-ui >p>span.font-size-26")
public Text whoWeAreText;
@FindBy(css="div.tab-2>div.text>div.text-ui >p>span.font-size-26")
public Text whatWeDoText;
@FindBy(css="div.tab-3>div.text>div.text-ui >p>span.font-size-26")
public Text whoWeServeText;
@FindBy(xpath="//div[.='Who we serve']")
public Button whoWeServe;
@FindBy(xpath="//div[.='Who we are']")
public Button whoWeAre;
@FindBy(xpath="//div[.='What we do']")
public Button whatWeDo;
}
82CONFIDENTIAL
Java examples
@Test
public void presentationSimpleTest() {
homePage.checkOpened();
homePage.epamCoreSection.whoWeAre.highlight();
homePage.epamCoreSection.whoWeAreText.highlight();
new Check("Tab text").areEquals("" +
"We are more than developers.
We are the experts that
will take your business into the digital future.",
homePage.epamCoreSection.whoWeAreText.getText());
homePage.epamCoreSection.highlight();
homePage.epamCoreSection.whoWeServe.highlight();
homePage.epamCoreSection.whoWeServe.click();
}
83CONFIDENTIAL
Java examples
@Test
public void presentationComplexTest() {
homePage.checkOpened();
textToTest(HomeTabs.WHATWEDO, homePage.epamCoreSection);
textToTest(HomeTabs.WHOWEARE, homePage.epamCoreSection);
textToTest(HomeTabs.WHOWESERVE, homePage.epamCoreSection);
}
84CONFIDENTIAL
Java examples
public void textToTest(HomeTabs tab, EpamCoreSection epamCoreSection){
switch (tab) {
case WHOWEARE:
chooseTab(epamCoreSection.whoWeAre,
epamCoreSection.whoWeAreText, HomeTabsTextToCheck.WHOWEARE);
break;
case WHATWEDO:
chooseTab(epamCoreSection.whatWeDo,
epamCoreSection.whatWeDoText, HomeTabsTextToCheck.WHATWEDO);
break;
case WHOWESERVE:
chooseTab(epamCoreSection.whoWeServe,
epamCoreSection.whoWeServeText, HomeTabsTextToCheck.WHOWESERVE);
break;
}
}
85CONFIDENTIAL
Java examples
public void chooseTab(Button tab, Text text, String textToCheck){
tab.highlight();
tab.click();
text.highlight();
new Check("Tab text").areEquals(textToCheck,
text.getText());
}
86CONFIDENTIAL
Java examples
public static class HomeTabsTextToCheck {
public static final String WHOWEARE="We are more than developers." +
" We are the experts that will take your business into the digital future.";
public final static String WHATWEDO="We transform businesses through the art of digitization." +
" Our expertise spans multiple disciplines," +
" providing our clients with software solutions that dramatically drive results and outcomes.";
public final static String WHOWESERVE="The right technology translates business strategies into results." +
" We deliver domain-specific, transformative software solutions that reshape the way you do business.";
}
87CONFIDENTIAL
Customization
1. Customize method’s behavior
2. Customize element’s behavior
3. Customize all objects behavior
4. Develop new UI element
5. Modules
1. Logger
2. Asserter
3. Driver
4. etc.
88CONFIDENTIAL
Architecture  Modules structure
89CONFIDENTIAL
Architecture  Modules structure
90CONFIDENTIAL
Implementation is based on
Implementation is based on … what?
Let’s:
β€’ download source code
β€’ familiarize
β€’ investigate
β€’ develop a tiny prototype
β€’ try to use
β€’ try to improve (for example, add Decorator DP based features)
β€’ welcome to QA Automation tools development
β€’ welcome to Open Source
91CONFIDENTIAL
JDI - info
β€’ http://jdi.epam.com/
β€’ http://jdi.epam.com/download
β€’ https://github.com/epam/JDI/tree/master/Java/Tests
β€’ https://github.com/epam/JDI/tree/master/Java
β€’ https://github.com/epam/JDI/tree/master/C%23.Net/Tests
β€’ https://github.com/epam/JDI/tree/master/C%23.Net
β€’ IT-Saturday video (Ru only)
β€’ β€œJDI - EPAM Framework (IT-Subbotnik, with listings).pptx” (RU)
β€’ β€œJDI - QA Conf 2016.pptx” (Ru)
β€’ β€œJDI – Secon 2016.pptx” (EN)
92CONFIDENTIAL
Serenity (ex. Thucydides)
1. Serenity (Thucydides) – is an open-source tool, oriented on effective acceptance testing and
detailed documentation and reports of the project.
2. It works with Junit and BDD tools like JBehave and Cucumber-JVM, and gives a wide API for
automated testing with integrity with Selenium Webdriver.
3. It is made for the following tasks:
β€’ Creating more flexible tests, which are easier to be supported
β€’ Getting illustrated story-based reports
β€’ Clear context of connection between tests and requirements
β€’ Measurement of requirements coverage.
93CONFIDENTIAL
Serenity (ex. Thucydides) workflow
β€’ Step 1: Defining requirement and acceptance criteria
It starts from requirements, which are need to be tested. For every requirement there is an
acceptance criteria which describing the requirement better. Thucydides automate acceptance
criteria
β€’ Step 2: Modelling the requirements
With the help of Thucydides you create a simple model of requirements made on Java language. There
are some ways of modelling requirements, including simple Java class, using convention and structure
of directories of integrating with other tools like Jira. That approach allows the developer what
requirement is tested each of the test, and give Thucydides the ability to track testing features and
requirements
94CONFIDENTIAL
Serenity (ex. Thucydides) workflow
β€’ Step 3: Automation of acceptance testing
Next is describing acceptance criteria by business language is following, and automation engineers
implement them using BDD such as jBehave or Cucumber-JVM, or using Java and Junit, in order for
Thucydides to run it with β€œpending” status (body is not implemented)
β€’ Step 4: Test implementation
Automation Engineers now can implement acceptance criteria in a form of real-time AUT test. Tests
can be divided into steps for better readability and easiness of support. Webdriver is used for testing.
95CONFIDENTIAL
Serenity (ex. Thucydides) workflow
β€’ Step 5: Test results report
Thucydides allow you to create detailed test reports about test runs, including:
History for ach test
Screenshot for each test step
Result of test run including time and error messages
β€’ Step 6: Requirements coverage report
Besides test run reports, Thucideds also provide information about:
Number of tested requirements
Number of passed requirements
Number of requirements which need to be run
96CONFIDENTIAL
Serenity (ex. Thucydides) workflow
β€’ Step 7: Project progress report
Thucydides provide information about project history progress:
Change in number of features implemented in time
Change in quantity of implemented and tested features in time
Change of failed tests in time
β€’ Summary
As we can see, Thucydides is a rather complex tool, build around BDD concept and acceptance testing,
using Webdriver for testing web applications.
β€’ Info
Official website
Official documentation
97CONFIDENTIAL
Page Object
And what about Page Object supports …?
98CONFIDENTIAL
Page Object β€œdefault” implementation
Framework implements Page Object pattern and let’s you decrease code duplication another one type
of classes between tests and pages, called β€œsteps”. Let’s look at β€œsteps” with page object class:
1. public class StepsinBook extends ScenarioSteps {
2. public StepsinBook(Pages pages) {
3. super(pages);
4. }
5. public BookPage getPageBook()
6. {
7. return getPages().currentPageAt(BookPage.class);
8. }
9. }
99CONFIDENTIAL
Page Object β€œdefault” implementation
1. public class StepsinBook extends ScenarioSteps {
2. @Step public void getMain(String url)
3. {
4. getPageBook().getMainPage(url);
5. }
6. @Step public void AllBooks()
7. {
8. getPageBook().allBooks();
9. }
10. @Step public void search(){
11. getPageBook().search(β€œBook");
12. }
13. @Step public void catalog(){
14. getPageBook().catalog();
15. }}
100CONFIDENTIAL
Page Object β€œdefault” implementation
1. public class BookPage extends PageObject {
2. @FindBy(linkText = β€œAll books")
3. WebElement allbooksButton;
4. @FindBy(linkText = β€œSearch")
5. WebElement searchButton;
6. @FindBy(name = "query")
7. WebElement searchField;
8. @FindBy(css = "button")
9. WebElement searchBegin;
10. }
101CONFIDENTIAL
Page Object β€œdefault” implementation
1. public class BookPage extends PageObject {
2. public BookPage(WebDriver driver) {
3. super(driver);
4. }
5. public void getMainPage(String url) {
6. getDriver().get(url);
7. }
8. public void allBooks() {
9. allbooksButton.click();
10. }
11. public void search(String searchWord) {
12. searchButton.click();
13. searchField.sendKeys(searchWord);
14. searchBegin.click();
15. }
16. }
102CONFIDENTIAL
Implementation is based on
β€’ Reflection
β€’ Annotation
β€’ Templates
103CONFIDENTIAL
Geb – general info
1. Tool for browser automation, made on Groovy (JVM-based) and based on Selenium Webdriver.
2. It using:
1. Selenium for browser automation
2. jQuery selectors for locating elements
3. Page object pattern
.
3. In the bounds of testing it can be easily integrated with different test frameworks like:
1. Junit
2. TestNG
3. Spock
104CONFIDENTIAL
Geb – general info
If to compare with Webdriver API, Geb provides more comfortable interface in the following areas:
β€’ Working with Webdriver instance (creating, configuration, moves, destruction)
β€’ Locating elements (jQuery locators)
β€’ Page object pattern
β€’ Waiters
β€’ Page interactions
β€’ Work with AJAX elements
β€’ Integration with build-tools (maven, gradle, grails)
β€’ Integration with cloud services (Sauce labs, Browser Stack)
Official website
Official documentation
105CONFIDENTIAL
Geb - example
1. import geb.Browser
2. Browser.drive {
3. go "http://myapp.com/login"
4. assert $("h1").text() == "Please Login"
5. $("form.login").with {
6. username = "admin"
7. password = "password"
8. login().click()
9. }
10. assert $("h1").text() == "Admin Section"
11.}
106CONFIDENTIAL
SWD Page Recorder
1. SWD Page Recorder helps you to create locators of web-page, debug them in the application and
generate PageObject code for classes on C#, Java, Python, Ruby, Perl for using them in Selenium
Webdriver tests.
2. That tool not only lets you find locator needed, but also optimize it and generate all the code
needed for further element declaration in the code.
3. SWD Page Recorder is a unified tool for working with locators in every browser which are
supported by Selenium.
4. Important moment that Page Recorder tests the selectors using Webdriver – so you’re not going to
have cases when locator find other way will not work in Webdriver.
107CONFIDENTIAL
SWD Page Recorder
Sources, documentation and so on
108CONFIDENTIAL
How to select an appropriate solution?
109CONFIDENTIAL
1. Business context
2. Tech context
– Challenge
– Solution
– Technology Stack
3. QA Automation process context
4. Source code example
5. Summary
A real-life example
110CONFIDENTIAL
1. Example and β€œhome work”
– How to setting up environment
β€’ This is task 0 
– Where to download (https://github.com/comaqaby/Patterns/tree/master/C%23)
– How to build
– How to configure
– How to run
Example
111CONFIDENTIAL
1. Download example’ source code (for each β€œsolution”)
2. β€œInvestigate”
3. Develop a TODO list with a set of improvements
4. Setting up environment
5. Compile and Run
6. β€œPlay”
7. Improve  Update TODO list with a set of improvements
β€œHomework”, part 1 
112CONFIDENTIAL
1. Read recommended books and articles
2. Improve  Update TODO list with a set of improvements
3. Provide me via email with an intermediate and final list of improvements
4. Develop at least 1 more auto-test (for each β€œsolution”)
5. Develop a set of metrics to β€œcompare” solutions
6. Develop an algorithm β€œHow to select a proper solution”
7. Provide me via email with a set of metrics + algorithm
8. Next iteration 
β€œHomework”, part 2 
113CONFIDENTIAL
1. Play with GDI β€œattentively”
2. Join QA Automation tools development
3. Join Open Source β€œworld”
β€œHomework”, part 3 
114CONFIDENTIAL
1. Could you please β€œrefresh” your theoretical knowledge, slides 1-31, thanks
β€œRules” and principles
115CONFIDENTIAL
1. Martin Fowler β€œRefactoring”
– http://martinfowler.com/books/refactoring.html
– http://refactoring.com/
– http://refactoring.com/catalog/
– http://refactoring.com/catalog/replaceConditionalWithPolymorphism.html
Useful links
116CONFIDENTIAL
1. Refactoring to Patterns and vice versa
– https://industriallogic.com/xp/refactoring/
– https://industriallogic.com/xp/refactoring/catalog.html
– https://industriallogic.com/xp/refactoring/conditionDispatcherWithCommand.html
– https://industriallogic.com/xp/refactoring/conditionalWithStrategy.html
– http://martinfowler.com/books/r2p.html
Useful links
117CONFIDENTIAL
1. https://sourcemaking.com/
– https://sourcemaking.com/refactoring
– https://sourcemaking.com/refactoring/replace-conditional-with-polymorphism
– https://sourcemaking.com/design_patterns
– https://sourcemaking.com/antipatterns
β€’ https://sourcemaking.com/antipatterns/software-development-antipatterns
β€’ https://sourcemaking.com/antipatterns/software-architecture-antipatterns
– https://sourcemaking.com/uml
Useful links
118CONFIDENTIAL
Tech β€œbasement”
β€’ Grady Butch Β«Object oriented analysis and design with examples of apps on C++
Notes: IMHO No need to be afraid of C++, 95% of the material is conceptual, there is no strict
connection to chosen language. From my point of view is one of the best books for true getting to
know with OOP.
β€’ Martin Fowler Β«RefactoringΒ»
Notes: IMHO strongly recommend to read from cover to cover, twice, in order to have contents of
the book – you active professional luggage.
β€’ Gang of four β€œDesign patterns”
Notes: IMHO strongly recommend to read from cover to cover, twice, in order to have contents of
the book – you active professional luggage.
119CONFIDENTIAL
Tech β€œbasement”
β€’ D. Thomas, Andrew Hunt β€œPragmatic Programmer, The: From Journeyman to Master”
Notes: IMHO Amazing book that consists of a ton of advices. IMHO strongly recommend to read
from cover to cover, twice, in order to have contents of the book – you active professional
luggage. And then look through different chapters before talking to a customer.
β€’ Steve McConnel β€œCode complete”
Notes: IMHO No need to be afraid of the size of the book ... it should be read or before β€œgoing to
bed”, or from any place, of separate chapters, just to fresh things in the memory in the chosen f
ield of problem.
120CONFIDENTIAL
What’s next?!
β€’ β€œOut of box Page Object Design Pattern, Java”
β€’ Dynamic solutions
β€’ Let’s compare with a static one
β€’ β€œOut of box Page Object Design Pattern, .Net C#”
β€’ Dynamic solutions
β€’ Let’s compare with a static one
Summary: 5/12 - Webinar, 5/13 – send all necessary materials
β€’ β€œVariants of implementation Page Object Design Pattern from the scratches, without being bind to
any programming language”
β€’ Static solutions
β€’ Dynamic solutions
β€’ Let’s compare static and dynamic
β€’ Answer to all our questions
Summary: 5/19 - Webinar, 5/19 – send all necessary materials
121CONFIDENTIAL
Anton_Semenchenko@epam.com
Skype - semenchenko_anton_v
+375 33 33 46 120
+375 44 74 00 385
https://www.linkedin.com/in/anton-semenchenko-612a926b
https://www.facebook.com/semenchenko.anton.v
https://twitter.com/comaqa
www.comaqa.by
www.corehard.by
122CONFIDENTIAL
Thanks for your attention
Anton Semenchenko
EPAM Systems
www.comaqa.by
www.corehard.by
123CONFIDENTIAL

More Related Content

What's hot (20)

PPTX
DSL, Page Object and Selenium – a way to reliable functional tests
Mikalai Alimenkou
Β 
PPTX
Example of TAF with batch execution of test cases
COMAQA.BY
Β 
PDF
Page Objects Done Right - selenium conference 2014
Oren Rubin
Β 
PDF
Selenium - The page object pattern
Michael Palotas
Β 
PDF
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
Paul Withers
Β 
PDF
Testing Angular
Lilia Sfaxi
Β 
PDF
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Iakiv Kramarenko
Β 
PDF
Automation Abstractions: Page Objects and Beyond
TechWell
Β 
PDF
COScheduler
WO Community
Β 
PPTX
Breaking Dependencies to Allow Unit Testing
Steven Smith
Β 
PPTX
Selenium withnet
Vlad Maniak
Β 
PPTX
Improving the Quality of Existing Software - DevIntersection April 2016
Steven Smith
Β 
PDF
Introduce Flux & react in practices (KKBOX)
Hsuan Fu Lien
Β 
PPTX
Better Page Object Handling with Loadable Component Pattern
SQALab
Β 
PPTX
Improving the Quality of Existing Software
Steven Smith
Β 
PDF
The Many Ways to Test Your React App
All Things Open
Β 
PPTX
Asp.Net MVC Intro
Stefano Paluello
Β 
PPT
Java EE changes design pattern implementation: JavaDays Kiev 2015
Alex Theedom
Β 
PPT
Java Basics for selenium
apoorvams
Β 
PPTX
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
seleniumconf
Β 
DSL, Page Object and Selenium – a way to reliable functional tests
Mikalai Alimenkou
Β 
Example of TAF with batch execution of test cases
COMAQA.BY
Β 
Page Objects Done Right - selenium conference 2014
Oren Rubin
Β 
Selenium - The page object pattern
Michael Palotas
Β 
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
Paul Withers
Β 
Testing Angular
Lilia Sfaxi
Β 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Iakiv Kramarenko
Β 
Automation Abstractions: Page Objects and Beyond
TechWell
Β 
COScheduler
WO Community
Β 
Breaking Dependencies to Allow Unit Testing
Steven Smith
Β 
Selenium withnet
Vlad Maniak
Β 
Improving the Quality of Existing Software - DevIntersection April 2016
Steven Smith
Β 
Introduce Flux & react in practices (KKBOX)
Hsuan Fu Lien
Β 
Better Page Object Handling with Loadable Component Pattern
SQALab
Β 
Improving the Quality of Existing Software
Steven Smith
Β 
The Many Ways to Test Your React App
All Things Open
Β 
Asp.Net MVC Intro
Stefano Paluello
Β 
Java EE changes design pattern implementation: JavaDays Kiev 2015
Alex Theedom
Β 
Java Basics for selenium
apoorvams
Β 
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
seleniumconf
Β 

Similar to Out of box page object design pattern, java (20)

PPTX
Comparing Angular and React JS for SPAs
Jennifer Estrada
Β 
PPTX
Hibernate tutorial
Mumbai Academisc
Β 
PDF
Contentful with Netgen Layouts workshop
Ivo Lukac
Β 
PPTX
Single Page Applications Workshop Part I: Interesting Topics in HTML5, CSS an...
Jalal Mostafa
Β 
PDF
Modern Web Applications with Sightly
Radu Cotescu
Β 
PPT
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
Shahzad
Β 
PPT
High Performance Ajax Applications 1197671494632682 2
Niti Chotkaew
Β 
PPT
High Performance Ajax Applications
Julien Lecomte
Β 
PDF
Automation Abstraction Layers: Page Objects and Beyond
Alan Richardson
Β 
PDF
PrΓ©sentation du gΓ©nΓ©rateur de site statique eleventy
Gilles Vauvarin
Β 
PDF
Architecture Specification - Visual Modeling Tool
Adriaan Venter
Β 
PDF
Web Development with Delphi and React - ITDevCon 2016
Marco Breveglieri
Β 
PPTX
JS Essence
Uladzimir Piatryka
Β 
PDF
Getting Started with React, When You’re an Angular Developer
Fabrit Global
Β 
PDF
70487.pdf
Karen Benoit
Β 
PDF
Application Express - A web development environment for the masses - and for ...
Sage Computing Services
Β 
PDF
Super applied in a sitecore migration project
dodoshelu
Β 
PPTX
AngularJS 1.x - your first application (problems and solutions)
Igor Talevski
Β 
DOCX
Diff sand box and farm
Rajkiran Swain
Β 
PPTX
Tips for Developing and Testing IBM HATS Applications
Strongback Consulting
Β 
Comparing Angular and React JS for SPAs
Jennifer Estrada
Β 
Hibernate tutorial
Mumbai Academisc
Β 
Contentful with Netgen Layouts workshop
Ivo Lukac
Β 
Single Page Applications Workshop Part I: Interesting Topics in HTML5, CSS an...
Jalal Mostafa
Β 
Modern Web Applications with Sightly
Radu Cotescu
Β 
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
Shahzad
Β 
High Performance Ajax Applications 1197671494632682 2
Niti Chotkaew
Β 
High Performance Ajax Applications
Julien Lecomte
Β 
Automation Abstraction Layers: Page Objects and Beyond
Alan Richardson
Β 
PrΓ©sentation du gΓ©nΓ©rateur de site statique eleventy
Gilles Vauvarin
Β 
Architecture Specification - Visual Modeling Tool
Adriaan Venter
Β 
Web Development with Delphi and React - ITDevCon 2016
Marco Breveglieri
Β 
JS Essence
Uladzimir Piatryka
Β 
Getting Started with React, When You’re an Angular Developer
Fabrit Global
Β 
70487.pdf
Karen Benoit
Β 
Application Express - A web development environment for the masses - and for ...
Sage Computing Services
Β 
Super applied in a sitecore migration project
dodoshelu
Β 
AngularJS 1.x - your first application (problems and solutions)
Igor Talevski
Β 
Diff sand box and farm
Rajkiran Swain
Β 
Tips for Developing and Testing IBM HATS Applications
Strongback Consulting
Β 
Ad

More from COMAQA.BY (20)

PDF
ВСстированиС Π°Π½Π°Π»ΠΎΠ³ΠΎΠ² инсталлируСмых ΠΏΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠΉ (Android Instant Apps, Progre...
COMAQA.BY
Β 
PPTX
Anton semenchenko. Comaqa Spring 2018. Nine circles of hell. Antipatterns in ...
COMAQA.BY
Β 
PPTX
Vivien Ibironke Ibiyemi. Comaqa Spring 2018. Enhance your Testing Skills With...
COMAQA.BY
Β 
PPTX
Roman Soroka. Comaqa Spring 2018. Π“Π»ΠΎΠ±Π°Π»ΡŒΠ½Ρ‹ΠΉ ΠΎΠ±Π·ΠΎΡ€ процСсса QA ΠΈ Π΅Π³ΠΎ Π²Π°ΠΆΠ½ΠΎΡΡ‚ΡŒ
COMAQA.BY
Β 
PPTX
Roman Iovlev. Comaqa Spring 2018. АрхитСктура Open Source Ρ€Π΅ΡˆΠ΅Π½ΠΈΠΉ для Π°Π²Ρ‚ΠΎΠΌΠ°Ρ‚...
COMAQA.BY
Β 
PPTX
Vladimir Polyakov. Comaqa Spring 2018. ΠžΡΠΎΠ±Π΅Π½Π½ΠΎΡΡ‚ΠΈ тСстирования ПО Π² ΠΏΡ€Π΅Π΄ΠΌΠ΅Ρ‚Π½...
COMAQA.BY
Β 
PPTX
Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...
COMAQA.BY
Β 
PPTX
Π”ΠΌΠΈΡ‚Ρ€ΠΈΠΉ Π›Π΅ΠΌΠ΅ΡˆΠΊΠΎ. Comaqa Spring 2018. Continuous mobile automation in build pi...
COMAQA.BY
Β 
PPTX
Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.
COMAQA.BY
Β 
PPTX
Vadim Zubovich. Comaqa Spring 2018. ΠšΡ€Π°ΡΠΈΠ²ΠΎΠ΅ тСстированиС ΠΏΡ€ΠΎΠΈΠ·Π²ΠΎΠ΄ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎΡΡ‚ΠΈ.
COMAQA.BY
Β 
PPTX
Alexander Andelkovic. Comaqa Spring 2018. Using Artificial Intelligence to Te...
COMAQA.BY
Β 
PPTX
Моя Ρ€ΠΎΠ»ΡŒ Π² ΠΊΠΎΠ½Ρ„Π»ΠΈΠΊΡ‚Π΅
COMAQA.BY
Β 
PPTX
ΠžΡ€Π³Π°Π½ΠΈΠ·Π°Ρ†ΠΈΡ ΠΏΡ€ΠΈΠ΅ΠΌΠΎΡ‡Π½ΠΎΠ³ΠΎ тСстирования силами ΠΌΠ°Ρ‚Π΅Ρ€Ρ‹Ρ… тСстировщиков
COMAQA.BY
Β 
PPTX
Π Π°Π·Π²ΠΈΡ‚ΠΈΠ΅ ΠΈΠ»ΠΈ ΡΠΌΠ΅Ρ€Ρ‚ΡŒ
COMAQA.BY
Β 
PPTX
ЭффСктивная Ρ€Π°Π±ΠΎΡ‚Π° с Ρ€ΡƒΡ‚ΠΈΠ½Π½Ρ‹ΠΌΠΈ Π·Π°Π΄Π°Ρ‡Π°ΠΌΠΈ
COMAQA.BY
Β 
PPTX
Open your mind for OpenSource
COMAQA.BY
Β 
PPTX
JDI 2.0. Not only UI testing
COMAQA.BY
Β 
PPTX
Battle: BDD vs notBDD
COMAQA.BY
Β 
PPTX
Π‘Π»ΠΎΠΈ тСстового Ρ„Ρ€Π°ΠΌΠ΅Π²ΠΎΡ€ΠΊΠ°. Π§Ρ‚ΠΎ? Π“Π΄Π΅? Когда?
COMAQA.BY
Β 
PPTX
АспСктно ΠΎΡ€ΠΈΠ΅Π½Ρ‚ΠΈΡ€ΠΎΠ²Π°Π½Π½ΠΎΠ΅ ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ для Java Π°Π²Ρ‚ΠΎΠΌΠ°Ρ‚ΠΈΠ·Π°Ρ‚ΠΎΡ€ΠΎΠ²
COMAQA.BY
Β 
ВСстированиС Π°Π½Π°Π»ΠΎΠ³ΠΎΠ² инсталлируСмых ΠΏΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠΉ (Android Instant Apps, Progre...
COMAQA.BY
Β 
Anton semenchenko. Comaqa Spring 2018. Nine circles of hell. Antipatterns in ...
COMAQA.BY
Β 
Vivien Ibironke Ibiyemi. Comaqa Spring 2018. Enhance your Testing Skills With...
COMAQA.BY
Β 
Roman Soroka. Comaqa Spring 2018. Π“Π»ΠΎΠ±Π°Π»ΡŒΠ½Ρ‹ΠΉ ΠΎΠ±Π·ΠΎΡ€ процСсса QA ΠΈ Π΅Π³ΠΎ Π²Π°ΠΆΠ½ΠΎΡΡ‚ΡŒ
COMAQA.BY
Β 
Roman Iovlev. Comaqa Spring 2018. АрхитСктура Open Source Ρ€Π΅ΡˆΠ΅Π½ΠΈΠΉ для Π°Π²Ρ‚ΠΎΠΌΠ°Ρ‚...
COMAQA.BY
Β 
Vladimir Polyakov. Comaqa Spring 2018. ΠžΡΠΎΠ±Π΅Π½Π½ΠΎΡΡ‚ΠΈ тСстирования ПО Π² ΠΏΡ€Π΅Π΄ΠΌΠ΅Ρ‚Π½...
COMAQA.BY
Β 
Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...
COMAQA.BY
Β 
Π”ΠΌΠΈΡ‚Ρ€ΠΈΠΉ Π›Π΅ΠΌΠ΅ΡˆΠΊΠΎ. Comaqa Spring 2018. Continuous mobile automation in build pi...
COMAQA.BY
Β 
Ivan Katunov. Comaqa Spring 2018. Test Design and Automation for Rest API.
COMAQA.BY
Β 
Vadim Zubovich. Comaqa Spring 2018. ΠšΡ€Π°ΡΠΈΠ²ΠΎΠ΅ тСстированиС ΠΏΡ€ΠΎΠΈΠ·Π²ΠΎΠ΄ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎΡΡ‚ΠΈ.
COMAQA.BY
Β 
Alexander Andelkovic. Comaqa Spring 2018. Using Artificial Intelligence to Te...
COMAQA.BY
Β 
Моя Ρ€ΠΎΠ»ΡŒ Π² ΠΊΠΎΠ½Ρ„Π»ΠΈΠΊΡ‚Π΅
COMAQA.BY
Β 
ΠžΡ€Π³Π°Π½ΠΈΠ·Π°Ρ†ΠΈΡ ΠΏΡ€ΠΈΠ΅ΠΌΠΎΡ‡Π½ΠΎΠ³ΠΎ тСстирования силами ΠΌΠ°Ρ‚Π΅Ρ€Ρ‹Ρ… тСстировщиков
COMAQA.BY
Β 
Π Π°Π·Π²ΠΈΡ‚ΠΈΠ΅ ΠΈΠ»ΠΈ ΡΠΌΠ΅Ρ€Ρ‚ΡŒ
COMAQA.BY
Β 
ЭффСктивная Ρ€Π°Π±ΠΎΡ‚Π° с Ρ€ΡƒΡ‚ΠΈΠ½Π½Ρ‹ΠΌΠΈ Π·Π°Π΄Π°Ρ‡Π°ΠΌΠΈ
COMAQA.BY
Β 
Open your mind for OpenSource
COMAQA.BY
Β 
JDI 2.0. Not only UI testing
COMAQA.BY
Β 
Battle: BDD vs notBDD
COMAQA.BY
Β 
Π‘Π»ΠΎΠΈ тСстового Ρ„Ρ€Π°ΠΌΠ΅Π²ΠΎΡ€ΠΊΠ°. Π§Ρ‚ΠΎ? Π“Π΄Π΅? Когда?
COMAQA.BY
Β 
АспСктно ΠΎΡ€ΠΈΠ΅Π½Ρ‚ΠΈΡ€ΠΎΠ²Π°Π½Π½ΠΎΠ΅ ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ для Java Π°Π²Ρ‚ΠΎΠΌΠ°Ρ‚ΠΈΠ·Π°Ρ‚ΠΎΡ€ΠΎΠ²
COMAQA.BY
Β 
Ad

Recently uploaded (20)

PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
Β 
PDF
β€œNPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
Β 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
Β 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
Β 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
Β 
PPTX
Digital Circuits, important subject in CS
contactparinay1
Β 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
Β 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
Β 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
Β 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
Β 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
Β 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
Β 
PDF
β€œComputer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
Β 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
Β 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
Β 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
Β 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
Β 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
Β 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
Β 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
Β 
The Project Compass - GDG on Campus MSIT
dscmsitkol
Β 
β€œNPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
Β 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
Β 
Staying Human in a Machine- Accelerated World
Catalin Jora
Β 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
Β 
Digital Circuits, important subject in CS
contactparinay1
Β 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
Β 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
Β 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
Β 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
Β 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
Β 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
Β 
β€œComputer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
Β 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
Β 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
Β 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
Β 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
Β 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
Β 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
Β 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
Β 

Out of box page object design pattern, java

  • 1. 1CONFIDENTIAL Out of box Page Object Design Pattern, Java Anton Semenchenko
  • 2. 2CONFIDENTIAL 1. Page Object – just to β€œrefresh” 2. State-less or state-full solution - just to β€œrefresh” 3. How to select a proper PO implementation? Agenda, part 1 (to refresh)
  • 3. 3CONFIDENTIAL 1. Hypothetical project context 2. Compare complexity 3. Compare β€œtech” limitations 4. Compare β€œbusiness” limitations 5. Rationale β€œbusiness” limitations 6. How to find and β€œupdate” a balance for your own project? Agenda, part 2 (to refresh)
  • 4. 4CONFIDENTIAL 1. β€œraw” Selenium Page Objects 2. Page Factory from Selenium library 3. HMTL Element framework from Yandex 4. Selenide 5. JDI framework from EPAM 6. SWD Page Recorder Agenda, part 3 (solutions)
  • 5. 5CONFIDENTIAL 1. A real-life example 2. β€œHomework” 3. β€œRules” and principles 4. A set of useful links 5. What’s next? 6. Questions Agenda, part 4 (take away points)
  • 6. 6CONFIDENTIAL 1. Page Objects – encapsulates the way of identification and logical grouping of widgets. 2. Page Object == Logical Page 3. Page Object != Physical Page Page Object – just to β€œrefresh”
  • 7. 7CONFIDENTIAL Page Object – β€œexample” 
  • 8. 8CONFIDENTIAL Page Object – β€œexample” 
  • 9. 9CONFIDENTIAL 1. Let’s compare: – Photo β€’ Share – looks like parallelism (easy parallelism). – Video β€’ Share – looks like parallelism (not trivial parallelism). State-less or state-full solution?
  • 10. 10CONFIDENTIAL 1. How easy transform solution from β€œsingle” to β€œmulti” threading (to decrease β€œQA Automation Windows”) – State-less – like share a photo β€’ Just 5 minutes of work. – State-full – like share a video β€’ Not trivial task, could be a night mare. 2. Summary – prefer state-less solutions to state-full solutions in mooooost cases; – before start implementation a state-full solution, please, take a break for a minute, and re- thing everything again, possibly you can find a proper state-less solution. State-less or state-full solution?
  • 11. 11CONFIDENTIAL 1. Static class – could be implemented as a state-less solution easily 2. Object – State-full solution in 99,99% cases 3. Summary – prefer static class based solutions (state-less) to object based (state-full) in mooooost cases; – before start implementation based on objects, please, take a break for a minute, and re-thing everything again, possibly you can find a proper solution based on static classes. Object or static class State-full or state-less solution?
  • 12. 12CONFIDENTIAL 1. Too complicated business logic due to Domain 2. Too complicated business logic due to System size (thousands test-cases) 3. Too many β€œcontexts” – Browser versions – Environments – Customers with a tiny nuances of functionality – Platforms (cross-browser Web plus cross-platform Mobile) – Combination  4. Combination  Page Objects – state-full, general case
  • 13. 13CONFIDENTIAL 1. Web UI that behaves like a Wizard 2. Web UI in combination with Mobile in one use case 3. Internet of Things (in most cases) 4. More then 1 page during 1 test (for example several portals or several instances of one portal to implement one β€œbusiness use case”): – Really seldom; – Looks like integration tests (in most cases): β€’ Std solution- some type of White Box Testing. 5. Many others β€œspecial cases” Page Objects – state-full, special cases
  • 14. 14CONFIDENTIAL How to select a proper PO implementation?
  • 15. 15CONFIDENTIAL 1. 30 Physical Pages 2. Standard Header, footer and search functionality for all physical pages 3. Each Physical Page consists of – Header – H – Footer – F – Search – S – Some functionality, specific for the Page – U (unique) Hypothetical project context – to compare
  • 16. 16CONFIDENTIAL 1. 33 Static Page Objects = Logical Pages 2. 0 explicit and 30 implicit Physical Pages 3. Just share 33 Static Page Objects between 30 implicit Physical Pages – For example, Header Static Page Object (static class) is used in test cases for all 30 Physical Page Objects 4. Complexity – just 33 static state-less entities (plus limitations due to state-less solutions) Compare complexity – Static Page Object based
  • 17. 17CONFIDENTIAL 1. 33 Dynamic Page Objects = Logical Pages 2. It depends on implementation (one of the ways): – 0 explicit and 30 implicit Physical Pages – implicit Physical Page implements on Action layer (limitations example) – Action for Physical Page aggregates all necessary Dynamic Logical Pages β€’ Physical Pages are implemented in a next way: create all necessary instances of logical pages, aggregate in some way, use Action layer as an point of aggregation in most cases, free resources Compare complexity – Dynamic Page Object based (option 1)
  • 18. 18CONFIDENTIAL 1. 120 objects (min), each with some state, dynamically created and frees to implement necessary behavior - to implement 30 implicit Physical Pages 2. Complexity – 120 dynamic, state-full entities min (plus some limitations due to state-full solution implementation nuances) Compare complexity – Dynamic Page Object based (option 1)
  • 19. 19CONFIDENTIAL 1. 33 Dynamic Page Objects = Logical Pages 2. It depends on implementation (another way): – 30 explicit Physical Pages – Multiple Interface inheritance – Combine Page Objects and Actions layer (in most cases) – Action-Physical Page (limitations example) β€’ Implements all Logical Pages interfaces using aggregation and β€œdelegation” β€’ Aggregate all Dynamic Logical Page Objects β€’ Create and frees resources (Dynamic Logical Page Objects) Compare complexity – Dynamic Page Object based (option 2)
  • 20. 20CONFIDENTIAL 1. 150 objects, each with some state, dynamically created and frees to implement necessary behavior - to implement 30 explicit Physical Pages 2. Complexity – 150 dynamic, state-full not trivial entities with a multiple interface inheritance (plus some limitations due to state-full solution implementation nuances) Compare complexity – Dynamic Page Object based (option 2)
  • 21. 21CONFIDENTIAL 1. Can be used together with next Design Patterns Approaches – Action (both static – preferable and dynamic) – Key-word driven – DSL – external only – BDD – partially, it depends on exact BDD engine implementation limitations 2. Can’t be used together with next Design Patterns – Factory – Flow (Fluent Interface) – Navigator (for Web) Compare β€œtech” limitations - Static Page Object based
  • 22. 22CONFIDENTIAL 1. No limitations, but … – For example, in most cases it’s hard to isolate Action and Page Objects layers Compare β€œtech” limitations - Dynamic Page Object based
  • 23. 23CONFIDENTIAL 1. Too complicated business logic due to Domain 2. Too complicated business logic due to System size (thousands test-cases) 3. Too many β€œcontexts” – Browser versions – Environments – Customers with a tiny nuances of functionality – Platforms (cross-browser Web plus cross-platform Mobile) – Combination  4. Combination  Compare β€œbusiness” limitations - Static
  • 24. 24CONFIDENTIAL 1. State-less approach - you have a conditional that chooses different behavior depending on … 2. Solution to simplify the project – refactoring β€œReplace Conditional with Polymorphism” 3. Polymorphism = object = State-full approach Rationale β€œbusiness” limitations - Static
  • 25. 25CONFIDENTIAL 1. β€œFrom refactoring to Patterns” – There is a set of specific Design Patterns 2. The trickiest part – find a balance for your project now and update point of balance in time Rationale β€œbusiness” limitations - Static
  • 26. 26CONFIDENTIAL 1. Relatively simple business logic due to Domain 2. Relatively simple business logic due to System size (hundreds test-cases) 3. Not so many β€œcontexts” – Browser versions – Environments – Customers with a tiny nuances of functionality – Platforms (cross-browser Web plus cross-platform Mobile) Compare β€œbusiness” limitations - Dynamic
  • 27. 27CONFIDENTIAL 1. State-full approach - you have a set of objects classes, which developed, possibly, using several Design Patterns to implement necessary functionality – to choose different behavior depending on … 2. Solution to simplify the project – refactoring β€œReplace Polymorphism with Conditional” 3. Polymorphism ~= object ~= State-full approach 4. No Polymorphism ~= no objects ~= State-less approach Rationale β€œbusiness” limitations - Dynamic
  • 28. 28CONFIDENTIAL 1. β€œFrom Patterns to refactoring” – There is no need to use a set of specific Design Patterns 2. The trickiest part – find a balance for your project now and update point of balance in time Rationale β€œbusiness” limitations - Dynamic
  • 29. 29CONFIDENTIAL Find and β€œupdate” a balance for your own project
  • 31. 31CONFIDENTIAL Page Factory - definition 1. Page Factory is an inbuilt page object model concept for Selenium WebDriver but it is very optimized. 2. We use initElements method to initialize web elements 3. Additionally with the help of PageFactory class - use annotations @FindBy to find WebElement. 4. @FindBy can accept as attributes: 1. tagName 2. name 3. partialLinkText 4. linkText 5. Id 6. Css 7. className 8. Xpath
  • 32. 32CONFIDENTIAL Page Factory - notes 1. If you use the PageFactory, you can assume that the fields are initialized. If you don't use the PageFactory, then NullPointerExceptions will be thrown if you make the assumption that the fields are already initialized. 2. List<WebElement> fields are decorated if and only if they have @FindBy or @FindBys annotation. Default search strategy "by id or name" that works for WebElement fields is hardly suitable for lists because it is rare to have several elements with the same id or name on a page.
  • 33. 33CONFIDENTIAL Page Factory - notes 1. WebElements are evaluated lazily. That is, if you never use a WebElement field in a PageObject, there will never be a call to "findElement" for it. 2. The functionality works using dynamic proxies. This means that you shouldn't expect a WebElement to be a particular subclass, even if you know the type of the driver. For example, if you are using the HtmlUnitDriver, you shouldn't expect the WebElement field to be initialized with an instance of HtmlUnitWebElement.
  • 34. 34CONFIDENTIAL Login Page 1.public class LoginPage { 2. private WebDriver driver; 3. @FindBy(id = "id_username") 4. private WebElement usernameInput; 5. @FindBy(id = "id_password") 6. private WebElement passwordInput; 7. @FindBy(id = "main_action_form_button") 8. private WebElement loginButton; 9.}
  • 35. 35CONFIDENTIAL Login Page 1. public class LoginPage { 2. public LoginPage(WebDriver driver) { 3. this.driver = driver; 4. PageFactory.initElements(driver, this); 5. } 6. public void login(String username, String password) { 7. usernameInput.sendKeys(username); 8. passwordInput.sendKeys(password); 9. loginButton.click(); 10. } 11.}
  • 36. 36CONFIDENTIAL Home Page 1. public class HomePage { 2. private WebDriver driver; 3. @FindBy(css = "a[href*="login"]") 4. private WebElement loginButton; 5. public HomePage(WebDriver driver) { 6. this.driver = driver; 7. PageFactory.initElements(driver, this); 8. } 9. }
  • 37. 37CONFIDENTIAL Home Page 1. public class HomePage { 2. public void login() { 3. login(Creds.username, Creds.password);} 4. private LoginPage clickLoginButton() { 5. loginButton.click(); 6. return new LoginPage(driver);} 7. private void login(String username, String password) { 8. LoginPage loginPage = clickLoginButton(); 9. loginPage.login(username, password);
  • 38. 38CONFIDENTIAL Login test 1. public class LoginTest { 2. private WebDriver driver; 3. @BeforeMethod 4. public void setup() { 5. driver = new FirefoxDriver(); 6. driver.manage().window().maximize(); 7. driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); 8. driver.get("https://www.pandadoc.com/");} 9. @AfterMethod 10. public void teardown() { 11. driver.close();}}
  • 39. 39CONFIDENTIAL Login test 1. public class LoginTest { 2. private void assertSignedUp() { 3. new WebDriverWait(driver, 30000).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(" .header-avatar")));} 4. @Test 5. public void loginTest() { 6. HomePage homePage = new HomePage(driver); 7. homePage.login(); 8. assertSignedUp();}}
  • 40. 40CONFIDENTIAL Implementation is based on β€’ Reflection β€’ Annotation β€’ Templates
  • 41. 41CONFIDENTIAL Page Factory from Selenium library - info 1. Page Object Model and Page Factory 2. Page Factory detailed desription 3. Page Object (Page Factory context) 4. AjaxElementLocatorFactory (obsolete) 5. Source code example 6. PageFactory.java (source code) 7. Book with a brief summary of Selenium WebDriver plus Java bindings (Ru only)
  • 42. 42CONFIDENTIAL HMTL Elements framework from Yandex 1. Designed to provide easy-to-use way of interaction with web-page elements in your tests. 2. It may be considered as an extension of WebDriver Page Object (PageFactory). 3. With the help of Html Elements framework you can group web-page elements into blocks (Logical Pages), encapsulate logic of interaction with them and then easily use created blocks in page objects (Physical Pages).
  • 43. 43CONFIDENTIAL HMTL Element framework from Yandex 1. Dividing page on blocks using @Block annotation 2. Separating different types of elements (button, checkbox) 3. Provides an ability to annotate methods as steps – annotation @Step for work in step-based style 4. Provides a set of helpful matchers to use with web-page elements and blocks
  • 44. 44CONFIDENTIAL Login Page 1. public class LoginPage { 2. private WebDriver driver; 3. @FindBy(id = "id_username") 4. private static TextInput usernameInput; 5. @FindBy(id = "id_password") 6. private static TextInput passwordInput; 7. @FindBy(id = "main_action_form_button") 8. private static Button loginButton; 9. }
  • 45. 45CONFIDENTIAL Login Page 1. public class LoginPage { 2. public LoginPage(WebDriver driver) { 3. this.driver = driver; 4. HtmlElementLoader.populatePageObject(this, driver); 5. } 6. public void login(String username, String password) { 7. usernameInput.sendKeys(username); 8. passwordInput.sendKeys(password); 9. loginButton.click(); 10. } 11.}
  • 46. 46CONFIDENTIAL Home Page 1. public class HomePage { 2. private WebDriver driver; 3. @FindBy(css = "a[href*="login"]") 4. private static Button loginButton; 5. public HomePage(WebDriver driver) { 6. this.driver = driver; 7. HtmlElementLoader.populatePageObject(this, driver); 8. } 9. }
  • 47. 47CONFIDENTIAL Home Page 1. public class HomePage { 2. public void login() { 3. login(Creds.username, Creds.password); } 4. private LoginPage clickLoginButton() { 5. loginButton.click(); 6. return new LoginPage(driver); } 7. private void login(String username, String password) { 8. LoginPage loginPage = clickLoginButton(); 9. loginPage.login(username, password);}}
  • 48. 48CONFIDENTIAL Login test 1. public class LoginTest { 2. private WebDriver driver; 3. @BeforeMethod 4. public void setup() { 5. driver = new FirefoxDriver(); 6. driver.manage().window().maximize(); 7. driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); 8. driver.get("https://www.pandadoc.com/"); } 9. @AfterMethod 10. public void teardown() { 11. driver.close(); }}
  • 49. 49CONFIDENTIAL Login test 1. public class LoginTest { 2. private WebDriver driver; 3. private void assertSignedUp() { 4. new WebDriverWait(driver, 30000).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(" .header-avatar"))); } 5. @Test 6. public void loginTest() { 7. HomePage homePage = new HomePage(driver); 8. homePage.login(); 9. assertSignedUp(); }}
  • 50. 50CONFIDENTIAL Implementation is based on β€’ Reflection β€’ Annotation β€’ Templates
  • 51. 51CONFIDENTIAL HMTL Elements framework from Yandex - info 1. Official site of the tool 2. Examples 3. Source code example 4. Book with a brief summary of Selenium WebDriver plus Java bindings (Ru only)
  • 52. 52CONFIDENTIAL Selenide Selenide is a wrapper for Selenium Webdriver, oriented, as Geb, on fast and laconic automation but using Java. Just focus on your business logic and let Selenide do the rest! Main advantages of that tool: 1. Concise fluent API for tests 2. True Page Objects
  • 53. 53CONFIDENTIAL Selenide 1. Webdriver access 2. jQuery style selectors 3. Ajax support for stable tests 4. Auto-start and browser destructions 5. You don't need to think how to shutdown browser, handle timeouts and StaleElement Exceptions or search for relevant log lines, debugging your tests.
  • 54. 54CONFIDENTIAL Login Page 1. public class LoginPage { 2. private static final By USERNAME_INPUT = By.id("id_username"); 3. private static final By PASSWORD_INPUT = By.id("id_password"); 4. private static final By LOGIN_BUTTON = By.id("main_action_form_button"); 5. public void login(String username, String password) { 6. $(USERNAME_INPUT).val(username); 7. $(PASSWORD_INPUT).val(password); 8. $(LOGIN_BUTTON).click(); 9. }}
  • 56. 56CONFIDENTIAL Home Page 1. public class HomePage { 2. private static final By LOGIN_BUTTON = By.cssSelector("a[href*="login"]"); 3. public void login() { 4. login(Creds.username, Creds.password); } 5. private LoginPage clickLoginButton() { 6. $(LOGIN_BUTTON).click(); 7. return page(LoginPage.class);} 8. private void login(String username, String password) { 9. LoginPage loginPage = clickLoginButton(); 10. loginPage.login(username, password); }}
  • 57. 57CONFIDENTIAL Home Page Source code – where …?
  • 58. 58CONFIDENTIAL Login test public class LoginTest { private HomePage homePage; private void assertSignedUp() { $(By.cssSelector(".header-avatar")).waitUntil(Condition.visible, 30000); } @BeforeMethod public void setup() { Configuration.timeout = 10000; homePage = open("https://www.pandadoc.com/", HomePage.class); } @Test public void loginTest() { homePage.login(); assertSignedUp(); } }
  • 60. 60CONFIDENTIAL Implementation is based on β€’ Reflection β€’ Annotation β€’ Templates
  • 61. 61CONFIDENTIAL Selenide - info 1. Official site of the tool 2. Examples 3. Source code example 4. Book with a brief summary of Selenium WebDriver plus Java bindings (Ru only)
  • 62. 62CONFIDENTIAL GDI – from EPAM Systems JDI Goals 1. Accumulate best practices of UI automation (open source, page objects, logging, parallelism etc.) 2. Multiplatform framework 3. Intuitive test framework 4. Stable framework 5. Flexible framework
  • 63. 63CONFIDENTIAL GDI features β€’ Interfaces based elements β€’ Complex UI Objects β€’ Simple + Complex UI elements + standard Forms = 31 β€’ Cascade UI Objects Initialization β€’ Multiplatform β€’ Logging for all actions β€’ Stabilization mechanism β€’ Wide Customization abilities β€’ Module-based architecture β€’ Parallel test runs support
  • 64. 64CONFIDENTIAL PageObject β€œinfrastructure” UI Objects – UI elements for Web (Button, Label, Table…) – IU elements for other platforms (any UI) – β€œStandard” PageObjects β€’ Form β€’ Search β€’ Pagination β€’ Login β€’ others Page Objects – UI elements – Actions with UI elements
  • 65. 65CONFIDENTIAL Simple UI Elements – 10 1. Text 2. Button/Label 3. Link 4. Image 5. Checkbox 6. TextField 7. DatePicker 8. FileInput 9. TextArea 10. And others :)
  • 66. 66CONFIDENTIAL Complex UI Elements – 12 β€’ Selector β€’ RadioButtons β€’ Dropdown β€’ Tabs/Menu β€’ CheckList β€’ DropList β€’ ComboBox β€’ TextList β€’ Table β€’ Tree β€’ Range β€’ And others :)
  • 67. 67CONFIDENTIAL Standard Pages - 9 β€’ Page β€’ Section β€’ Form β€’ Pop β€’ PopupForm β€’ Search β€’ Pagination β€’ NavigationPane
  • 68. 68CONFIDENTIAL PageObject std example, 1 (GDI) @JPage(url = "http://www.epam.com") public class JacketPage extends WebPage { @FindBy(css=β€œsomeSelector") public Menu menu; @FindBy(css="someSelector") public CheckList sizes; @FindBy(css=" someSelector") public Button searchButton; @FindBy(css=" someSelector") public Table results; }
  • 69. 69CONFIDENTIAL Test std example, 1 (GDI) 1. @Test 2. public void menuTest() { 3. menu.select("Man"); 4. sizes.check("M", "L"); 5. searchButton.click(); 6. Assert.areEquals(results.rows().count(), 4); 7. Assert.isNotEmpty(results.row("Best Jacket", column("Title"))); 8. }
  • 70. 70CONFIDENTIAL PageObject std example, 1 (Selenium) public class JacketPage { @FindBy(css="") public List<WebElement> menuElements; @FindBy(css="") public WebElement menuIsSelected; @FindBy(css="") public List<WebElement> sizesElements; @FindBy(css="") public WebElement sizesIsChecked; @FindBy(css="") public List<WebElement> sizesLabels; @FindBy(css="") public WebElement searchButton; @FindBy(css="") public List<WebElement> resultsColumnHeaders; @FindBy(css="") public List<WebElement> resultsRowsHeaders; @FindBy(css="") public List<WebElement>resultsCellsHeaders; @FindBy(css="") public List<WebElement> resultsColumn; @FindBy(css="") public List<WebElement> resultsRow; … }
  • 71. 71CONFIDENTIAL PageObject std example, 1 (Selenium) public class JacketPage { @FindBy(css="") public List<WebElement> menuElements; ... @FindBy(css="") public List<WebElement> resultsRow; public void selectElementFromMenu(String name) { … } public String getSelectedMenuItem() { … } public boolean isMenuItemSelected(String name) { … } public void selectElementFromMenu(String name) { … } … public int getResultsCount() { … } public boolean isResultPresent(String name) { … } public WebElement getSomeAttributeForResult(String name) { … } … public List<WebElement> findAllResultsMatch(String name) { … } }
  • 72. 72CONFIDENTIAL PageObject std example, 2 (GDI) 1. @JPage(url = "/login", title = "EPAM - Login page") 2. public class LoginPage extends PageForm { 3. @FindBy(css = β€œ.login”) private ITextField login; 4. @FindBy(css = β€œ.password”) private ITextField password; 5. @FindBy(css = β€œ.loginButton”) private IButton loginButton; 6. }
  • 73. 73CONFIDENTIAL Test std sexample, 2 (GDI) 1. @Test 2. public void exampleTest(String searchText) { 3. loginPage.login(client); 4. searchPage.search(searchText); 5. resultsPage.results.eachContains(searchText); 6. resultsPage.openFirstResult(); 7. productPage.check.productHasNoEmptyData(); 8. }
  • 74. 74CONFIDENTIAL Test std example, 3 (GDI) @Test public void shopTest() { loginPage.open(); loginForm.login(new User(β€œuser", "password")); search.find("best jacket"); productForm.submit(Products.TestJacket); pagination.next(); pagination.selectPage(5); }
  • 75. 75CONFIDENTIAL PageObject std example, 4 (GDI, β€œmodel” based) 1. public class LoginForm extends Form<User> { 2. @FindBy(css=β€œsomeLocator") 3. public TextField name; 4. @FindBy(css=β€œsomeLocator") 5. public TextField password; 6. @FindBy(css=β€œsomeLocator") 7. public Button loginButton; 8. }
  • 76. 76CONFIDENTIAL PageObject std example, 4 (GDI , β€œmodel” based) public class User { public String name; public String password; public User(String name, String password) { this.name = name; this.password = password; } }
  • 77. 77CONFIDENTIAL PageObject std example, 5 (GDI) 1. @JSite(domain = "https://www.epam.com") 2. public class EpamSite extends WebSite { 3. @JPage(url = "/") 4. public static HomePage homePage; 5. @JPage(url = "/careers", title = "Careers") 6. public static CareerPage careerPage; 7. @JPage(url = "/careers/job-listings", title = "Job Listings", 8. urlCheckType = CONTAIN, titleCheckType = CONTAIN) 9. public static JobPage jobPage; 10.... 11.} WebSite.init(EpamSite.class);
  • 78. 78CONFIDENTIAL β€œForms” Page Object (GDI) 1. public class AddCVForm extends Form<Attendee> { 2. @FindBy(css = β€œ.first-nameβ€œ) private ITextField name; 3. @FindBy(css = β€œ.last-nameβ€œ) private ITextField lastName; 4. @FindBy(css = β€œ.emailβ€œ) private ITextField email; 5. @FindBy(css = β€œ.file-uploadβ€œ) private RFileInput cv; 6. @FindBy(css = β€œ.comment-inputβ€œ) private ITextArea comment; 7. @FindBy(xpath = β€œ//*[.='Submit']β€œ) private IButton submit; 8. @FindBy(xpath = β€œ//*[.='Cancel']β€œ) private IButton cancel; 9. }
  • 79. 79CONFIDENTIAL Entities driven testing (GDI) @Test(dataProvider = β€œattendees”) public void menuTest(Attendee attendee) { searchFilter.fill(attendee); checkSuggestionsContains(attendee); searchFilter.search(attendee); assertEquals(results.rows().count(), 1); results.row(attendee.name, column(β€œName”)) addCVForm.submit(attendee.cv); checkCVInDB(attendee.cv); previewForm.verify(attendee); }
  • 80. 80CONFIDENTIAL Java examples public class HomePage extends WebPage { @FindBy(css="div.tabs-ui[data-path*= '/content/epam/en/jcr:content/content_container/ section_4/section-par/tabs']") public EpamCoreSection epamCoreSection; }
  • 81. 81CONFIDENTIAL Java examples public class EpamCoreSection extends Section { @FindBy(css="div.tab-1>div.text>div.text-ui >p>span.font-size-26") public Text whoWeAreText; @FindBy(css="div.tab-2>div.text>div.text-ui >p>span.font-size-26") public Text whatWeDoText; @FindBy(css="div.tab-3>div.text>div.text-ui >p>span.font-size-26") public Text whoWeServeText; @FindBy(xpath="//div[.='Who we serve']") public Button whoWeServe; @FindBy(xpath="//div[.='Who we are']") public Button whoWeAre; @FindBy(xpath="//div[.='What we do']") public Button whatWeDo; }
  • 82. 82CONFIDENTIAL Java examples @Test public void presentationSimpleTest() { homePage.checkOpened(); homePage.epamCoreSection.whoWeAre.highlight(); homePage.epamCoreSection.whoWeAreText.highlight(); new Check("Tab text").areEquals("" + "We are more than developers. We are the experts that will take your business into the digital future.", homePage.epamCoreSection.whoWeAreText.getText()); homePage.epamCoreSection.highlight(); homePage.epamCoreSection.whoWeServe.highlight(); homePage.epamCoreSection.whoWeServe.click(); }
  • 83. 83CONFIDENTIAL Java examples @Test public void presentationComplexTest() { homePage.checkOpened(); textToTest(HomeTabs.WHATWEDO, homePage.epamCoreSection); textToTest(HomeTabs.WHOWEARE, homePage.epamCoreSection); textToTest(HomeTabs.WHOWESERVE, homePage.epamCoreSection); }
  • 84. 84CONFIDENTIAL Java examples public void textToTest(HomeTabs tab, EpamCoreSection epamCoreSection){ switch (tab) { case WHOWEARE: chooseTab(epamCoreSection.whoWeAre, epamCoreSection.whoWeAreText, HomeTabsTextToCheck.WHOWEARE); break; case WHATWEDO: chooseTab(epamCoreSection.whatWeDo, epamCoreSection.whatWeDoText, HomeTabsTextToCheck.WHATWEDO); break; case WHOWESERVE: chooseTab(epamCoreSection.whoWeServe, epamCoreSection.whoWeServeText, HomeTabsTextToCheck.WHOWESERVE); break; } }
  • 85. 85CONFIDENTIAL Java examples public void chooseTab(Button tab, Text text, String textToCheck){ tab.highlight(); tab.click(); text.highlight(); new Check("Tab text").areEquals(textToCheck, text.getText()); }
  • 86. 86CONFIDENTIAL Java examples public static class HomeTabsTextToCheck { public static final String WHOWEARE="We are more than developers." + " We are the experts that will take your business into the digital future."; public final static String WHATWEDO="We transform businesses through the art of digitization." + " Our expertise spans multiple disciplines," + " providing our clients with software solutions that dramatically drive results and outcomes."; public final static String WHOWESERVE="The right technology translates business strategies into results." + " We deliver domain-specific, transformative software solutions that reshape the way you do business."; }
  • 87. 87CONFIDENTIAL Customization 1. Customize method’s behavior 2. Customize element’s behavior 3. Customize all objects behavior 4. Develop new UI element 5. Modules 1. Logger 2. Asserter 3. Driver 4. etc.
  • 90. 90CONFIDENTIAL Implementation is based on Implementation is based on … what? Let’s: β€’ download source code β€’ familiarize β€’ investigate β€’ develop a tiny prototype β€’ try to use β€’ try to improve (for example, add Decorator DP based features) β€’ welcome to QA Automation tools development β€’ welcome to Open Source
  • 91. 91CONFIDENTIAL JDI - info β€’ http://jdi.epam.com/ β€’ http://jdi.epam.com/download β€’ https://github.com/epam/JDI/tree/master/Java/Tests β€’ https://github.com/epam/JDI/tree/master/Java β€’ https://github.com/epam/JDI/tree/master/C%23.Net/Tests β€’ https://github.com/epam/JDI/tree/master/C%23.Net β€’ IT-Saturday video (Ru only) β€’ β€œJDI - EPAM Framework (IT-Subbotnik, with listings).pptx” (RU) β€’ β€œJDI - QA Conf 2016.pptx” (Ru) β€’ β€œJDI – Secon 2016.pptx” (EN)
  • 92. 92CONFIDENTIAL Serenity (ex. Thucydides) 1. Serenity (Thucydides) – is an open-source tool, oriented on effective acceptance testing and detailed documentation and reports of the project. 2. It works with Junit and BDD tools like JBehave and Cucumber-JVM, and gives a wide API for automated testing with integrity with Selenium Webdriver. 3. It is made for the following tasks: β€’ Creating more flexible tests, which are easier to be supported β€’ Getting illustrated story-based reports β€’ Clear context of connection between tests and requirements β€’ Measurement of requirements coverage.
  • 93. 93CONFIDENTIAL Serenity (ex. Thucydides) workflow β€’ Step 1: Defining requirement and acceptance criteria It starts from requirements, which are need to be tested. For every requirement there is an acceptance criteria which describing the requirement better. Thucydides automate acceptance criteria β€’ Step 2: Modelling the requirements With the help of Thucydides you create a simple model of requirements made on Java language. There are some ways of modelling requirements, including simple Java class, using convention and structure of directories of integrating with other tools like Jira. That approach allows the developer what requirement is tested each of the test, and give Thucydides the ability to track testing features and requirements
  • 94. 94CONFIDENTIAL Serenity (ex. Thucydides) workflow β€’ Step 3: Automation of acceptance testing Next is describing acceptance criteria by business language is following, and automation engineers implement them using BDD such as jBehave or Cucumber-JVM, or using Java and Junit, in order for Thucydides to run it with β€œpending” status (body is not implemented) β€’ Step 4: Test implementation Automation Engineers now can implement acceptance criteria in a form of real-time AUT test. Tests can be divided into steps for better readability and easiness of support. Webdriver is used for testing.
  • 95. 95CONFIDENTIAL Serenity (ex. Thucydides) workflow β€’ Step 5: Test results report Thucydides allow you to create detailed test reports about test runs, including: History for ach test Screenshot for each test step Result of test run including time and error messages β€’ Step 6: Requirements coverage report Besides test run reports, Thucideds also provide information about: Number of tested requirements Number of passed requirements Number of requirements which need to be run
  • 96. 96CONFIDENTIAL Serenity (ex. Thucydides) workflow β€’ Step 7: Project progress report Thucydides provide information about project history progress: Change in number of features implemented in time Change in quantity of implemented and tested features in time Change of failed tests in time β€’ Summary As we can see, Thucydides is a rather complex tool, build around BDD concept and acceptance testing, using Webdriver for testing web applications. β€’ Info Official website Official documentation
  • 97. 97CONFIDENTIAL Page Object And what about Page Object supports …?
  • 98. 98CONFIDENTIAL Page Object β€œdefault” implementation Framework implements Page Object pattern and let’s you decrease code duplication another one type of classes between tests and pages, called β€œsteps”. Let’s look at β€œsteps” with page object class: 1. public class StepsinBook extends ScenarioSteps { 2. public StepsinBook(Pages pages) { 3. super(pages); 4. } 5. public BookPage getPageBook() 6. { 7. return getPages().currentPageAt(BookPage.class); 8. } 9. }
  • 99. 99CONFIDENTIAL Page Object β€œdefault” implementation 1. public class StepsinBook extends ScenarioSteps { 2. @Step public void getMain(String url) 3. { 4. getPageBook().getMainPage(url); 5. } 6. @Step public void AllBooks() 7. { 8. getPageBook().allBooks(); 9. } 10. @Step public void search(){ 11. getPageBook().search(β€œBook"); 12. } 13. @Step public void catalog(){ 14. getPageBook().catalog(); 15. }}
  • 100. 100CONFIDENTIAL Page Object β€œdefault” implementation 1. public class BookPage extends PageObject { 2. @FindBy(linkText = β€œAll books") 3. WebElement allbooksButton; 4. @FindBy(linkText = β€œSearch") 5. WebElement searchButton; 6. @FindBy(name = "query") 7. WebElement searchField; 8. @FindBy(css = "button") 9. WebElement searchBegin; 10. }
  • 101. 101CONFIDENTIAL Page Object β€œdefault” implementation 1. public class BookPage extends PageObject { 2. public BookPage(WebDriver driver) { 3. super(driver); 4. } 5. public void getMainPage(String url) { 6. getDriver().get(url); 7. } 8. public void allBooks() { 9. allbooksButton.click(); 10. } 11. public void search(String searchWord) { 12. searchButton.click(); 13. searchField.sendKeys(searchWord); 14. searchBegin.click(); 15. } 16. }
  • 102. 102CONFIDENTIAL Implementation is based on β€’ Reflection β€’ Annotation β€’ Templates
  • 103. 103CONFIDENTIAL Geb – general info 1. Tool for browser automation, made on Groovy (JVM-based) and based on Selenium Webdriver. 2. It using: 1. Selenium for browser automation 2. jQuery selectors for locating elements 3. Page object pattern . 3. In the bounds of testing it can be easily integrated with different test frameworks like: 1. Junit 2. TestNG 3. Spock
  • 104. 104CONFIDENTIAL Geb – general info If to compare with Webdriver API, Geb provides more comfortable interface in the following areas: β€’ Working with Webdriver instance (creating, configuration, moves, destruction) β€’ Locating elements (jQuery locators) β€’ Page object pattern β€’ Waiters β€’ Page interactions β€’ Work with AJAX elements β€’ Integration with build-tools (maven, gradle, grails) β€’ Integration with cloud services (Sauce labs, Browser Stack) Official website Official documentation
  • 105. 105CONFIDENTIAL Geb - example 1. import geb.Browser 2. Browser.drive { 3. go "http://myapp.com/login" 4. assert $("h1").text() == "Please Login" 5. $("form.login").with { 6. username = "admin" 7. password = "password" 8. login().click() 9. } 10. assert $("h1").text() == "Admin Section" 11.}
  • 106. 106CONFIDENTIAL SWD Page Recorder 1. SWD Page Recorder helps you to create locators of web-page, debug them in the application and generate PageObject code for classes on C#, Java, Python, Ruby, Perl for using them in Selenium Webdriver tests. 2. That tool not only lets you find locator needed, but also optimize it and generate all the code needed for further element declaration in the code. 3. SWD Page Recorder is a unified tool for working with locators in every browser which are supported by Selenium. 4. Important moment that Page Recorder tests the selectors using Webdriver – so you’re not going to have cases when locator find other way will not work in Webdriver.
  • 107. 107CONFIDENTIAL SWD Page Recorder Sources, documentation and so on
  • 108. 108CONFIDENTIAL How to select an appropriate solution?
  • 109. 109CONFIDENTIAL 1. Business context 2. Tech context – Challenge – Solution – Technology Stack 3. QA Automation process context 4. Source code example 5. Summary A real-life example
  • 110. 110CONFIDENTIAL 1. Example and β€œhome work” – How to setting up environment β€’ This is task 0  – Where to download (https://github.com/comaqaby/Patterns/tree/master/C%23) – How to build – How to configure – How to run Example
  • 111. 111CONFIDENTIAL 1. Download example’ source code (for each β€œsolution”) 2. β€œInvestigate” 3. Develop a TODO list with a set of improvements 4. Setting up environment 5. Compile and Run 6. β€œPlay” 7. Improve Update TODO list with a set of improvements β€œHomework”, part 1 
  • 112. 112CONFIDENTIAL 1. Read recommended books and articles 2. Improve Update TODO list with a set of improvements 3. Provide me via email with an intermediate and final list of improvements 4. Develop at least 1 more auto-test (for each β€œsolution”) 5. Develop a set of metrics to β€œcompare” solutions 6. Develop an algorithm β€œHow to select a proper solution” 7. Provide me via email with a set of metrics + algorithm 8. Next iteration  β€œHomework”, part 2 
  • 113. 113CONFIDENTIAL 1. Play with GDI β€œattentively” 2. Join QA Automation tools development 3. Join Open Source β€œworld” β€œHomework”, part 3 
  • 114. 114CONFIDENTIAL 1. Could you please β€œrefresh” your theoretical knowledge, slides 1-31, thanks β€œRules” and principles
  • 115. 115CONFIDENTIAL 1. Martin Fowler β€œRefactoring” – http://martinfowler.com/books/refactoring.html – http://refactoring.com/ – http://refactoring.com/catalog/ – http://refactoring.com/catalog/replaceConditionalWithPolymorphism.html Useful links
  • 116. 116CONFIDENTIAL 1. Refactoring to Patterns and vice versa – https://industriallogic.com/xp/refactoring/ – https://industriallogic.com/xp/refactoring/catalog.html – https://industriallogic.com/xp/refactoring/conditionDispatcherWithCommand.html – https://industriallogic.com/xp/refactoring/conditionalWithStrategy.html – http://martinfowler.com/books/r2p.html Useful links
  • 117. 117CONFIDENTIAL 1. https://sourcemaking.com/ – https://sourcemaking.com/refactoring – https://sourcemaking.com/refactoring/replace-conditional-with-polymorphism – https://sourcemaking.com/design_patterns – https://sourcemaking.com/antipatterns β€’ https://sourcemaking.com/antipatterns/software-development-antipatterns β€’ https://sourcemaking.com/antipatterns/software-architecture-antipatterns – https://sourcemaking.com/uml Useful links
  • 118. 118CONFIDENTIAL Tech β€œbasement” β€’ Grady Butch Β«Object oriented analysis and design with examples of apps on C++ Notes: IMHO No need to be afraid of C++, 95% of the material is conceptual, there is no strict connection to chosen language. From my point of view is one of the best books for true getting to know with OOP. β€’ Martin Fowler Β«RefactoringΒ» Notes: IMHO strongly recommend to read from cover to cover, twice, in order to have contents of the book – you active professional luggage. β€’ Gang of four β€œDesign patterns” Notes: IMHO strongly recommend to read from cover to cover, twice, in order to have contents of the book – you active professional luggage.
  • 119. 119CONFIDENTIAL Tech β€œbasement” β€’ D. Thomas, Andrew Hunt β€œPragmatic Programmer, The: From Journeyman to Master” Notes: IMHO Amazing book that consists of a ton of advices. IMHO strongly recommend to read from cover to cover, twice, in order to have contents of the book – you active professional luggage. And then look through different chapters before talking to a customer. β€’ Steve McConnel β€œCode complete” Notes: IMHO No need to be afraid of the size of the book ... it should be read or before β€œgoing to bed”, or from any place, of separate chapters, just to fresh things in the memory in the chosen f ield of problem.
  • 120. 120CONFIDENTIAL What’s next?! β€’ β€œOut of box Page Object Design Pattern, Java” β€’ Dynamic solutions β€’ Let’s compare with a static one β€’ β€œOut of box Page Object Design Pattern, .Net C#” β€’ Dynamic solutions β€’ Let’s compare with a static one Summary: 5/12 - Webinar, 5/13 – send all necessary materials β€’ β€œVariants of implementation Page Object Design Pattern from the scratches, without being bind to any programming language” β€’ Static solutions β€’ Dynamic solutions β€’ Let’s compare static and dynamic β€’ Answer to all our questions Summary: 5/19 - Webinar, 5/19 – send all necessary materials
  • 121. 121CONFIDENTIAL [email protected] Skype - semenchenko_anton_v +375 33 33 46 120 +375 44 74 00 385 https://www.linkedin.com/in/anton-semenchenko-612a926b https://www.facebook.com/semenchenko.anton.v https://twitter.com/comaqa www.comaqa.by www.corehard.by
  • 122. 122CONFIDENTIAL Thanks for your attention Anton Semenchenko EPAM Systems www.comaqa.by www.corehard.by