π€ AI-Driven WordPress Plugin Testing Framework
Complete plugin analysis with integrated security scanning, performance profiling, and AI-ready reports for test generation!
The framework now uses a fully modular approach where each phase can be run independently:
# Run complete analysis (all 12 phases)
./test-plugin.sh bbpress
# Run individual phases
./bash-modules/phases/phase-02-detection-enhanced.sh bbpress
./bash-modules/phases/phase-03-ai-analysis.sh bbpress
./bash-modules/phases/phase-06-ai-test-data.sh bbpress
# Skip specific phases
SKIP_PHASES="7,11" ./test-plugin.sh bbpress
12 comprehensive phases with progressive data building:
- Setup - Directory structure + scan-info.json
- Detection (Enhanced) - Extracts 500+ functions, classes, hooks with ACTUAL data
- AI Analysis (AST) - 2MB+ rich AST data with complexity metrics
- Security - Uses AST data for vulnerability scanning
- Performance - Uses complexity metrics from AST
- Test Generation + AI Data - Creates tests AND contextual test data
- Visual Testing - Uses test data created in Phase 6
- Integration Tests - Tests with realistic data relationships
- AI Documentation - 50K+ prompt using ALL previous data
- Consolidation (Enhanced) - Aggregates everything, calculates score
- Live Testing - Uses real test data from Phase 6
- Safekeeping - Archives to wbcom-scan, not framework
- Modular Phase System - Run any phase independently
- AI-Driven Test Data - Analyzes database patterns for contextual data
- Progressive Enhancement - No repeated work, each phase adds value
- Clean Framework - All data in wbcom-scan, framework contains only tools
- Real Data Extraction - Actual names/values, not just counts
# 1. Navigate to your Local WP site
cd ~/Local\ Sites/your-site/app/public
# 2. Clone and setup (one command!)
git clone https://github.com/vapvarun/wp-testing-framework.git && cd wp-testing-framework && ./local-wp-setup.sh
# 3. Run complete AI-driven analysis
./test-plugin.sh bbpress
# Watch as it analyzes:
# β
2,431 functions
# β
63 classes
# β
2,059 hooks
# β
Security vulnerabilities
# β
Performance metrics
# β
Test coverage
# Use Git Bash (recommended) or PowerShell
cd "C:\Users\[YourName]\Local Sites\[site]\app\public"
git clone https://github.com/vapvarun/wp-testing-framework.git
cd wp-testing-framework
# Git Bash
./local-wp-setup.sh
./test-plugin.sh bbpress
# PowerShell
.\local-wp-setup.ps1
.\test-plugin.ps1 bbpress
π Full Guides:
The framework automatically:
- Detects Local WP environment
- Configures database (uses root/root)
- Sets up site URL (.local domain)
- Creates folders when testing
- Generates reports instantly
# Mac/Linux
./test-plugin.sh woocommerce # Full 8-phase analysis
./test-plugin.sh elementor quick # Quick essential tests
./test-plugin.sh wordfence security # Security focus
./test-plugin.sh wp-rocket performance # Performance focus
./test-plugin.sh yoast-seo ai # AI analysis mode
# Windows (Git Bash or PowerShell)
.\test-plugin.ps1 woocommerce
.\test-plugin.ps1 elementor quick
- Functions - Every PHP function documented with AST parsing
- Classes - All class structures mapped with methods
- Hooks - WordPress actions/filters identified (4000+ for complex plugins)
- Security - Vulnerabilities scanned (XSS, SQL injection, nonces, capabilities)
- Performance - Memory usage, load time, file sizes, query optimization
- Database - SQL queries analyzed, custom tables detected
- AJAX/REST - API endpoints documented with handlers
- Shortcodes - All shortcodes detected with callbacks
- Forms - Form submissions and validation patterns
- Test Generation - AI-enhanced, executable, and basic tests created
- Coverage - Real code coverage with executable assertions
# Open beautiful HTML report
open workspace/reports/plugin-name/report-*.html
# Complete AI report
cat workspace/ai-reports/plugin-name/ai-analysis-report.md
# Detailed lists
cat workspace/ai-reports/plugin-name/functions-list.txt # All functions
cat workspace/ai-reports/plugin-name/classes-list.txt # All classes
cat workspace/ai-reports/plugin-name/hooks-list.txt # All hooks
cat workspace/ai-reports/plugin-name/security-analysis.txt # Security findings
- Run analysis:
./test-plugin.sh your-plugin
- Copy AI report:
cat workspace/ai-reports/your-plugin/ai-analysis-report.md
- Paste to Claude: "Generate comprehensive PHPUnit tests for these functions"
- Claude generates complete test suites based on your analysis!
Each phase can be run independently for targeted analysis:
# Phase 2: Enhanced Detection (extracts actual data)
./bash-modules/phases/phase-02-detection-enhanced.sh plugin-name
# Phase 3: AI/AST Analysis (generates 2MB+ AST data)
./bash-modules/phases/phase-03-ai-analysis.sh plugin-name
# Phase 6: AI Test Data Generation (analyzes database patterns)
./bash-modules/phases/phase-06-ai-test-data.sh plugin-name
# Phase 9: AI Documentation (uses all collected data)
./bash-modules/phases/phase-09-documentation.sh plugin-name
# Phase 10: Enhanced Consolidation (aggregates everything)
./bash-modules/phases/phase-10-consolidation-enhanced.sh plugin-name
The framework analyzes database patterns to generate contextual test data:
# Run AI test data generation
./bash-modules/phases/phase-06-ai-test-data.sh your-plugin
# Creates comprehensive AI prompt at:
# wbcom-scan/your-plugin/2025-09/analysis-requests/phase-6-ai-test-data.md
# AI analyzes:
# - Database queries (INSERT, UPDATE, SELECT)
# - Custom tables and schema
# - Meta operations and relationships
# - Plugin type detection (ecommerce, forum, LMS, etc.)
AI generates contextual test data based on plugin type:
- E-commerce: Products, orders, payment methods
- Forum: Topics, replies, user discussions
- LMS: Courses, lessons, enrollments
- Membership: Subscription levels, access rules
- Forms: Submissions with validation
- Real assertions that execute code
- Function existence and callability
- Shortcode output validation
- Hook callback verification
- Provides actual code coverage (20-30%)
- Contextual data based on plugin patterns
- SQL queries for custom tables
- WP-CLI commands for content creation
- Realistic relationships and foreign keys
- PHPUnit test class framework
- Placeholder methods for manual development
- Setup and teardown methods
Local WP is the preferred environment because:
- β Zero configuration - Everything pre-installed
- β WP-CLI included - No manual installation
- β Database ready - root/root access configured
- β Site URL works - .local domain auto-configured
- β One-click sites - Create test sites instantly
./test-plugin.sh woocommerce
./test-plugin.sh easy-digital-downloads
./test-plugin.sh woocommerce-subscriptions
./test-plugin.sh elementor
./test-plugin.sh beaver-builder
./test-plugin.sh divi-builder
./test-plugin.sh bricks
./test-plugin.sh contact-form-7
./test-plugin.sh wpforms-lite
./test-plugin.sh ninja-forms
./test-plugin.sh gravity-forms
./test-plugin.sh wordpress-seo # Yoast
./test-plugin.sh all-in-one-seo-pack
./test-plugin.sh rank-math
./test-plugin.sh buddypress
./test-plugin.sh bbpress
./test-plugin.sh buddyboss-platform
./test-plugin.sh peepso
./test-plugin.sh wordfence
./test-plugin.sh sucuri-scanner
./test-plugin.sh ithemes-security
./test-plugin.sh w3-total-cache
./test-plugin.sh wp-rocket
./test-plugin.sh litespeed-cache
./test-plugin.sh autoptimize
All PHP testing tools now run automatically in sequence:
- Built-in AI Scanner - Extracts functions, classes, hooks
- security-scanner.php - Vulnerability detection
- performance-profiler.php - Memory and load analysis
- test-coverage-report.php - Coverage metrics
- component-test-dashboard.php - Visual test status
All analysis data is stored in wbcom-scan/
keeping the framework clean:
wp-content/uploads/wbcom-scan/plugin-name/2025-09/
βββ extracted-features.json # 500+ functions, classes, hooks with names
βββ wordpress-ast-analysis.json # 2MB+ AST data with complexity
βββ test-data-manifest.json # Created test data IDs and URLs
βββ analysis-requests/
β βββ phase-6-ai-test-data.md # AI prompt for test data generation
β βββ phase-9-ai-documentation.md # 50K+ comprehensive prompt
βββ reports/
β βββ security-report.md # Vulnerability analysis
β βββ performance-report.md # Performance metrics
β βββ test-data-report.md # Test data creation summary
β βββ MASTER-REPORT.md # Aggregated analysis with score
βββ generated-tests/
β βββ *ExecutableTest.php # Real executable tests
β βββ *BasicTest.php # Test structure
βββ documentation/
β βββ USER-GUIDE.md # AI-generated user guide
β βββ ISSUES-AND-FIXES.md # AI-generated issues report
βββ raw-outputs/
βββ detected-functions.txt # Function signatures
βββ detected-classes.txt # Class definitions
βββ detected-hooks.txt # Hook implementations
βββ test-pages.txt # Created test page URLs
Framework directory stays clean - contains only tools!
- Just install Local WP - everything else included!
- Download: https://localwp.com/
- PHP 8.0+, Node.js 16+, Composer, WP-CLI
- See docs/setup/REQUIREMENTS.md
# Get latest updates
git pull origin main
npm install
composer update
cd ~/Local\ Sites/your-site/app/public
git clone https://github.com/vapvarun/wp-testing-framework.git
cd wp-testing-framework
./local-wp-setup.sh
git clone https://github.com/vapvarun/wp-testing-framework.git
cd wp-testing-framework
./setup.sh # Auto-detects environment
- Installation - Setup instructions
- Setup Guides - Detailed installation
- Plugin Guides - Plugin-specific docs
- Technical Docs - Framework internals, methodology
- Feature Docs - Feature implementations
- Reports - Status reports and improvements
Can't find site directory?
# Local WP sites are usually in:
# Mac: ~/Local Sites/
# Windows: C:\Users\{username}\Local Sites\
# Linux: ~/Local Sites/
Permission denied?
chmod +x local-wp-setup.sh test-plugin.sh
Database issues?
# Local WP uses:
# Username: root
# Password: root
# Host: localhost
- Use Local WP - Everything just works!
- One command testing -
./test-plugin.sh plugin-name
- Auto folder creation - No manual setup needed
- Check HTML reports - Beautiful visual results
- Keep updated -
git pull origin main
We welcome contributions! Fork and submit PRs.
MIT License - Use freely in your projects!
Maintained by @vapvarun
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with β€οΈ for WordPress developers using Local WP
Test any plugin in 30 seconds - no configuration needed!