π» Built a Selenium WebDriver + TestNG automation framework for ParaBank, a demo online banking site. The framework implements Page Object Model, data-driven testing, and reporting, showcasing enterprise-level automation design.
- Features
- Tech Stack
- Prerequisites
- Installation
- Configuration
- How to Run Tests
- Reports & Screenshots
- Parallel Execution & CI
- Best Practices & Tips
- Contributing
- License
- Contact
- Page Object Model (POM) for maintainable page classes.
- Data-driven tests using TestNG
@DataProviderand external data sources (CSV/Excel/JSON β pluggable). - Thread-safe WebDriver management via
DriverManagerfor parallel execution. - ExtentReports-based HTML reporting with screenshot capture on failures.
- Suite and test listeners (
ISuiteListener,ITestListener) for centralized reporting and lifecycle handling. - Utilities for screenshots, waits, and common test helpers.
- Configurable via properties or environment variables for different environments (local/qa/stage).
- Java (11+ recommended)
- Selenium WebDriver
- TestNG
- ExtentReports (AventStack)
- Log4j2
- Maven (build & dependency management)
- Java JDK 11 or newer installed and
JAVA_HOMEconfigured. - Maven 3.6+ installed.
- Chrome / Firefox browsers installed (or driver/docker grid available).
- Recommended IDE: IntelliJ IDEA or Eclipse.
- Clone the repository:
git clone <repository-url>
cd <repo-folder>- Build the project and download dependencies:
mvn clean compileThe framework uses a properties file for environment-specific config. Example files are under resources/config/.
Key configuration options:
base.urlβ ParaBank base URLbrowserβchrome/firefox/edgeheadlessβ true/false (for CI)
You can override properties at runtime using Maven system properties, e.g.:
mvn test -Dbrowser=chrome -Dbase.url=https://parabank.parasoft.comIf your project includes a TestNG suite file (e.g. testng.xml):
mvn test -DsuiteXmlFile=testng.xmlmvn -Dtest=LoginTests testmvn -Dtest=LoginTests#shouldLoginSuccessfully testmvn test -Dbrowser=chrome -Denv=qa- Extent HTML report is generated under:
target/ExtentReport.htmldepending on yourExtentReportconfiguration. - Screenshots are saved under:
target/screenshots/with timestamped filenames.
- If screenshots do not appear in the report, please ensure that the screenshot method returns an absolute path and that the file exists at that path. Use the
MediaEntityBuilder.createScreenCaptureFromPath(absolutePath)when attaching. - If running tests multiple times and you want a clean report each run, delete the old report file in
onStart(ISuite suite)or archive it totarget/reports/archivebefore initialising Extent.
DriverManager holds a ThreadLocal<WebDriver> so each test thread gets its own WebDriver instance. Ensure that tests do not use shared mutable state.
Configure testng.xml or use Maven Surefire to enable parallel execution:
<suite name="Regression" parallel="tests" thread-count="4">
...
</suite>- Build with Maven:
mvn clean test - Archive artifacts:
target/reports/*,target/screenshots/* - Use headless mode for browsers in CI (set
-Dheadless=true).
- Keep page interactions simple and return either a
PageObjector a value β do not mix assertions inside page methods. - Use
@BeforeMethod/@AfterMethodin test classes for per-test setup and teardown; keep expensive operations (like DB connections) at the suite level if needed. - Avoid hard sleeps; use explicit waits (WebDriverWait / ExpectedConditions).
- Make screenshot capture robust: return absolute path, timestamp file names, and handle
driver == nullgracefully.
- Fork the repo
- Create a feature branch
- Add tests & documentation
- Open a pull request describing your changes
Please follow coding standards and keep methods small.
Happy testing! π