Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Automation & API Testing Project

A complete end-to-end software testing framework that combines UI automation πŸ–₯️ and REST API testing ⚑ into a single, maintainable Java project. Built around the public demo site AutomationExercise.com, it mirrors that site's own published test-case catalogue (TC01–TC36) with real Selenium/TestNG and REST Assured coverage, complete Allure traceability, and Jira/Zephyr-style test-case linking β€” making it a solid reference for QA engineers building production-grade automation suites.

▢️ Watch the Full Project Demo β€” see the framework, UI test execution, API testing, and generated reports in action.

✨ Key Features

  • 35+ UI Test Cases Mapped to Real Scenarios πŸ§ͺ β€” Every test method (TC01…TC36) corresponds 1:1 to a published test case on AutomationExercise.com's own test-case page, annotated with @Link/@TmsLink back to the source scenario.
  • 14 REST Assured API Test Cases πŸ“‘ β€” Covers productsList, brandsList, searchProduct, verifyLogin, createAccount, updateAccount, deleteAccount, and getUserDetailByEmail, including disallowed-method checks (405), missing-parameter checks (400), and a full create β†’ fetch β†’ update β†’ delete account lifecycle.
  • Page Object Model (POM) πŸ—οΈ β€” Nine page classes (HomePage, LoginPage, SignupPage, ProductsPage, SingleProductPage, CartPage, CheckoutPage, PaymentPage, ConatctusPage) share a common Framework base with 30+ reusable Selenium wrappers (waits, dropdowns, alerts, drag-and-drop, window switching, screenshots).
  • Data-Driven Testing πŸ“Š β€” User credentials, page URLs, checkout/payment details, and contact-form data are all externalized as JSON (SignupData.JSON, CreateAccount.JSON, PagesUrl.JSON, Payment.JSON, Contactus.JSON, ReviewData.JSON) and parsed with Gson into POJOs.
  • Configurable Test Environments βš™οΈ β€” A single config.properties, read through ConfigReader, controls the browser, base URL, wait timings, and headless mode without touching test code.
  • Multi-Browser Support 🌐 β€” WebDriverHandle supports Chrome, Edge, and Brave (with a bundled ad-blocker .crx extension and anti-detection Chrome flags baked in).
  • Optimized WebDriver Lifecycle (55% Faster Execution) ⚑ β€” Tests share one WebDriver instance per test class (initialized in BaseTest's @BeforeClass) instead of spinning up a new browser per test method. In a real full-suite run this cut total execution time from 7 min 29 sec β†’ 4 min 6 sec for the same 36 tests.
  • Allure Reporting with Full Traceability πŸ“ˆ β€” @Epic / @Feature / @Story / @Severity / @Owner annotations on every test, automatic failure screenshots via a custom AllureListener, and REST Assured request/response logging attached to API test reports.
  • Built-in Flaky Test Handling πŸ”„ β€” A custom RetryAnalyzer automatically retries a failing test up to 2 times, logging each retry attempt separately from the final verified result, before marking it failed for real.
  • Test Case Management Alignment 🎯 β€” @TmsLink/@Link annotations map automated tests back to Jira/Zephyr Scale test case IDs for traceability between manual and automated coverage.

πŸ› οΈ Tech Stack

Category Technology
Language Java 25 β˜•
Build Tool Apache Maven πŸ“¦
UI Automation Selenium WebDriver 4.41.0 🌐
Test Runner TestNG 7.11.0 πŸ§ͺ
API Testing REST Assured 6.0.0 ⚑
Reporting Allure (allure-testng, allure-java-commons, allure-rest-assured 2.31.0) πŸ“Š
JSON Handling Gson 2.13.2, Jackson Databind 2.17.0 πŸ“„
Boilerplate Reduction Lombok 1.18.42 πŸ› οΈ
Assertions/Unit JUnit Jupiter βœ…
Test Execution Maven Surefire Plugin 3.1.2 πŸš€

πŸš€ Getting Started

Prerequisites πŸ“‹

  • JDK 25 (or lower the maven.compiler.source/target values in pom.xml to match your installed JDK)
  • Apache Maven 3.8+
  • Chrome, Edge, or Brave installed locally β€” browser in config.properties controls which one WebDriverHandle launches (Brave is hardcoded to the default Windows install path; adjust WebDriverHandle.java if you're on macOS/Linux or a different install location)
  • An IDE such as IntelliJ IDEA (the repo ships with an .idea folder) or Eclipse/VS Code

Installation πŸ’»

  1. Clone the repository
git clone https://github.com/SeifZiad/Automation-API-Testing-Project.git
cd Automation-API-Testing-Project
  1. Install dependencies
mvn clean install -DskipTests
  1. Configure your test environment Edit src/main/resources/config.properties:
browser=chrome
baseUrl=https://automationexercise.com/
implicitWait=10
explicitWait=15
headless=true

πŸ’‘ Usage

Run the full UI suite πŸ–₯️

mvn clean test

Tests.xml wires up four test classes in this order: HomePageTests β†’ AuthenticationTests β†’ ProductsCartTests β†’ UserStories. A clean full-suite run completes all 36 tests in around 4 minutes:

Run a single test class 🎯

mvn test -Dtest=AuthenticationTests

Run the API tests ⚑

ApiTests isn't currently wired into Tests.xml, so run it directly:

mvn test -Dtest=ApiTests

Generate and view the Allure report πŸ“Š

allure serve target/allure-results

or generate a static report:

allure generate target/allure-results --clean -o target/allure-report
allure open target/allure-report

Example: a real API test from this project πŸ“‘

Response res = given()
        .baseUri("https://automationexercise.com")
        .when()
        .get("/api/productsList")
        .then()
        .extract().response();

ProductsResponse body = new Gson().fromJson(res.asString(), ProductsResponse.class);

Assert.assertEquals(res.statusCode(), 200);
Assert.assertNotNull(body.getProducts());

Example: a real UI test from this project πŸ–₯️

@Test(dataProvider = "singleUserData")
@TmsLink("TC-02")
public void TC02_PositiveLoginTest(User user) {
    homePage = new LoginPage(driver);
    ((LoginPage) homePage).perfromLogin(user.email, user.password);

    String actual = ((LoginPage) homePage).ReadvalidloginMessage();
    Assert.assertEquals(actual, user.firstName + " " + user.lastName);
}

⏱️ Test Execution & Performance

The framework was deliberately refactored to control WebDriver scope, since that's the single biggest lever on suite runtime for a Selenium project of this size.

Approach WebDriver Lifecycle Total Time (36 tests)
Legacy (Alltests.java, @BeforeMethod) New browser launched for every test method 7 min 29 sec
Current (BaseTest.java, @BeforeClass) One browser shared across all tests in a class 4 min 6 sec

That's a ~55% reduction in execution time for identical coverage, simply by moving driver initialization from @BeforeMethod to @BeforeClass and reusing the session across a test class's methods.

πŸ“Š Reporting & Stability

Allure Reports πŸ“ˆ

Every run produces a full Allure dashboard: pass/fail rate, execution duration, and tests grouped by @Feature/@Story (e.g., Navigation, Shopping Cart, Checkout Workflows), so a non-technical stakeholder can see coverage at a glance without reading code.

Retry Analysis πŸ”„

RetryAnalyzer (wired in via @Test(retryAnalyzer = RetryAnalyzer.class)) automatically retries a test up to 2 times before it's reported as a genuine failure. The console output β€” and the Allure report β€” clearly separate intermediate retry attempts from the final verified result, so a transient failure (e.g., a slow page load) never gets confused with a real regression:

πŸ“‚ Project Structure

Automation-API-Testing-Project/
β”œβ”€β”€ .idea/                              # IDE project settings
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ java/
β”‚   β”‚   β”‚   β”œβ”€β”€ Pages/                  # Page Object Model classes
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ HomePage.java           # Navigation, subscribe, category checks
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ LoginPage.java          # extends HomePage β€” login/signup entry points
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SignupPage.java         # Full registration form flow
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ProductsPage.java       # Product listing, search
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SingleProductPage.java  # Product detail, add-to-cart, reviews
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ CartPage.java           # Cart contents, quantity, removal
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ CheckoutPage.java       # Checkout / order review
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PaymentPage.java        # Payment form submission
β”‚   β”‚   β”‚   β”‚   └── ConatctusPage.java      # Contact Us form
β”‚   β”‚   β”‚   └── Utils/
β”‚   β”‚   β”‚       β”œβ”€β”€ ApiResponsePOJOs/       # Gson/Jackson response models (Product, Brand, ApiResponse, ...)
β”‚   β”‚   β”‚       β”œβ”€β”€ POJOClasses/User.java   # UI test-data POJO
β”‚   β”‚   β”‚       β”œβ”€β”€ ConfigReader.java       # Reads config.properties
β”‚   β”‚   β”‚       β”œβ”€β”€ Framework.java          # Reusable Selenium action wrappers (30+ methods)
β”‚   β”‚   β”‚       └── WebDriverHandle.java    # Chrome/Edge/Brave driver lifecycle (singleton)
β”‚   β”‚   └── resources/
β”‚   β”‚       └── config.properties           # Environment configuration
β”‚   └── test/
β”‚       β”œβ”€β”€ java/
β”‚       β”‚   β”œβ”€β”€ AllTests/
β”‚       β”‚   β”‚   β”œβ”€β”€ BaseTest.java           # Shared setup/teardown (@BeforeClass driver init) + TestNG data providers
β”‚       β”‚   β”‚   β”œβ”€β”€ HomePageTests.java      # TC10, TC25, TC26, TC29–TC36: navigation & home page tests
β”‚       β”‚   β”‚   β”œβ”€β”€ AuthenticationTests.java# TC01–TC06, TC27–TC28: signup/login/logout/delete
β”‚       β”‚   β”‚   β”œβ”€β”€ ProductsCartTests.java  # TC08, TC09, TC11–TC13, TC16–TC19, TC21: products, cart, brands, categories, reviews
β”‚       β”‚   β”‚   β”œβ”€β”€ UserStories.java        # TC14–TC16, TC20, TC23–TC24: end-to-end checkout/order journeys
β”‚       β”‚   β”‚   β”œβ”€β”€ ApiTests.java           # 14 REST Assured API test cases
β”‚       β”‚   β”‚   └── Alltests.java           # Legacy monolithic suite (superseded by the classes above)
β”‚       β”‚   β”œβ”€β”€ Listeners/
β”‚       β”‚   β”‚   └── AllureListener.java     # Auto-attaches screenshots to Allure on failure
β”‚       β”‚   └── Utils/
β”‚       β”‚       └── RetryAnalyzer.java      # Retries failed tests up to 2x, logging each attempt
β”‚       └── resources/
β”‚           β”œβ”€β”€ TestingData/                # JSON test data
β”‚           β”‚   β”œβ”€β”€ SignupData.JSON
β”‚           β”‚   β”œβ”€β”€ CreateAccount.JSON
β”‚           β”‚   β”œβ”€β”€ PagesUrl.JSON
β”‚           β”‚   β”œβ”€β”€ Payment.JSON
β”‚           β”‚   β”œβ”€β”€ Contactus.JSON
β”‚           β”‚   └── ReviewData.JSON
β”‚           └── extensions/
β”‚               └── adblocker.crx           # Bundled ad-blocker extension for stable UI runs
β”œβ”€β”€ Tests.xml                            # TestNG suite (HomePageTests, AuthenticationTests, ProductsCartTests, UserStories)
β”œβ”€β”€ pom.xml                              # Maven build & dependency configuration
β”œβ”€β”€ .gitignore
└── README.md

Note: Alltests.java predates the split into HomePageTests / AuthenticationTests / ProductsCartTests / UserStories and duplicates much of their coverage in one 800+ line class, using a @BeforeMethod driver β€” the slower, pre-optimization approach described above. It isn't referenced by Tests.xml and is kept in the repo as an earlier iteration rather than the maintained entry point.

βš™οΈ Configuration / Environment Variables

The framework is configured through src/main/resources/config.properties, loaded at runtime by ConfigReader:

Key Description Example
browser Browser used for Selenium execution β€” chrome, edge, or brave brave
baseUrl Base URL of the application under test [https://automationexercise.com/](https://automationexercise.com/)
implicitWait Implicit wait timeout in seconds 10
explicitWait Explicit/WebDriverWait timeout in seconds 15
headless Run the browser headless (--headless=new) true

If you set browser=brave, WebDriverHandle.java currently points to a hardcoded Windows path (C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe). Update this path directly in the source if you're on macOS/Linux or have Brave installed elsewhere.

🀝 Contributing

Contributions, suggestions, and bug reports are welcome:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature/your-feature-name.
  3. Commit your changes with clear messages.
  4. Push the branch and open a Pull Request describing the change and its motivation.
  5. For bugs or ideas, feel free to open an Issue first to discuss the approach.

Please keep new UI tests aligned with the existing Page Object Model (extend Framework/HomePage as appropriate), initialize the WebDriver at the class level (not per-method) to preserve the current execution-time gains, add corresponding JSON test data under TestingData/, and wire new test classes into Tests.xml.

πŸ“„ License

This project is intended for educational and portfolio purposes. No formal license file is currently published in the repository β€” if you plan to reuse or redistribute this code, please reach out to the repository owner (SeifZiad) for clarification.

About

End-to-end automation testing project for AutomationExercise.com, covering UI functional testing with Selenium and TestNG, API testing with REST Assured, data-driven testing using JSON, Page Object Model, configurable test environments, Allure reporting, and Jira/Zephyr test management integration.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages