Skip to content

πŸš€ Automation Test Project β€” A scalable Selenium Java framework with POM architecture, dynamic form filling, JSON/CSV test data, cookie handling, .env config, and debug logging. Integrated with TestNG + Allure for reliable and insightful automation reporting.

License

Notifications You must be signed in to change notification settings

suraiyasathi/Automation-Test-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Automation-Test-Project

A practical automation project that enhances Selenium-based testing with advanced debugging, cookie-powered login reuse, and a JSON-driven universal form filler β€” helping testers identify failures faster, eliminate login repetition, handle dynamic forms with ease, and keep secrets safe via .env.


πŸ“ Project Overview

This framework automates login functionality on the Automation Exercise site using:

  • Selenium WebDriver

  • TestNG

  • Allure Reporting

  • Smart logging with screenshots on failure

  • Cookie-based session reuse

  • .env support for credentials and secure environment variables

  • Dynamic JSON-based Form Filling for any form, anywhere


πŸ“¦ Install Dependencies

βœ… Prerequisites

Make sure the following are installed on your system:

  • Java 17+

  • Maven

  • Allure CLI


πŸ§ͺ Running the Tests

Run the following command to clean and execute your TestNG suite:

mvn clean test

After execution, you'll find:

  • πŸ“Έ Screenshots in target/screenshots/

  • 🧾 Test Logs in target/test-output/test-log.txt

  • πŸ“Š Allure Results in target/allure-results/

To generate the Allure report:

allure serve target/allure-results

πŸ” Key Features

  • βœ… Logs success, skip, and failure status of every test method.

  • πŸ“Έ Captures screenshots automatically on test failure.

  • 🧾 Stores clear failure reasons (e.g., "Element not found") in the log file.

  • πŸ” Cookie-based login skip (load cookies if valid, re-login if expired).

  • πŸ” Uses .env file to load credentials securely.

  • 🧹 Auto-clears old logs/screenshots per run.

  • πŸ€– One Script to Fill Any Form Anywhere β€” powered by JSON + a dynamic DataProvider.


πŸͺ How Cookie Reuse Works

  • βœ… On the first login, session cookies are saved into a cookies.json file.
  • πŸ” On the next run:
    • If cookies are still valid, they are reused to skip login entirely.
    • If cookies are expired, a fresh login is triggered, and new cookies are saved.

🧠 We use Gson for clean and structured cookie serialization & deserialization.


⚑ The Ultimate Selenium Hack β€” Dynamic Form Agent

  • Separate methods for each form field become unnecessary.

  • All form input data is defined in a simple JSON file as key-value pairs mapping field names to values.

  • A universal DataProvider reads this JSON, automatically detects the input types (text, dropdown, file upload, checkbox, etc.), and fills the form accordingly.

  • Repetitive, hard-coded scripts are eliminated. Adding a new field requires only updating the JSON β€” no changes in code are necessary.

  • Integrated Allure reports combined with intelligent error handling ensure that any failures are logged clearly, simplifying debugging.

πŸ’‘ The Takeaway

By combining JSON-driven data, a dynamic DataProvider, a universal form filler, and detailed Allure reports, tedious and repetitive form testing transforms into a smooth, adaptive, and highly maintainable automation system.

This is not just automation β€” it is automation with style.


πŸ§ͺ How It All Works Together

Each test runs through a structured lifecycle for maximum clarity and minimal noise:

  • πŸš€ The browser is launched once at the suite start.
  • πŸ“ Each method logs its status (pass, fail, skip) in test-log.txt.
  • πŸ“Έ On failure, a screenshot is captured, stored, and linked in the Allure report.
  • πŸ€– For forms, the JSON-driven dynamic filler automatically detects and fills the fields.
  • ♻️ All screenshots and logs are reset cleanly before every run in the target/ folder.

This setup makes it easier to:

  • Identify bugs faster πŸ”
  • Debug test failures with logs + visuals πŸ“‹πŸ“·
  • Integrate seamlessly into CI/CD pipelines βš™οΈ
  • Avoid repetitive login steps = faster test cycles ⚑
  • Automate any form without extra code changes

βœ… Example Test Scenario

Automated Login Validation on Automation Exercise:

  1. 🧭 Visit the login page
  2. πŸ” Enter valid credentials (loaded securely from .env)
  3. 🎯 Validate successful login
  4. πŸͺ Save session cookies to cookies.json
  5. ⚑ On the next run, reuse cookies to skip login (if still valid)
  6. πŸ€– If a form is present, auto-fill it using JSON data without touching the code

Only relevant and necessary code is maintained for clarity and readability.


πŸ”— References

Read the full articles:


Allure Report

The test automation suite generates detailed Allure reports that provide clear insights into test execution, including step-by-step actions, screenshots on failure, and logs.

Below is an example screenshot from the Allure report:

Allure Report Example

About

πŸš€ Automation Test Project β€” A scalable Selenium Java framework with POM architecture, dynamic form filling, JSON/CSV test data, cookie handling, .env config, and debug logging. Integrated with TestNG + Allure for reliable and insightful automation reporting.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages