Skip to content

yusa-imit/testforge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

99 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TestForge ๐Ÿงช

Self-Healing Automated Testing Platform for QA Engineers and Product Managers

TestForge is an intelligent test automation platform that combines browser (E2E) and API testing with a revolutionary Self-Healing system. When UI elements change, TestForge automatically adapts using multi-layer selector strategies, reducing test maintenance to near zero.

Tech Stack Tech Stack Tech Stack Tech Stack Tech Stack


๐ŸŒŸ Key Features

๐Ÿ—๏ธ Hierarchical Test Organization

  • Service โ†’ Feature โ†’ Scenario โ†’ Step
  • Organize tests by business logic, not technical implementation
  • Perfect for large applications with multiple features

๐Ÿ”„ Self-Healing Technology

  • Multi-layer selectors: testId โ†’ role โ†’ text โ†’ label โ†’ css โ†’ xpath
  • Automatic fallback when UI changes
  • Confidence scoring for healing suggestions
  • Approval workflow for production safety

๐Ÿงฉ Reusable Components

  • Extract common flows (login, navigation, setup)
  • Parameterize and reuse across scenarios
  • Track component usage across all scenarios

๐ŸŒ Unified Testing

  • Browser automation with Playwright
  • API testing with request/response validation
  • Mixed scenarios: Combine browser and API steps seamlessly

โšก Real-time Execution

  • Live step-by-step progress via Server-Sent Events (SSE)
  • Instant feedback on test execution
  • Visual healing indicators

๐Ÿ‘ฅ No-Code Friendly

  • Visual scenario editor
  • Point-and-click step creation
  • QA engineers and product managers can create tests

๐Ÿš€ Quick Start

Prerequisites

Before you begin, ensure you have the following installed:

  • Bun v1.0+ (runtime and package manager)
  • Node.js v18+ (for compatibility)
  • Git

Install Bun

# macOS, Linux, WSL
curl -fsSL https://bun.sh/install | bash

# Windows (PowerShell)
powershell -c "irm bun.sh/install.ps1 | iex"

Installation

  1. Clone the repository
git clone https://github.com/yourusername/testforge.git
cd testforge
  1. Install dependencies
bun install
  1. Install Playwright browsers
bunx playwright install chromium
  1. Initialize the database
bun run db:migrate
  1. Seed sample data (optional)
bun run db:seed

Running the Application

Start both server and web app (recommended):

bun run dev

This will start:

Or start them individually:

# Terminal 1 - API Server
bun run dev:server

# Terminal 2 - Web UI
bun run dev:web

Your First Test

  1. Open the web UI: http://localhost:3000
  2. Create a Service: Click "New Service", enter name and base URL
  3. Create a Feature: Select your service, add a feature
  4. Create a Scenario: Add steps using the visual editor
  5. Run the test: Click the "โ–ถ๏ธ Run" button
  6. Watch it execute: See real-time step-by-step progress

๐Ÿ“š Tech Stack

Runtime & Build

  • Bun - Fast all-in-one JavaScript runtime
  • TypeScript - Type safety across the stack
  • Bun Workspace - Monorepo management

Frontend

Backend

  • Hono - Ultrafast web framework
  • Hono RPC - Type-safe client-server communication
  • DuckDB - Embedded analytical database
  • Drizzle ORM - TypeScript ORM
  • Zod - Schema validation

Test Execution

  • Playwright - Browser automation
  • Built-in Fetch API - HTTP/API testing

๐Ÿ“ Project Structure

testforge/
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ core/                    # Core test execution logic
โ”‚   โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ executor/        # Test execution engine
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ engine.ts    # Main TestExecutor class
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ locator/         # Multi-layer selector resolution
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ resolver.ts  # LocatorResolver with Self-Healing
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ healing/         # Self-Healing tracking
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ tracker.ts   # HealingTracker
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ api/             # API testing client
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ client.ts    # HTTP request executor
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ types/           # TypeScript type definitions
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ index.ts     # All core types (PRD Section 3)
โ”‚   โ”‚   โ””โ”€โ”€ package.json
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ server/                  # API Server (Hono)
โ”‚   โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ routes/          # API endpoints
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ services.ts  # Service CRUD
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ features.ts  # Feature CRUD
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ scenarios.ts # Scenario CRUD + execution
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ components.ts # Component CRUD
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ healing.ts   # Healing records
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ runs.ts      # Test runs + SSE stream
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ db/              # Database layer
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ schema.ts    # Drizzle schema definitions
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ database.ts  # Database operations
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ connection.ts # DuckDB connection
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ migrate.ts   # Migration runner
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ execution/       # Test execution management
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ manager.ts   # ExecutionManager (singleton)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ middleware/      # Middleware
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ errorHandler.ts # Global error handler
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ utils/           # Utilities
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ errors.ts    # Custom error classes
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ index.ts         # Server entry point
โ”‚   โ”‚   โ””โ”€โ”€ package.json
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ web/                     # Frontend (React + Rsbuild)
โ”‚       โ”œโ”€โ”€ src/
โ”‚       โ”‚   โ”œโ”€โ”€ components/      # UI components
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ ui/          # shadcn/ui components
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ ...          # Custom components
โ”‚       โ”‚   โ”œโ”€โ”€ pages/           # Route pages
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ Dashboard.tsx        # Home dashboard
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ Services.tsx         # Service list
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ ServiceDetail.tsx    # Service detail
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ FeatureDetail.tsx    # Feature detail
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ ScenarioEditor.tsx   # Scenario editor
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ Components.tsx       # Component list
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ ComponentEditor.tsx  # Component editor
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ Runs.tsx             # Test run history
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ RunDetail.tsx        # Run detail (SSE)
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ Healing.tsx          # Healing dashboard
โ”‚       โ”‚   โ”œโ”€โ”€ lib/             # Utilities
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ api.ts       # API client (Axios)
โ”‚       โ”‚   โ”œโ”€โ”€ stores/          # Zustand stores
โ”‚       โ”‚   โ”œโ”€โ”€ hooks/           # Custom React hooks
โ”‚       โ”‚   โ”œโ”€โ”€ App.tsx          # App root
โ”‚       โ”‚   โ””โ”€โ”€ main.tsx         # Entry point
โ”‚       โ”œโ”€โ”€ rsbuild.config.ts    # Rsbuild configuration
โ”‚       โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ scripts/                     # Development scripts
โ”‚   โ”œโ”€โ”€ dev.ts                   # Concurrent dev server launcher
โ”‚   โ””โ”€โ”€ seed.ts                  # Database seeding script
โ”‚
โ”œโ”€โ”€ docs/                        # Documentation
โ”‚   โ”œโ”€โ”€ PRD.md                   # Product Requirements Document
โ”‚   โ””โ”€โ”€ USER_GUIDE.md            # User documentation
โ”‚
โ”œโ”€โ”€ CLAUDE.md                    # Claude Code project guide
โ”œโ”€โ”€ HEALING_DASHBOARD_ENHANCEMENTS.md  # Recent work log
โ”œโ”€โ”€ package.json                 # Root workspace config
โ”œโ”€โ”€ bunfig.toml                  # Bun configuration
โ”œโ”€โ”€ tsconfig.json                # TypeScript configuration
โ””โ”€โ”€ README.md                    # This file

๐Ÿ› ๏ธ Development

Available Scripts

Command Description
bun run dev Start both server and web app in parallel
bun run dev:server Start API server only (port 3001)
bun run dev:web Start web app only (port 3000)
bun run build Build both server and web for production
bun run build:server Build server only
bun run build:web Build web only
bun run db:migrate Run database migrations
bun run db:seed Seed database with sample data
bun run test Run test suite
bun run lint Lint TypeScript files
bun run typecheck Type check without emitting files

Development Workflow

  1. Make changes to code in packages/
  2. Hot reload is enabled for both server and web
  3. Type checking runs automatically in your editor (VS Code recommended)
  4. Lint before committing: bun run lint
  5. Run tests: bun test

Adding New Dependencies

For the entire workspace:

bun add <package>

For a specific package:

cd packages/web
bun add <package>

For development only:

bun add -d <package>

Database Management

View database contents:

# Install DuckDB CLI (optional)
# macOS
brew install duckdb

# Then query
duckdb testforge.duckdb
> SELECT * FROM services;
> .tables  -- list all tables
> .quit

Reset database:

rm testforge.duckdb
bun run db:migrate
bun run db:seed

Adding UI Components (shadcn/ui)

cd packages/web

# Add a new component
bunx shadcn@latest add <component-name>

# Examples
bunx shadcn@latest add button
bunx shadcn@latest add dialog
bunx shadcn@latest add table

๐Ÿงช Testing

Running Tests

# Run all tests
bun test

# Run tests in watch mode
bun test --watch

# Run tests in a specific package
cd packages/core
bun test

Creating Tests

# Create a test file next to your source
# Example: packages/core/src/locator/resolver.test.ts

import { describe, test, expect } from "bun:test";
import { LocatorResolver } from "./resolver";

describe("LocatorResolver", () => {
  test("should resolve element by testId", async () => {
    // Test implementation
  });
});

๐Ÿ—๏ธ Architecture

Data Flow

User Action (Web UI)
    โ†“
API Request (Hono RPC)
    โ†“
Business Logic (Server)
    โ†“
Database (DuckDB) or Test Execution (Core)
    โ†“
Response / SSE Events
    โ†“
UI Update (React + TanStack Query)

Test Execution Flow

1. Scenario Loaded
    โ†“
2. Variables Initialized
    โ†“
3. Browser Context Created (Playwright)
    โ†“
4. Steps Executed Sequentially
    โ”œโ”€ Component Steps โ†’ Expanded to sub-steps
    โ”œโ”€ Browser Steps โ†’ LocatorResolver โ†’ Self-Healing
    โ””โ”€ API Steps โ†’ HTTP Request + Validation
    โ†“
5. Results Saved to Database
    โ†“
6. SSE Events Sent to Client
    โ†“
7. Browser Cleanup

Self-Healing Process

1. Try primary locator strategy (e.g., testId)
    โ†“
2. Element not found?
    โ†“
3. Try fallback strategies (role โ†’ text โ†’ css)
    โ†“
4. Element found with fallback?
    โ†“
5. Create HealingRecord with confidence score
    โ†“
6. Auto-approve if confidence > threshold
    โ†“
7. Otherwise, await manual approval
    โ†“
8. Approved? Update scenario with healed locator

๐Ÿ“– Documentation


๐Ÿ—บ๏ธ Roadmap

โœ… Phase 1: Foundation (Complete)

  • Monorepo setup
  • Database schema & migrations
  • Basic CRUD APIs
  • Frontend structure

โœ… Phase 2: Self-Healing (Complete)

  • Multi-layer locator system
  • Self-Healing detection
  • Healing approval workflow
  • Confidence scoring

โœ… Phase 3: Components & API Testing (Complete)

  • Reusable component system
  • Component parameter binding
  • API request/assert steps
  • Response validation

๐Ÿšง Phase 4: Polish & Stabilization (95% Complete)

  • Real-time SSE execution
  • Error handling
  • Scenario duplication
  • Screenshot improvements
  • Advanced search/filtering
  • Comprehensive documentation

๐Ÿ”ฎ Future Enhancements

  • CI/CD integration (GitHub Actions, GitLab CI)
  • Multi-browser support (Firefox, Safari)
  • Visual regression testing
  • Test result analytics dashboard
  • AI-powered test generation
  • Mobile app testing (iOS, Android)
  • Performance testing support

๐Ÿค Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Follow the coding conventions (see CLAUDE.md)
  4. Read the PRD before implementing features
  5. Write tests for new functionality
  6. Run linting: bun run lint
  7. Commit your changes: git commit -m 'feat: add amazing feature'
  8. Push to the branch: git push origin feature/amazing-feature
  9. Open a Pull Request

Commit Message Convention

feat: add new feature
fix: bug fix
refactor: code refactoring
docs: documentation updates
chore: dependency updates, config changes

๐Ÿ› Troubleshooting

Bun command not found

# Install Bun
curl -fsSL https://bun.sh/install | bash

# Add to PATH (add to ~/.bashrc or ~/.zshrc)
export PATH="$HOME/.bun/bin:$PATH"

Playwright browsers missing

bunx playwright install chromium

Database errors

# Reset the database
rm testforge.duckdb
bun run db:migrate

Port already in use

# Find and kill process on port 3000 or 3001
lsof -ti:3000 | xargs kill -9
lsof -ti:3001 | xargs kill -9

TypeScript errors

# Full type check
bun run typecheck

# Clean install
rm -rf node_modules bun.lockb
bun install

๐Ÿ“„ License

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


๐Ÿ™ Acknowledgments

  • Bun - For the amazing runtime
  • Hono - For the ultrafast web framework
  • Playwright - For reliable browser automation
  • shadcn/ui - For beautiful, accessible components
  • DuckDB - For the embedded analytical database

๐Ÿ’ฌ Support


Built with โค๏ธ by the TestForge Team

Website โ€ข Documentation โ€ข Twitter

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages