Skip to content

perashanid/unified-qa-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unified QA Platform

An integrated quality assurance system that combines API testing automation, test case management, and bug tracking into a single cohesive application with AI-powered features.

Features

Core Features

  • API Test Execution: Create and execute automated API tests with assertions
  • Environment Management: Manage different environments with variable substitution
  • Test Case Management: Organize test cases into hierarchical suites
  • Test Execution History: Track test runs and analyze trends
  • Bug Tracking: Create and manage bug reports with full workflow
  • Traceability: Link test cases to bugs for complete traceability

AI-Powered Features

  • AI Test Case Generation: Generate comprehensive test cases from feature descriptions using Gemini 2.0 Flash
  • Mock Data Seeding: Create realistic test data for users, projects, test cases, bugs, and test runs
  • Intelligent Test Suggestions: Get AI-powered recommendations for test scenarios

CI/CD Integration

  • Command-Line Interface: Execute tests from CI/CD pipelines
  • Webhook Support: Trigger tests from GitHub, GitLab, and other platforms
  • Automated Scheduling: Schedule recurring test runs with cron expressions
  • Multiple Output Formats: Export results in JSON or JUnit XML format

Reporting & Analytics

  • Real-time Dashboard: View metrics, pass rates, and recent test runs
  • Trend Analysis: Visualize test execution trends over time
  • Defect Metrics: Track bug distribution by severity and status
  • Test Coverage Reports: Monitor test coverage across suites

Prerequisites

  • Node.js 20 LTS or higher
  • Docker and Docker Compose
  • npm or yarn

Quick Start

  1. Clone the repository

  2. Start database services:

    npm run docker:up
  3. Install dependencies:

    npm install
  4. Start development servers:

    npm run dev
  5. Access the application:

  6. Register a new account at http://localhost:3000/register

Project Structure

unified-qa-platform/
 backend/          # Node.js/Express API server
    src/
       index.ts
       routes/
       services/
       middleware/
       utils/
    prisma/
    package.json
 frontend/         # React application
    src/
       App.tsx
       components/
       pages/
       hooks/
       utils/
    package.json
 docker-compose.yml
 package.json

Development

  • npm run dev - Start both frontend and backend in development mode
  • npm run dev:backend - Start only backend
  • npm run dev:frontend - Start only frontend
  • npm run build - Build both applications
  • npm run docker:up - Start Docker services
  • npm run docker:down - Stop Docker services

Technology Stack

Backend:

  • Node.js + Express + TypeScript
  • Mongoose + MongoDB
  • Bull + Redis for job queue
  • JWT authentication
  • Axios for HTTP requests
  • Zod for validation
  • Google Generative AI (Gemini 2.0 Flash)
  • Node-cron for scheduling
  • Winston for logging

Frontend:

  • React 18 + TypeScript
  • React Router
  • TanStack Query
  • Zustand for state management
  • Tailwind CSS
  • React Hot Toast

CLI:

  • Commander.js
  • Chalk for colored output
  • Ora for spinners

API Documentation

Authentication

All API endpoints (except /api/auth/* and /api/webhooks/*) require JWT authentication via Bearer token.

Key Endpoints

Test Collections:

  • GET /api/test-collections - List all collections
  • POST /api/test-collections - Create new collection
  • POST /api/test-collections/:id/execute - Execute collection

Test Cases:

  • GET /api/test-cases - List test cases with filtering
  • POST /api/test-cases - Create test case
  • GET /api/test-cases/:id/history - View execution history

Bugs:

  • GET /api/bugs - List bugs with filtering
  • POST /api/bugs - Create bug report
  • PUT /api/bugs/:id - Update bug status

AI Features:

  • POST /api/ai/generate-test-cases - Generate test cases with AI
  • POST /api/ai/seed-data - Generate mock data with AI

Schedules:

  • GET /api/schedules - List scheduled test runs
  • POST /api/schedules - Create new schedule
  • POST /api/schedules/:id/trigger - Manually trigger schedule

Webhooks:

  • POST /api/webhooks/trigger - Generic webhook trigger
  • POST /api/webhooks/github - GitHub webhook handler
  • POST /api/webhooks/gitlab - GitLab webhook handler

CLI Usage

Install the CLI globally:

cd cli
npm install
npm run build
npm link

Run test collection:

qa-cli run <collectionId> --env production --format junit --output results.xml

Run test suite:

qa-cli test <suiteId> --env staging --output results.json

CI/CD Integration Examples

GitHub Actions

name: QA Tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run QA Tests
        run: qa-cli run ${{ secrets.COLLECTION_ID }} --format junit --output results.xml
        env:
          QA_API_URL: ${{ secrets.QA_API_URL }}
          QA_API_TOKEN: ${{ secrets.QA_API_TOKEN }}
      - name: Publish Test Results
        uses: EnricoMi/publish-unit-test-result-action@v2
        if: always()
        with:
          files: results.xml

GitLab CI

test:
  stage: test
  script:
    - qa-cli test $SUITE_ID --format junit --output test-results.xml
  artifacts:
    reports:
      junit: test-results.xml

Webhook Setup

GitHub:

  1. Go to repository Settings → Webhooks
  2. Add webhook URL: https://your-domain.com/api/webhooks/github
  3. Select events: Push, Pull Request
  4. Add secret (optional but recommended)

GitLab:

  1. Go to project Settings → Webhooks
  2. Add webhook URL: https://your-domain.com/api/webhooks/gitlab
  3. Select triggers: Push events, Merge request events
  4. Add secret token

Environment Variables

Backend (.env):

MONGODB_URI=mongodb+srv://...
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-secret-key
JWT_EXPIRES_IN=24h
PORT=3001
NODE_ENV=development
GEMINI_API_KEY=your-gemini-api-key

Frontend (.env):

VITE_API_URL=http://localhost:3001

CLI (.env):

QA_API_URL=http://localhost:3001/api
QA_API_TOKEN=your-api-token

Production Deployment

Using Docker Compose

  1. Build production images:

    docker-compose -f docker-compose.prod.yml build
  2. Start services:

    docker-compose -f docker-compose.prod.yml up -d
  3. Check logs:

    docker-compose -f docker-compose.prod.yml logs -f

Manual Deployment

Backend:

cd backend
npm install
npm run build
NODE_ENV=production node dist/index.js

Frontend:

cd frontend
npm install
npm run build
# Serve the dist/ folder with nginx or any static file server

Database Backup

MongoDB:

mongodump --uri="mongodb://..." --out=./backup

Restore:

mongorestore --uri="mongodb://..." ./backup

Security Considerations

  • Change default JWT_SECRET in production
  • Use HTTPS for all API communications
  • Enable rate limiting (already configured)
  • Regularly update dependencies
  • Use environment-specific API keys
  • Implement proper CORS policies
  • Store sensitive data in environment variables
  • Use secure MongoDB connection strings
  • Enable Redis authentication in production

Performance Optimization

  • Redis caching is enabled for dashboard metrics (5-minute TTL)
  • Database indexes are configured for frequently queried fields
  • Pagination is implemented for large datasets (50 items per page)
  • Request rate limiting prevents abuse
  • Bull queue handles async test execution with 50 concurrent jobs

Troubleshooting

MongoDB Connection Issues:

  • Verify MONGODB_URI is correct
  • Check network connectivity
  • Ensure MongoDB Atlas IP whitelist includes your IP

Redis Connection Issues:

  • Verify Redis is running: docker ps
  • Check REDIS_URL configuration
  • Restart Redis: docker-compose restart redis

Test Execution Failures:

  • Check network connectivity to target APIs
  • Verify environment variables are correctly substituted
  • Review test execution logs in the UI
  • Check Bull queue status

AI Features Not Working:

  • Verify GEMINI_API_KEY is set correctly
  • Check API quota limits
  • Review error logs for specific API errors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors