Skip to content

zulpikaruygur/java-selenium-ready-to-use-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Selenium Ready-to-Use Framework

A lightweight, ready-to-use Java Selenium automation framework pre-wired with Cucumber, TestNG, Maven and Allure reporting.

This repository contains a sample automation framework you can use as a starting point for web UI testing.

Key features

  • Java + Maven project structure
  • Selenium WebDriver utilities and driver manager
  • TestNG test runner integration (testng.xml)
  • Cucumber feature files and step definitions
  • Allure results collection (allure-results/)
  • Helpful utilities for API, DB, Excel, PDF and browser interactions

Repository layout

Important paths and purpose:

  • pom.xml — Maven project descriptor with dependencies and plugins
  • testng.xml — TestNG suite definition used by the project
  • src/test/java — Java test sources, runners, step definitions and utils
  • src/test/resources — Test resources (feature files, config, log4j2)
  • allure-results/ — Allure JSON results produced during test runs
  • target/ — Maven build output (should be ignored in VCS)

Prerequisites

  • Java JDK 11 or later installed and JAVA_HOME set
  • Maven 3.6+ on your PATH
  • Browser driver(s) (e.g., ChromeDriver) — the project may include a driver manager utility; if not, download drivers and ensure they are available or configured by the framework
  • (Optional) Allure commandline if you want to serve reports locally (allure)

On Windows you can verify Java and Maven using:

java -version
mvn -v

Configuration

  • src/test/resources/config.properties contains framework configuration (base URL, timeouts, credentials, etc.). Update values for your environment.
  • Logging configuration is in src/test/resources/log4j2.xml.

Sensitive values (API keys, passwords) should be injected via environment variables or a secure secrets store in CI; avoid committing secrets into config.properties.

Common commands

Run the full test suite (TestNG + Cucumber) using Maven:

mvn clean test -Dsurefire.suiteXmlFiles=testng.xml

Run a specific TestNG class or method using Surefire (example):

mvn -Dtest=com.framework.runners.TestRunner test

Generate / view Allure report locally (requires Allure CLI installed):

mvn clean test -Dsurefire.suiteXmlFiles=testng.xml
allure serve allure-results

If the project uses a custom Maven profile or properties, check pom.xml for available options.

CI / Docker notes

  • The repo includes a Dockerfile for containerized execution. Adjust as needed for your CI environment.
  • In CI, ensure JAVA_HOME and MAVEN_HOME are set, and add browser drivers or run tests against a remote Selenium Grid / Playwright / Selenoid service.
  • To publish Allure reports in CI, collect the allure-results directory as a build artifact and use an Allure plugin or post-build step to generate the HTML report.

Troubleshooting

  • Tests fail to start: ensure the correct Java version and Maven are on PATH.
  • Browser not found / driver error: download matching browser driver and either put it on PATH or configure the framework's driver utility.
  • Flaky tests: investigate waiter/timeout usage in BrowserUtils and page objects; use explicit waits where appropriate.

Recommended follow-ups

  • Remove committed generated artifacts and test outputs from history (e.g., target/, allure-results/, test-classes/, .class files). They should be ignored by .gitignore and not tracked.
    • Example to untrack and remove them from the index:
git rm -r --cached allure-results target test-classes || echo "some paths not present"
git add .gitignore
git commit -m "Remove generated artifacts from VCS and update .gitignore"
git push origin main
  • Add README.md (this file) and a LICENSE that fits your intended project usage.
  • Consider a small CI workflow (GitHub Actions) that builds the project and runs tests on pull requests.

Contributing

Contributions are welcome. Please open issues and pull requests. Keep changes focused and add tests when you modify framework behavior.

License

Add a license file to declare how this code may be used. If you want a permissive license, consider MIT.


If you want, I can now:

  • Remove the committed generated artifacts and push the cleanup commit.
  • Add a LICENSE (MIT) and a short CONTRIBUTING.md.
  • Add a GitHub Actions workflow to run mvn test on push/pull requests.

Tell me which of the above you'd like me to do next.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published