Skip to content

vmso/io.bdd_testing_frameworks

Repository files navigation

Modern BDD Testing Framework v2.0.0

A comprehensive, modern test automation framework that combines API, Web, and Mobile testing into a unified BDD (Behavior-Driven Development) solution. Built with the latest technologies and best practices for scalable, maintainable test automation.

🚀 Features

Core Capabilities

  • Multi-Platform Testing: API, Web, and Mobile testing in one framework
  • BDD Support: Cucumber and Gauge integration for business-readable tests
  • Parallel Execution: Configurable parallel test execution for faster feedback
  • Modern Dependencies: Latest versions of Selenium, Rest Assured, Appium, and more
  • Cloud Integration: Ready for BrowserStack, AWS Device Farm, and other cloud platforms
  • Docker Support: Complete containerized testing environment
  • CI/CD Ready: GitHub Actions and Jenkins pipeline with comprehensive reporting

Modern Technologies

  • Java 17: Latest LTS version with modern language features
  • Selenium 4.18.1: Latest WebDriver with improved performance
  • Rest Assured 5.4.0: Modern API testing with enhanced capabilities
  • Appium 9.2.2: Latest mobile testing framework
  • Cucumber 7.15.0: Latest BDD framework with improved features
  • JUnit 5.10.2: Modern testing framework with parallel execution
  • Maven 3.9.9: Latest build tool with improved dependency management

Advanced Features

  • Test Data Management: Faker library for realistic test data generation
  • Security: Encrypted configuration management with environment variable support
  • Monitoring: Prometheus and Grafana integration for test metrics
  • Reporting: Multiple reporting options (Allure, Cucumber, JaCoCo)
  • Mocking: WireMock integration for API mocking
  • Database Testing: PostgreSQL support with TestContainers
  • Performance Testing: Built-in performance testing capabilities
  • 🆕 Self-Healing Locators: Automatic recovery from broken locators (AI optional)

🔮 Self‑Healing Locators (NEW in v2.0.0)

The framework now includes self-healing for broken locators, reducing flaky test failures when the UI changes.

How It Works

  1. On NoSuchElementException, the SelfHealingEngine is triggered.

  2. The engine captures a screenshot and a compact DOM snapshot.

  3. It generates replacement locators via:

    • Heuristic rules (text matches, data-testid, aria-label, title, name, etc.)
    • AI suggestions (OpenAI models, optional)
    • Fast‑path reuse of previously healed locators cached in ModelStore.
  4. The best candidate is tried and (optionally) persisted for future fast reuse.

Artifacts are written under:

reports/self-heal/<timestamp>/
├─ page.png       # screenshot
├─ dom.txt        # DOM outerHTML snapshot
└─ decision.log   # ordered trace of the healing decision

Configuration

Add these properties (in config.properties) and/or environment variables:

# Self-healing master switch
selfheal.enabled=true

# If true, only logs suggested fixes without applying them
selfheal.shadow_mode=false

# Enable AI-based candidate generation (optional)
selfheal.ai.enabled=true
# Required only if AI is enabled
export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx

If OPENAI_API_KEY is missing, AI is automatically disabled and the engine falls back to heuristics.

Usage

No code changes required for test steps. The framework’s element finder automatically delegates to the self-healing engine when a locator fails:

WebElement el = elementFinder.findElement(By.id("possibly_brittle_id"));
// If brittle, engine tries AI/heuristics/fast-path and proceeds with a recovered By

Design Notes

  • Fast‑path reuse: when a healed locator is persisted for a page + original locator, it is tried first on the next failure.
  • Shadow mode: set selfheal.shadow_mode=true to observe and log self‑healing without actually switching locators.
  • Deduping: candidates are de‑duplicated (insertion‑ordered) so AI suggestions are evaluated before heuristics.

✅ Test Status

Current Test Results

  • API Testing: ✅ All tests passing (3 Gauge scenarios)
  • Mobile Testing: ✅ Build successful, ready for testing
  • Web Testing: ✅ Core functionality working, unit tests removed due to Java compatibility
  • Shared Utilities: ✅ All modules building successfully

Test Coverage

  • Functional Tests: API, Web, and Mobile scenarios working
  • Integration Tests: Docker services and infrastructure tested
  • Build Tests: All modules compile and build successfully

📋 Prerequisites

  • Java 17 or higher
  • Maven 3.9.9 or higher
  • Docker and Docker Compose
  • Git

🛠️ Quick Start

1. Clone the Repository

git clone https://github.com/your-org/io.bdd_testing_frameworks.git
cd io.bdd_testing_frameworks

2. Setup Environment

# Copy environment configuration
cp config.properties.template config.properties

# Set environment variables (recommended for production)
export TEST_SLACK_TOKEN=your_slack_token
export TEST_DB_PASSWORD=your_db_password
export TEST_WEBHOOK=your_webhook_url

3. Start Testing Infrastructure

# Start all services (Selenium Grid, Appium, Database, etc.)
docker-compose up -d

# Verify services are running
docker-compose ps

4. Run Tests

# Run all tests
mvn clean test

# Run specific module tests
mvn test -pl api_testing
mvn test -pl web_testing
mvn test -pl mobile_testing

# Run with parallel execution
mvn test -Dparallel.threads=4

# Run specific test tags
mvn test -Dcucumber.filter.tags="@api"
mvn test -Dcucumber.filter.tags="@web"
mvn test -Dcucumber.filter.tags="@mobile"

🏗️ Project Structure

io.bdd_testing_frameworks/
├── api_testing/
│   ├── src/
│   │   ├── main/java/
│   │   │   ├── base/
│   │   │   ├── cucumber/
│   │   │   └── imp/
│   │   └── test/
│   │       ├── resources/
│   │       │   ├── features/
│   │       │   ├── payloads/
│   │       │   └── schemas/
│   │       └── java/
│   └── pom.xml
├── web_testing/
│   ├── src/
│   │   ├── main/java/
│   │   │   ├── base/
│   │   │   ├── browsers/
│   │   │   ├── driver/
│   │   │   ├── elements/
│   │   │   ├── helpers/
│   │   │   └── imp/
│   │   └── test/
│   │       ├── resources/
│   │       │   ├── features/
│   │       │   └── locators/
│   │       └── java/
│   └── pom.xml
├── mobile_testing/
│   ├── src/
│   │   ├── main/java/
│   │   │   ├── base/
│   │   │   ├── platform/
│   │   │   ├── platforms/
│   │   │   ├── helper/
│   │   │   └── imp/
│   │   └── test/
│   │       ├── resources/
│   │       │   ├── features/
│   │       │   ├── devices/
│   │       │   └── locators/
│   │       └── java/
│   └── pom.xml
├── mutual_methods/
│   ├── src/main/java/
│   │   ├── base/
│   │   ├── configuration/
│   │   ├── helper/
│   │   ├── imp/
│   │   └── utils/
│   └── pom.xml
├── docker-compose.yml
├── Jenkinsfile
├── pom.xml
└── README.md

🧪 Writing Tests

API Testing Example

Feature: Pet Store API

  Scenario: Create and retrieve a pet
    Given base url 'https://petstore.swagger.io'
    And endpoint '/v2/pet'
    And payload as file 'payloads/petPost.json' from resource
    And Headers
      | accept        | application/json |
      | Content-Type  | application/json |
    When Send post requests
    Then Verify that the status code is 200
    And Get 'id' from response and store it with 'petId' during scenario
    And Get 'name' from response and store it with 'petName' during scenario

Web Testing Example

Feature: Web Application Testing

  Scenario: Login functionality
    Given Open 'chrome' and get 'https://example.com/login'
    And Send keys 'username' to 'email' field
    And Send keys 'password' to 'password' field
    And Click on 'login' button
    Then Verify that 'dashboard' element is visible
    And Verify that 'welcome' text contains 'Welcome'

Mobile Testing Example

Feature: Mobile App Testing

  Scenario: App login
    Given Get 'android' capabilities from resource with JSON 'device_capabilities.json' file and lunch app
    And Send keys 'username' to 'username_field'
    And Send keys 'password' to 'password_field'
    And Click on 'login_button'
    Then Verify that 'home_screen' element is visible

🔧 Configuration

Environment Variables

# Slack Integration
export TEST_SLACK_TOKEN=your_slack_token
export TEST_WEBHOOK=your_webhook_url

# Database Configuration
export TEST_DB_PASSWORD=your_db_password
export TEST_CONNECTION_STRING=jdbc:postgresql://localhost:5432/testdb

# Test Configuration
export TEST_ENVIRONMENT=development
export TEST_PARALLEL_THREADS=4
export TEST_TIMEOUT=30

# Optional: AI for Self‑Healing
export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx

Properties File (config.properties)

# Slack Configuration
slack_token=${TEST_SLACK_TOKEN}
webhook=${TEST_WEBHOOK}

# Database Configuration
connectionString=${TEST_CONNECTION_STRING}
dbClass=org.postgresql.Driver
dbUser=testuser
dbPassword=${TEST_DB_PASSWORD}

# Test Configuration
environment=${TEST_ENVIRONMENT}
parallel.threads=${TEST_PARALLEL_THREADS}
test.timeout=${TEST_TIMEOUT}

# Browser Configuration
default.browser=chrome
base.url=https://example.com

# Self-Healing
selfheal.enabled=true
selfheal.shadow_mode=false
selfheal.ai.enabled=false

🚀 CI/CD Integration

GitHub Actions

  • Push to main: full test suite
  • Pull Requests: validation before merge

Workflow Highlights

  • Unit + API tests
  • Build & package artifacts
  • Docker & infra validation
  • Allure/Cucumber reports

Jenkins Pipeline

pipeline {
  agent any
  tools { maven 'Maven 3.9.9'; jdk 'Java 17' }
  // ... see Jenkinsfile for complete configuration
}

📊 Reporting

  • Allure Reports (HTML, screenshots, logs)
  • Cucumber Reports (BDD-specific)
  • JaCoCo Coverage
  • Custom summaries
mvn allure:report
mvn allure:serve
mvn jacoco:report

🔒 Security Features

  • Env vars for sensitive data
  • Encrypted config management
  • Masked logging
  • No hardcoded credentials

🐳 Docker Support

  • Selenium Grid, Appium Server
  • PostgreSQL, Redis
  • WireMock, Prometheus, Grafana
docker-compose up -d
docker-compose up -d selenium-hub chrome firefox
docker-compose logs -f
docker-compose down

📈 Performance Testing

parallel.threads=4
test.timeout=30
performance.mode=true
monitoring.enabled=true

🤝 Contributing

  1. Fork → Branch → Commit → Test → PR
  2. Keep tests > 80% coverage
  3. Follow Java + BDD style guides

📝 Changelog

v2.0.0 (Current)

  • Major: Java 17, dependency upgrades
  • New: Docker Compose
  • New: Jenkins pipeline
  • New: Faker-based TestDataHelper
  • New: Security improvements
  • New: Parallel execution
  • New: Comprehensive reporting
  • New: Monitoring and metrics
  • New: Self‑Healing Locators (AI + heuristics)
  • Improvement: Config management & error handling
  • Improvement: Modernized architecture

v1.0.0 (Previous)

  • Initial BDD framework (API/Web/Mobile)
  • Cucumber & Gauge integration
  • Basic reporting

📄 License

MIT — see LICENSE

🆘 Support

  • Docs: README + inline code
  • Issues: GitHub Issues
  • Discussions: GitHub Discussions
  • Wiki: Project wiki

Happy Testing! 🧪✨

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages