Skip to content

vinipx/taflex

Repository files navigation

TAFLEX

Java Version Gradle Playwright Appium HttpClient License Documentation

Read the Documentation →

A production-ready, enterprise-grade unified test automation framework supporting Web (Playwright), API (Apache HttpClient), and Mobile (Appium) testing with externalized locators and configuration.

🎯 Key Features

  • Unified Architecture: Single codebase for Web, API, and Mobile testing.
  • Strategy Pattern: Runtime driver resolution between platforms.
  • Externalized Locators: Hierarchical .properties locator strategy (Global > Mode > Page).
  • Java 21+ Native: Leverages modern LTS features for clean and efficient code.
  • Enterprise Reporting: Native integration with ReportPortal and Xray Cloud (Jira).
  • Contract Testing: Integrated support for Pact (Consumer-driven).
  • Database Orchestration: Connection pooling with HikariCP and simplified JDBC wrapper.
  • Quality Gates: Automatic retries for flaky tests and screenshots on failure.
  • Code Hygiene: Automated checks with Checkstyle and PMD.
  • CI/CD Integration: Out-of-the-box support for GitHub Actions and GitLab CI.
  • Cloud Ready: Built-in support for BrowserStack and SauceLabs.

🏗️ Architecture

┌─────────────────────────────────────────────────────┐
│                    Test Layer                       │
│          (Tests extend BaseTest)                    │
└──────────────────────┬──────────────────────────────┘
                       │
┌──────────────────────▼──────────────────────────────┐
│                 DriverFactory                       │
│         (Strategy Pattern - Runtime)                │
└──────────┬─────────────┬──────────────┬─────────────┘
           │             │              │
┌──────────▼──┐ ┌───────▼────┐ ┌──────▼─────┐
│   Web       │ │   API      │ │   Mobile   │
│ (Playwright)│ │ (HttpClient)│ │  (Appium)  │
└─────────────┘ └────────────┘ └────────────┘
           │             │              │
┌──────────▼─────────────▼──────────────▼─────────────┐
│              Externalized Locators                  │
│           (PropertiesLocatorStrategy)               │
└─────────────────────────────────────────────────────┘

🚀 Quick Start

Prerequisites

  • Java 21+ - Download here
  • Gradle 8.5+ - Or use the included wrapper (./gradlew)
  • Git - For version control

Installation

  1. Clone the repository:
git clone https://github.com/vinipx/taflex.git
cd taflex
  1. Run setup script:
./setup.sh

The script will verify your Java version, create automation.properties from the template, and compile the test sources.

  1. Configure your environment:
# Edit automation.properties with your settings
nano automation.properties

Running Tests

# Run Web tests
./gradlew webTest

# Run API tests
./gradlew apiTest

# Run Mobile tests
./gradlew mobileTest

# Run via Groups
./gradlew test -Dgroups=smoke

⚙️ Configuration

Set the mode in automation.properties:

# Execution Mode: web | api | mobile
execution.mode=web

# Web Settings
web.browser=chromium
web.headless=true

# API Settings
api.base.url=https://api.example.com

📝 Writing Tests

Web Test Example

public class LoginTests extends BaseTest {
    @Test(groups = {"smoke"})
    public void shouldLoginSuccessfully() {
        driver.navigateTo("login.page.url");
        driver.type("login.username.field", "user");
        driver.type("login.password.field", "pass");
        driver.click("login.submit.button");
        Assert.assertTrue(driver.isVisible("dashboard.welcome"));
    }
}

API Test Example

public class UserApiTests extends BaseTest {
    @Test(groups = {"api"})
    public void shouldFetchUser() {
        ApiDriverStrategy apiDriver = (ApiDriverStrategy) driver;
        ApiDriverStrategy.ApiResponse response = apiDriver.get("users.endpoint");
        Assert.assertEquals(response.getStatusCode(), 200);
    }
}

📁 Project Structure

taflex/
├── src/
│   ├── main/java/io/github/vinipx/taflex/
│   │   ├── core/
│   │   │   ├── config/      # ConfigManager & properties loading
│   │   │   ├── drivers/     # Strategy implementations (Web, API, Mobile)
│   │   │   ├── locators/    # Hierarchical locator resolution
│   │   │   └── utils/       # XrayService, CapabilityBuilder
│   │   └── database/        # DatabaseManager & Connection Pool
│   └── test/java/io/github/vinipx/taflex/
│       ├── base/            # BaseTest lifecycle
│       ├── listeners/       # TestNG reporting & retry logic
│       └── tests/           # Web, API, and Mobile suites
├── documentation/           # Docusaurus documentation site
├── setup.sh                 # Environment initialization
└── automation.properties    # Central configuration

🛡️ Code Quality & CI

TAFLEX maintains high standards through automated hygiene checks and robust CI integration:

  • Checkstyle: Enforces coding standards (naming, indentation, whitespace).
  • PMD: Detects code smells, dead code, and potential programming errors.
  • CI/CD Ready: Fully configured pipelines for GitHub Actions and GitLab CI.

Run local verification:

./gradlew verifyBuild test

📊 Governance & Reporting

  • Xray Integration: Link tests to Jira issues. Configure xray.client.id and xray.client.secret in properties.
  • ReportPortal: AI-powered dashboard. Enable via reportportal.enabled=true.
  • Local Reports: Standard TestNG reports are generated at build/reports/tests/index.html.
  • Screenshots: Automatically captured on failure in the screenshots/ directory.

🤝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


Happy Testing! 🚀

Built with ❤️ by vinipx and the TAFLEX Community.

About

Test Automation Framework Flexible for API WEB and MOBILE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors