Skip to content

xscofild/QA76_PhonebookGUI

Repository files navigation

📞 QA76_PhonebookGUI

UI test automation framework for the Phonebook web app — built with Selenium WebDriver, TestNG, and a custom ApplicationManager-based framework.

Goes beyond classic POM with a single entry-point pattern, multi-browser support, screenshot-on-failure, and TestNG groups.


🎯 What's Covered

Feature Tests
Authentication Login (positive, negative — wrong password, empty fields)
Account Creation Registration with random emails, validation errors
Contact Management Add contact (positive + negative validation), delete contact
Home Page Navigation, logout, contact list display

🧰 Tech Stack

  • Java 17
  • Selenium WebDriver 4.41.0
  • WebDriverManager 6.3.3 — automatic driver binary management
  • TestNG 7.12.0 — annotations, groups, XML suites, DataProvider
  • Logback — structured logging
  • Gradle — build & multi-suite execution

🏗️ Framework Architecture

src/test/java/homeworks/lesson22/
├── core/
│   ├── TestBase.java               # @BeforeSuite / @AfterSuite, SoftAssert, Logger
│   ├── ApplicationManager.java     # Entry point — owns WebDriver + Helpers
│   └── BaseHelper.java             # Common element interactions
├── fw/                             # Framework layer (helpers)
│   ├── UserHelper.java             # Login, registration, logout
│   ├── ContactHelper.java          # Add, delete, search contacts
│   └── HomePageHelper.java         # Navigation, page state
├── models/                         # Domain objects
│   ├── HW22User.java
│   └── HW22Contact.java
├── data/                           # Test data providers
│   ├── HW22UserData.java
│   └── HW22ContactData.java
└── tests/
    ├── HW22LoginTests.java
    ├── HW22CreateAccountTests.java
    ├── HW22AddContactTests.java
    ├── HW22AddContactNegativeTests.java
    ├── HW22DeleteContactTests.java
    └── HW22HomePageTests.java

🔑 Key Patterns

ApplicationManager — single source of truth

Tests never touch WebDriver directly. They go through ApplicationManager:

public class LoginTests extends TestBase {
    @Test
    public void loginPositiveTest() {
        app.getUser().login(validUser);
        Assert.assertTrue(app.getHomePage().isLoggedIn());
    }
}

Multi-browser support via system property

./gradlew test -Pbrowser=chrome
./gradlew test -Pbrowser=firefox

Default: Chrome. Implementation in ApplicationManager.init().

Screenshot on failure

TestBase.@AfterMethod catches ITestResult. On failure → takes screenshot via ContactHelper.takeScreenshot() and logs the path.

TestNG groups

Tests are tagged with groups = {"smoky", "regression"} — allows selective execution:

./gradlew test -Pgroups=smoky

Random data generation

ApplicationManager.getRandomEmail() generates unique emails for registration tests (avoids "user exists" conflicts across runs).


🚀 How to Run

Prerequisites

  • Java 17+
  • Gradle (or use included wrapper)
  • Phonebook backend running (see QA76m_PhonebookAPI for the API)

Run all tests

./gradlew test

Run with Firefox

./gradlew test -Pbrowser=firefox

Run a TestNG suite

./gradlew test -Psuite=src/test/resources/suites/smoky.xml

📝 Notes

  • Tests target the Telran Phonebook training app — a public QA training site.
  • homeworks/lesson22/ prefix reflects course-based iterations — the framework was incrementally built across multiple lessons.
  • Lifecycle: @BeforeSuite opens browser once for the entire run → @AfterSuite closes. Tests share one browser session to save startup time.

🎓 Author

Serdar Kerimovgithub.com/xscofild · LinkedIn QA Engineer | Java · Selenium · REST Assured · SQL

About

Phonebook UI automation framework with Selenium, TestNG, ApplicationManager and test groups.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors