veriqa-test-advisor
Version:
AI-powered regression test case advisor CLI tool with integrated Manual QA support
542 lines (405 loc) โข 15 kB
Markdown
# ๐ง VeriQA Test Advisor
> **AI-Powered Regression Test Case Advisor CLI Tool** ๐ฎ๐ณ Made in India
[](https://badge.fury.io/js/veriqa-test-advisor)
[](https://opensource.org/licenses/MIT)
**VeriQA** intelligently suggests which test cases to run based on:
- ๐ **Git commits/diffs** analysis
- ๐ค **AI (Perplexity)** suggestions
- ๐บ๏ธ **Module-to-Test** mapping
- โก **Custom CLI** execution
- ๐ **Enhanced Reporting** (PDF & CSV formats) โจ **NEW**
## โจ Latest Updates
### ๐ Enhanced Reporting System (v2.0)
**Complete integration of simplified enhanced reporting supporting PDF and CSV formats only:**
- **๐ Multi-Format Reports**: Generate both PDF and CSV reports simultaneously
- **๐ข Enterprise Features**: Context-specific messaging for different audiences
- **๐งน Smart Cleanup**: Automatic maintenance of latest 5 reports per format
- **โก CLI Integration**: Seamlessly integrated into main CLI without code duplication
```bash
# Generate CSV report for TCS submissions
veriqa signoff --format csv
# Generate both PDF and CSV formats
veriqa signoff --multi-format
# Clean up old reports with statistics
veriqa cleanup --stats
```
## ๐ฏ Why VeriQA?
| Problem | VeriQA Solution |
|---------|----------------|
| Test suites are growing large; running full regression is costly | Use Git diff + module mapping to detect impacted test cases |
| Manual mapping of modules to tests is tedious and error-prone | Automatically generate mapping JSON using directory structures |
| QA/devs may not know what test cases are relevant to a change | Use AI to suggest intelligent test cases based on commit message |
| Integration with CI tools is often manual | Create a CLI that can be easily integrated into any CI/CD pipeline |
| **Need comprehensive reporting for stakeholders and TCS** | **Enhanced PDF/CSV reporting with enterprise messaging** โจ |
## ๐ Quick Start
### Installation
```bash
# Install globally (recommended)
npm install -g veriqa-test-advisor
# Or install locally in your project
npm install veriqa-test-advisor --save-dev
```
### ๐ฏ Zero-Config Setup
VeriQA provides **automatic project setup** for new users:
```bash
# Install and auto-setup your project
npm install -g veriqa-test-advisor
npx veriqa-setup
# This creates:
# โ
Sample test files with @module: tags
# โ
Configuration files (.env, playwright.config.js)
# โ
Project structure (tests/auth, tests/product)
# โ
Ready-to-run examples
```
### Basic Usage
```bash
# Get AI suggestions based on latest commit
veriqa-test-advisor --ai
# Run suggested test cases
veriqa-test-advisor --run
# Filter by tags and environment
veriqa-test-advisor --run --tag smoke --env staging
# Dry run (show what would be executed)
veriqa-test-advisor --dry-run --tag regression
```
### ๐ฆ NPM Scripts (Auto-Added)
After setup, use these convenient commands:
```bash
npm run test:ai # AI-powered test suggestions
npm run test:smoke # Run smoke tests
npm run test:regression # Run regression tests
npm run test:dry # Dry run mode
# ๐ฏ Interactive Demos & Setup
npm run demo:simple # Interactive VeriQA demo (4 modes)
npm run setup:github # Enhanced GitHub Copilot setup
```
### ๐ญ Interactive Demo Modes
```bash
# Quick overview (30 seconds)
npm run demo:simple
# Select from 4 demo modes:
# 1๏ธโฃ Quick Overview - Essential commands
# 2๏ธโฃ Interactive Demo - Live project analysis
# 3๏ธโฃ Advanced Features - Complete feature tour
# 4๏ธโฃ Installation Guide - Step-by-step setup
```
## ๐ Command Reference
| Command | Description |
|---------|-------------|
| `veriqa-test-advisor` | Suggest test cases based on code changes |
| `--ai` | Use AI to suggest test cases via commit message |
| `--run` | Run only suggested test cases |
| `--tag <tag>` | Filter tests by tag (@smoke, @regression, etc.) |
| `--env <env>` | Pass environment variable or profile |
| `--dry-run` | Show test plan without execution |
| `--verbose` | Show internal debug information |
| `--version` | Show version information |
| `--help` | Show help message with installed dependencies |
## โ๏ธ Setup & Configuration
### 1. Test Structure
Organize your tests with module annotations:
```javascript
// tests/auth/login.test.js
// @module: auth
const { test, expect } = require('@playwright/test');
test('TC_Login_01 @smoke @regression - should login', async ({ page }) => {
await page.goto('/login');
await page.fill('#username', 'testuser');
await page.fill('#password', 'password123');
await page.click('#login-btn');
await expect(page.locator('text=Welcome')).toBeVisible();
});
```
### 2. Environment Variables
Create a `.env` file:
```env
# Recommended: Use your GitHub Copilot license!
GITHUB_TOKEN=your_github_token_here
# Alternative: Perplexity AI (free option)
PERPLEXITY_API_KEY=your_perplexity_api_key
OPENAI_MODEL=sonar-pro
# VeriQA Settings
VERIQA_FRAMEWORK=playwright
VERIQA_ENV=staging
```
### 3. Supported Frameworks
VeriQA works with:
- โ
**Playwright** (`@playwright/test`)
- โ
**CodeceptJS** with Playwright helper
- ๐ **Allure** reporting (automatic)
## ๐ค AI Integration
VeriQA supports multiple AI providers for intelligent test suggestions:
### ๐ **GitHub Copilot Integration** (Recommended)
Use your existing GitHub Copilot license for enhanced AI suggestions:
```bash
# Setup: Add GITHUB_TOKEN to .env (with repo, copilot scopes)
# Get token: https://github.com/settings/tokens
# AI will use GitHub Copilot to analyze your commits
veriqa-test-advisor --ai
```
### ๐ **Perplexity AI** (Free Alternative)
Free option using Perplexity AI:
```bash
# Setup: Add PERPLEXITY_API_KEY to .env
# Get free key: https://www.perplexity.ai/
# Example output:
# ๐ค AI Suggested Regression Test Cases:
# - TC_Login_01.spec.js (reason: login functionality changes)
# - TC_2FA_01.spec.js (reason: authentication flow affected)
# - TC_Registration_test.js (reason: user management updates)
```
## ๐บ๏ธ Module Mapping
VeriQA automatically generates `mappings/module_test_map.json`:
```json
{
"auth": [
"tests/auth/TC_Login_01.spec.js",
"tests/auth/TC_2FA_01.spec.js"
],
"product": [
"tests/product/TC_Search.spec.js"
]
}
```
## ๐ Advanced Features
### โจ Enhanced Reporting System (NEW)
VeriQA now includes comprehensive enterprise-ready reporting with PDF and CSV formats:
```bash
# Generate CSV report for TCS submissions and Excel analysis
veriqa signoff --format csv
# Generate PDF report for stakeholders and management
veriqa signoff --format pdf
# Generate both formats simultaneously
veriqa signoff --multi-format
# Custom filename with date
veriqa signoff --format csv --filename "tcs-submission-$(date +%Y%m%d)"
```
#### ๐ข Enterprise Features
- **๐ Smart Multi-Format**: Generate PDF and CSV simultaneously with `--multi-format`
- **๐งน Automatic Cleanup**: Maintains latest 5 reports per format automatically
- **๐ฏ Context Messaging**: Format-specific messages for different audiences
- **๐ Statistics**: View report statistics with `--stats` option
#### ๐ Report Commands
```bash
# Report cleanup with statistics
veriqa cleanup --stats --max 3
# Preview cleanup without deletion
veriqa cleanup --dry-run
# Generate quarterly review reports
veriqa signoff --multi-format --filename "Q1-2024-review"
```
#### ๐ Report Formats
| Format | Use Case | Audience | Command |
|--------|----------|----------|---------|
| **CSV** | TCS submissions, Excel analysis | Analysts, QA Teams | `--format csv` |
| **PDF** | Stakeholder presentations | Management, Executives | `--format pdf` |
| **JSON** | CI/CD integration, automation | Development Teams | `--format json` |
| **Console** | Daily development workflow | Developers | `--format console` |
### K6-Style Test Summary
After test execution, get detailed metrics:
```
running (veriqa-advisor) ...
wall time: 2m 34.2s
tests: 25
โ passed: 23 (92.0%)
โ failed: 2 (8.0%)
avg duration: 3.4s
p50 | p90: 2.1s | 8.7s
p95 | p99: 12.3s | 18.9s
RPS: 0.16
by framework:
playwright 20 (80.0%)
codeceptjs 5 (20.0%)
by tag:
smoke 15 (60.0%)
regression 10 (40.0%)
```
### CI/CD Integration
```yaml
# GitHub Actions example
- name: Run Smart Regression Tests
run: |
npx veriqa-test-advisor --run --tag smoke
# GitLab CI example
test:regression:
script:
- npx veriqa-test-advisor --ai --verbose
- npx veriqa-test-advisor --run --env $CI_ENVIRONMENT_NAME
```
## ๐จ Examples
### Basic Workflow
```bash
# 1. Make code changes
git add . && git commit -m "fix: update login validation logic"
# 2. Get AI suggestions
veriqa-test-advisor --ai
# 3. Run suggested tests
veriqa-test-advisor --run --tag smoke
# 4. Run full regression if needed
veriqa-test-advisor --run --tag regression
```
### Advanced Usage
```bash
# Debug mode with verbose output
veriqa-test-advisor --ai --verbose
# Dry run to see what would be executed
veriqa-test-advisor --dry-run --tag "smoke|regression"
# Environment-specific testing
VERIQA_ENV=staging veriqa-test-advisor --run --tag smoke
```
## ๐ง Configuration Files
### Playwright Config
```javascript
// playwright.config.js
module.exports = {
testDir: 'tests',
reporter: [
['list'],
['allure-playwright'] // Required for VeriQA metrics
]
};
```
### CodeceptJS Config
```javascript
// codecept.conf.js
exports.config = {
tests: 'tests/**/*.js',
plugins: {
allure: {
enabled: true,
require: '@codeceptjs/allure-legacy'
}
}
};
```
## ๐ Business Value
- ๐ **Reduce CI/CD costs** by 60-80% (run only relevant tests)
- โก **Faster feedback** for developers (smart test selection)
- ๐ฏ **Higher test coverage** confidence (AI-driven suggestions)
- ๐ **Easy integration** with existing pipelines
- ๐ **Better insights** with detailed test analytics
## ๐ ๏ธ Troubleshooting
### Quick Diagnostics
```bash
# Comprehensive project analysis & diagnosis
npx veriqa-troubleshoot
# Auto-fix detected issues (config naming, imports, etc.)
npx veriqa-troubleshoot --fix
# Validate complete installation
npx veriqa-validate
```
### Advanced Troubleshooting
Our enhanced troubleshoot system automatically detects and fixes:
โ
**Config File Naming Issues**
- `playwright.config` โ `playwright.config.js`
- `codecept.config.js` โ `codecept.conf.js`
- `cypress.config` โ `cypress.config.js`
- `Package.json` โ `package.json`
โ
**Framework Compatibility**
- Multi-framework conflict detection
- Port conflict warnings
- Dependency validation
โ
**Environment Configuration**
- Missing API keys detection
- `.env` file validation
- Smart recommendations
### Common Issues
**โ "ReferenceError: devices is not defined"**
```bash
# Fix Playwright config devices import
npx veriqa-troubleshoot --fix
# Or manually add: const { defineConfig, devices } = require('@playwright/test');
```
**โ "Command not found: veriqa-test-advisor"**
```bash
# Reinstall globally
npm uninstall -g veriqa-test-advisor
npm install -g veriqa-test-advisor@latest
```
**โ "No tests found"**
```bash
# Check project setup
npx veriqa-validate
# Regenerate mapping
veriqa-test-advisor --run --verbose
```
**โ "AI suggestions failed"**
```bash
# Check API key setup
cat .env | grep PERPLEXITY_API_KEY
# Get your free API key at: https://perplexity.ai
```
### Get Help
- ๐ [Installation Guide](INSTALLATION.md)
- ๐ง [Troubleshooting Tool](scripts/troubleshoot.js)
- ๐ [Report Issues](https://github.com/kapil971390/VeriQA-Regression-Advisor/issues)
## ๐ Business Value
- ๐ **Reduce CI/CD costs** by 60-80% (run only relevant tests)
- โก **Faster feedback** for developers (smart test selection)
- ๐ฏ **Higher test coverage** confidence (AI-driven suggestions)
- ๐ **Easy integration** with existing pipelines
- ๐ **Better insights** with detailed test analytics
## ๐ค Contributing
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md).
## ๐ License
MIT ยฉ [Kapil Rathore](https://github.com/kapilrathore)
## ๐ Links
- ๐ฆ [npm package](https://www.npmjs.com/package/veriqa-test-advisor)
- ๐ [GitHub repository](https://github.com/kapilrathore/veriqa-test-advisor)
- ๐ [Documentation](https://veriqa.dev/docs)
- ๐ฌ [Discord Community](https://discord.gg/veriqa)
## ๐จโ๐ป Author
**Kapil Rathore** - *Creator & Maintainer*
- ๐ GitHub: [@kapil971390](https://github.com/kapil971390)
- ๐ง Email: kapil9713@gmail.com
- ๐ผ LinkedIn: [Connect with me](https://www.linkedin.com/in/kapil-rathore)
## ๐ Version Management
VeriQA includes automatic version checking and update notifications:
### Version Commands
```bash
# Check for updates
veriqa-version --check
# Show detailed version info
veriqa-version --info
# View version history
npm run version:info
```
### Automatic Updates
- ๐ **Auto-check**: Checks for updates every 24 hours (non-intrusive)
- ๐ข **Smart notifications**: Shows update alerts only once per version
- ๐ **Usage analytics**: Anonymous usage tracking for better development
- ๐ฏ **Update urgency**: Color-coded notifications (๐จ Major, โจ Minor, ๐ง Patch)
### Update Service (Optional)
```bash
# Start background update service
veriqa-update-service --start
# Check service status
veriqa-update-service --status
# Manual update check
veriqa-update-service --check
```
### Privacy & Analytics
VeriQA collects anonymous usage data to improve the tool:
- โ
**Anonymous**: No personal information collected
- โ
**Local**: Data stored locally on your machine
- โ
**Minimal**: Only feature usage and version information
- โ
**GDPR Compliant**: Clear and export your data anytime
```bash
# View your analytics data
node -e "console.log(JSON.stringify(require('./node_modules/veriqa-test-advisor/src/versionAnalytics').prototype.exportAnalytics(), null, 2))"
# Clear analytics data
node -e "new (require('./node_modules/veriqa-test-advisor/src/versionAnalytics'))().clearAnalytics()"
```
## ๐ค Contributing
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
**Copyright (c) 2025 [Kapil Rathore](https://github.com/kapil971390)**
---
<p align="center">
<b>๐ฎ๐ณ Made with โค๏ธ in India</b><br>
<sub>Empowering QA teams worldwide with intelligent test automation</sub><br><br>
<a href="https://github.com/kapil971390">
<img src="https://img.shields.io/badge/GitHub-kapil971390-blue?style=flat-square&logo=github" alt="GitHub Profile">
</a>
</p>