CI/CD Setup

Integrate AIToTest into your continuous integration pipeline

Platform Integration

GitHub Actions

name: Test

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v2
      - name: Install AIToTest
        run: npm install -g aitotest
      - name: Run Tests
        run: aitotest run
        env:
          AITOTEST_API_KEY: ${{ secrets.AITOTEST_API_KEY }}

GitLab CI

test:
  image: node:latest
  script:
    - npm install -g aitotest
    - aitotest run
  variables:
    AITOTEST_API_KEY: $AITOTEST_API_KEY

Jenkins Pipeline

pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        sh 'npm install -g aitotest'
        sh 'aitotest run'
      }
    }
  }
  environment {
    AITOTEST_API_KEY = credentials('aitotest-api-key')
  }
}

Configuration Options

CI Configuration File

// aitotest.ci.js
module.exports = {
  ci: {
    // Test execution
    runner: {
      parallel: true,
      maxWorkers: 4,
      timeout: 30000
    },
    
    // Coverage requirements
    coverage: {
      statements: 80,
      branches: 70,
      functions: 80,
      lines: 80
    },
    
    // Reporting
    reports: {
      formats: ['html', 'json'],
      directory: './reports',
      publish: true
    },
    
    // Notifications
    notifications: {
      slack: {
        webhook: process.env.SLACK_WEBHOOK,
        channel: '#testing'
      },
      email: {
        recipients: ['team@example.com']
      }
    }
  }
}

Pipeline Stages

Pre-Test Stage

  • Install dependencies
  • Setup test environment
  • Configure test database
  • Prepare test data

Post-Test Stage

  • Generate coverage reports
  • Upload test artifacts
  • Send notifications
  • Clean up resources

Best Practices

Security

  • Use secret management
  • Rotate API keys regularly
  • Limit permissions
  • Scan dependencies

Performance

  • Cache dependencies
  • Run tests in parallel
  • Use test splitting
  • Optimize build time

Reliability

  • Use retry mechanisms
  • Handle timeouts
  • Monitor test stability
  • Track flaky tests

Advanced Features

Matrix Testing

jobs:
  test:
    strategy:
      matrix:
        node-version: [14, 16, 18]
        os: [ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
      - run: aitotest run

Monitoring & Analytics

Metrics to Track

  • Test execution time
  • Coverage trends
  • Failure rates
  • Resource usage

Integration Options

  • Prometheus metrics
  • Grafana dashboards
  • Custom webhooks
  • API endpoints