Skip to content

iris-infinite-ai/java-automation-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI-Powered Java Automation Test Framework

A comprehensive test automation framework with AI agent integration, designed for intelligent test execution and analysis.

πŸš€ Features

Core Framework

  • Modern Java 24 with Maven build system
  • Selenium 4.35.0 for web automation
  • TestNG for test execution and reporting
  • Page Object Model for maintainable test structure
  • ExtentReports for comprehensive reporting

AI Agent Integration

  • Multi-Provider Support: OpenAI GPT-4 and Anthropic Claude
  • Intelligent Element Analysis: AI-powered web element analysis
  • Smart Test Generation: Automated test step and data generation
  • Natural Language Element Finding: Find elements using descriptions
  • AI-Powered Reporting: Enhanced test insights and analysis

Advanced Capabilities

  • Cross-Browser Support: Chrome, Firefox, Edge, Safari
  • Screenshot Management: Automatic screenshots on pass/fail
  • Configuration Management: Flexible property-based configuration
  • Test Listeners: Enhanced reporting with AI analysis
  • Utility Classes: Comprehensive helper methods

πŸ“ Project Structure


src/
β”œβ”€β”€ main/java/com/automation/
β”‚   β”œβ”€β”€ ai/                          # AI Agent Integration
β”‚   β”‚   β”œβ”€β”€ AgentManager.java        # Main AI coordinator
β”‚   β”‚   β”œβ”€β”€ ElementAnalyzer.java     # AI element analysis
β”‚   β”‚   β”œβ”€β”€ TestGenerator.java       # AI test generation
β”‚   β”‚   β”œβ”€β”€ ElementAnalysis.java     # Analysis data model
β”‚   β”‚   └── providers/               # AI Provider implementations
β”‚   β”‚       β”œβ”€β”€ AIProvider.java      # Provider interface
β”‚   β”‚       β”œβ”€β”€ OpenAIProvider.java  # OpenAI integration
β”‚   β”‚       └── AnthropicProvider.java # Anthropic integration
β”‚   β”œβ”€β”€ base/                        # Base Classes
β”‚   β”‚   └── BaseTest.java            # Base test class
β”‚   β”œβ”€β”€ config/                      # Configuration
β”‚   β”‚   └── ConfigManager.java         # Configuration management
β”‚   β”œβ”€β”€ constants/                   # Constants
β”‚   β”‚   └── TestConstants.java        # Test constants
β”‚   β”œβ”€β”€ enums/                       # Enumerations
β”‚   β”‚   └── BrowserType.java         # Browser types
β”‚   β”œβ”€β”€ listeners/                   # Test Listeners
β”‚   β”‚   └── AITestListener.java      # AI-enhanced listener
β”‚   β”œβ”€β”€ pages/                       # Page Objects
β”‚   β”‚   β”œβ”€β”€ BasePage.java            # Base page class
β”‚   β”‚   β”œβ”€β”€ LoginPage.java           # Login page object
β”‚   β”‚   └── HomePage.java            # Home page object
β”‚   └── utils/                       # Utilities
β”‚       β”œβ”€β”€ WebDriverFactory.java    # Driver factory
β”‚       β”œβ”€β”€ ScreenshotUtils.java     # Screenshot utilities
β”‚       └── ReportManager.java       # Report management
└── test/java/com/automation/tests/  # Test Classes
    β”œβ”€β”€ LoginTest.java               # Login tests
    β”œβ”€β”€ AIAgentTest.java            # AI agent tests
    └── ComprehensiveAITest.java    # Comprehensive AI tests

πŸ› οΈ Setup and Configuration

Prerequisites

  • Java 24 or higher
  • Maven 3.6+
  • Chrome/Firefox/Edge browser
  • AI API key (OpenAI or Anthropic)

Configuration

  1. Update config.properties:
# AI Agent Configuration
ai.enabled=true
ai.provider=openai
ai.api.key=your_actual_api_key_here
ai.model=gpt-4
ai.timeout=30
  1. Configure Browser:
browser=chrome
headless=false

Dependencies

The framework includes all necessary dependencies in pom.xml:

  • Selenium WebDriver
  • WebDriverManager
  • TestNG
  • ExtentReports
  • Apache Commons IO
  • Jackson for JSON processing

πŸ§ͺ Running Tests

Run All Tests

mvn test

Run Specific Test Suite

mvn test -DsuiteXmlFile=testng.xml

Run Individual Test Class

mvn test -Dtest=LoginTest

πŸ€– AI Agent Features

1. Intelligent Element Finding

// Find element using natural language
WebElement element = getAgentManager().findElementByDescription("username input field");

2. AI-Powered Element Analysis

// Analyze element with AI insights
ElementAnalysis analysis = getAgentManager().analyzeElement(element);
System.out.println("AI Analysis: " + analysis.getDescription());

3. Automated Test Generation

// Generate test steps using AI
String testSteps = getAgentManager().generateTestSteps("Complete login flow");

4. Smart Test Data Generation

// Generate test data using AI
String testData = getAgentManager().generateTestData("username", "valid credentials");

5. AI-Enhanced Reporting

// Get AI analysis of test results
String analysis = getAgentManager().analyzeTestResults("Test completed successfully");

πŸ“Š Reporting

The framework generates comprehensive reports with:

  • AI Analysis: Intelligent insights on test execution
  • Screenshots: Automatic capture on pass/fail
  • Test Steps: Detailed step-by-step execution
  • Performance Metrics: Execution times and analysis
  • AI Recommendations: Suggestions for test improvement

Reports are generated in ./reports/extent-reports/ directory.

πŸ”§ Extending the Framework

Adding New AI Providers

  1. Implement AIProvider interface
  2. Add provider configuration
  3. Update AgentManager to support new provider

Creating New Page Objects

  1. Extend BasePage class
  2. Use @FindBy annotations for elements
  3. Implement page-specific methods

Adding New Test Features

  1. Extend BaseTest class
  2. Use AI agent capabilities
  3. Implement comprehensive reporting

πŸš€ Future Enhancements

  • Visual Testing: AI-powered visual regression testing
  • API Testing: AI-enhanced API test generation
  • Performance Testing: AI-driven performance analysis
  • Mobile Testing: AI-powered mobile automation
  • Cross-Platform: Support for multiple platforms

πŸ“ License

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

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Implement your changes
  4. Add tests for new functionality
  5. Submit a pull request

πŸ“ž Support

For questions and support, please open an issue in the repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages