Skip to main content

AI-powered browser testing framework using natural language and OpenAI

Project description

Agentic Test Framework

An AI-powered browser testing framework that accepts natural language test descriptions and executes them using Playwright.

Quick Start

# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install Playwright browsers
playwright install

# Set up environment
cp .env.example .env
# Edit .env and add your OpenAI API key

# Run an example test
python -m agentic_test_framework "Go to example.com and take a screenshot"

# Or run from an ATC file
agentic-test examples/login.atc

Features

  • 🤖 Natural Language Tests: Write tests in plain English
  • 🌐 Browser Automation: Powered by Playwright (Chrome, Firefox, Safari)
  • 🧠 AI-Driven: Uses OpenAI to interpret test scenarios
  • 📸 Auto Screenshots: Captures screenshots on demand or for every step
  • 📊 Dual Reporting: Custom HTML reports + Playwright trace viewer
  • 🎬 Time-Travel Debugging: Playwright traces with DOM snapshots, network logs, console output
  • 🎥 Video Recording: Automatic video capture of test execution
  • Assertions: Verify conditions and extract data
  • 🔄 Smart Retries: Handles flaky elements automatically
  • 📝 ATC Format: Structured test files with YAML-like syntax

Example Tests

Command Line

# Simple navigation
agentic-test "Go to google.com and search for 'playwright testing'"

# Multi-step workflow
agentic-test "Navigate to github.com, click Sign in, type 'testuser' in username field"

# Validation
agentic-test "Go to example.com, verify the page title contains 'Example', take screenshot"

ATC File Format

Create structured test files with .atc extension:

# Login Test Suite

@config browser=chromium
@config headless=false

## Scenario: Successful Login
@tag smoke
@tag login

Go to example.com/login
Type 'testuser' into username field
Type 'password123' into password field
Click login button
Verify page contains 'Welcome'
Take a screenshot

Quick Start: Generate ATC Templates

# Create basic template
agentic-test --create tests/my_test.atc

# Create from predefined templates
agentic-test --create tests/login.atc --template login
agentic-test --create tests/shop.atc --template ecommerce
agentic-test --create tests/api.atc --template api

Available templates:

  • basic - Simple test structure
  • login - Login/authentication flows
  • ecommerce - Shopping and checkout flows
  • api - API/integration tests

Run ATC files:

# Run all scenarios
agentic-test tests/login.atc

# Run specific scenario
agentic-test tests/login.atc --scenario "Successful Login"

# Run by tag
agentic-test tests/login.atc --tag smoke

See docs/ATC_FORMAT.md for complete format specification.

Architecture

Natural Language → OpenAI Parser → Action Objects → Playwright Executor → Results

See .github/copilot-instructions.md for detailed architecture documentation.

Project Structure

agentic-test-framework/
├── agentic_test_framework/
│   ├── actions/          # Action type definitions
│   ├── parser/           # OpenAI integration
│   ├── executor/         # Playwright execution engine
│   ├── runner/           # Test orchestration
│   └── reporter/         # HTML report generation
├── config/               # Configuration files
├── examples/             # Example test scenarios
├── docs/                 # Documentation
└── tests/                # Framework tests

HTML Reports

Every test automatically generates a beautiful HTML report with:

  • ✅ Pass/fail status for each step
  • 📸 Embedded screenshots
  • 📊 Extracted data
  • ⏱️ Execution timing
  • 🎨 Color-coded results

Reports are saved to test-results/report_YYYYMMDD_HHMMSS.html

See docs/HTML_REPORTS.md for details.

Development

Running Unit Tests

The framework includes a comprehensive test suite with pytest:

# Run all tests
pytest

# Run with verbose output
pytest -v

# Run with coverage report
pytest --cov=agentic_test_framework --cov-report=html

# Run specific test file
pytest tests/test_actions.py

# Open coverage report in browser
xdg-open htmlcov/index.html  # Linux
open htmlcov/index.html       # macOS

See tests/README.md for detailed testing documentation.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentic_test_framework-0.1.0.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentic_test_framework-0.1.0-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file agentic_test_framework-0.1.0.tar.gz.

File metadata

  • Download URL: agentic_test_framework-0.1.0.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for agentic_test_framework-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ca0401e8e757d5c88c12f195f063dd28bb28ac275de9242b64a255de51888e8b
MD5 d899b97a2859f3b912c27557b9dd3a5c
BLAKE2b-256 83c78334df2cbe1e53e148de59bbcc5ecc8751168d972e42b30c45ed0f60583d

See more details on using hashes here.

File details

Details for the file agentic_test_framework-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentic_test_framework-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7653d7f813a5471a23cc426d0c045addb6eb6b03e6df29404cbe7c37bf8611d
MD5 d1623d0d86f27a2acf6581c20dcb8b43
BLAKE2b-256 adabd68cc769fc80659961a154b7d7f430daa4747465203603211ac261d9483c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page