Back to Skills

test-environment-management

proffesor-for-testing
Updated Today
89 views
99
21
99
View on GitHub
Otherenvironmentdockerkubernetesinfrastructureparitycost-optimization

About

This Claude Skill manages test infrastructure using infrastructure as code, Docker/Kubernetes for consistent environments, and service virtualization. It helps developers ensure environment parity with production and optimize testing costs through auto-shutdown and spot instances. Use it when provisioning test environments or managing testing infrastructure.

Documentation

Test Environment Management

<default_to_action> When managing test environments:

  1. DEFINE environment types (local, CI, staging, prod)
  2. CONTAINERIZE with Docker for consistency
  3. ENSURE parity with production (same versions, configs)
  4. MOCK external services (service virtualization)
  5. OPTIMIZE costs (auto-shutdown, spot instances)

Quick Environment Checklist:

  • Same OS/versions as production
  • Same database type and version
  • Same configuration structure
  • Containers for reproducibility
  • Auto-shutdown after hours

Critical Success Factors:

  • "Works on my machine" = environment inconsistency
  • Infrastructure as Code = repeatable environments
  • Service virtualization = test without external dependencies </default_to_action>

Quick Reference Card

When to Use

  • Setting up test infrastructure
  • Debugging environment-specific failures
  • Reducing test infrastructure costs
  • Ensuring dev/prod parity

Environment Types

TypePurposeLifetime
LocalFast feedbackDeveloper session
CIAutomated testsPer build (ephemeral)
StagingPre-prod validationPersistent
ProductionCanary/syntheticContinuous

Dev/Prod Parity Checklist

ItemMust Match
OSSame version
DatabaseSame type + version
DependenciesSame versions
ConfigSame structure
Env varsSame names

Docker for Test Environments

# docker-compose.test.yml
version: '3.8'

services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      NODE_ENV: test
      DATABASE_URL: postgres://postgres:password@db:5432/test
    depends_on:
      - db
      - redis

  db:
    image: postgres:15
    environment:
      POSTGRES_DB: test
      POSTGRES_PASSWORD: password

  redis:
    image: redis:7

Run tests in container:

docker-compose -f docker-compose.test.yml up -d
docker-compose -f docker-compose.test.yml exec app npm test
docker-compose -f docker-compose.test.yml down

Infrastructure as Code

# test-environment.tf
resource "aws_instance" "test_server" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t3.medium"

  tags = {
    Name         = "test-environment"
    Environment  = "test"
    AutoShutdown = "20:00" # Cost optimization
  }
}

resource "aws_rds_instance" "test_db" {
  engine                  = "postgres"
  engine_version          = "15"
  instance_class          = "db.t3.micro"
  backup_retention_period = 0 # No backups needed for test
  skip_final_snapshot     = true
}

Service Virtualization

// Mock external services with WireMock
import { WireMock } from 'wiremock-captain';

const wiremock = new WireMock('http://localhost:8080');

// Mock payment gateway
await wiremock.register({
  request: {
    method: 'POST',
    url: '/charge'
  },
  response: {
    status: 200,
    jsonBody: { transactionId: '12345', status: 'approved' }
  }
});

// Tests use mock instead of real gateway

Cost Optimization

# Auto-shutdown test environments after hours
0 20 * * * aws ec2 stop-instances --instance-ids $(aws ec2 describe-instances \
  --filters "Name=tag:Environment,Values=test" \
  --query "Reservations[].Instances[].InstanceId" --output text)

# Start before work hours
0 7 * * 1-5 aws ec2 start-instances --instance-ids $(aws ec2 describe-instances \
  --filters "Name=tag:Environment,Values=test" \
  --query "Reservations[].Instances[].InstanceId" --output text)

Use spot instances (70% savings):

resource "aws_instance" "test_runner" {
  instance_type = "c5.2xlarge"
  instance_market_options {
    market_type = "spot"
    spot_options {
      max_price = "0.10"
    }
  }
}

Agent-Driven Environment Management

// Provision test environment
await Task("Environment Provisioning", {
  type: 'integration-testing',
  services: ['app', 'db', 'redis', 'mocks'],
  parity: 'production',
  lifetime: '2h'
}, "qe-test-executor");

// Chaos testing in isolated environment
await Task("Chaos Test Environment", {
  baseline: 'staging',
  isolate: true,
  injectFaults: ['network-delay', 'pod-failure']
}, "qe-chaos-engineer");

Agent Coordination Hints

Memory Namespace

aqe/environment-management/
├── configs/*            - Environment configurations
├── parity-checks/*      - Dev/prod parity results
├── cost-reports/*       - Infrastructure costs
└── service-mocks/*      - Service virtualization configs

Fleet Coordination

const envFleet = await FleetManager.coordinate({
  strategy: 'environment-management',
  agents: [
    'qe-test-executor',       // Provision environments
    'qe-performance-tester',  // Environment performance
    'qe-chaos-engineer'       // Resilience testing
  ],
  topology: 'sequential'
});

Related Skills


Remember

Environment inconsistency = flaky tests. "Works on my machine" problems come from: different OS/versions, missing dependencies, configuration differences, data differences.

Infrastructure as Code ensures repeatability. Version control your environment configurations. Spin up identical environments on demand.

With Agents: Agents automatically provision test environments matching production, ensure parity, mock external services, and optimize costs with auto-scaling and auto-shutdown.

Quick Install

/plugin add https://github.com/proffesor-for-testing/agentic-qe/tree/main/test-environment-management

Copy and paste this command in Claude Code to install this skill

GitHub 仓库

proffesor-for-testing/agentic-qe
Path: .claude/skills/test-environment-management
agenticqeagenticsfoundationagentsquality-engineering

Related Skills

test-design-techniques

Other

This Claude Skill provides systematic test design techniques including boundary value analysis, equivalence partitioning, and decision tables. It helps developers create comprehensive test cases while reducing redundancy through methods like pairwise testing. Use it when designing tests for complex business rules, stateful behavior, or ensuring systematic coverage.

View skill

regression-testing

Other

This skill strategically selects and runs regression tests based on code changes and risk, ensuring fixes don't break existing functionality. It analyzes impact, optimizes test execution for faster feedback, and helps manage continuous regression within CI/CD. Use it for verifying changes, planning test suites, or streamlining test execution.

View skill

mobile-testing

Other

This Claude Skill provides comprehensive mobile testing for iOS and Android applications, covering gestures, sensors, permissions, and device fragmentation. Use it when testing native apps, hybrid apps, or mobile web to ensure quality across 1000+ device variants. It focuses on platform differences, real-device validation, and mobile-specific scenarios like offline mode.

View skill

compatibility-testing

Other

This skill performs automated cross-browser, cross-platform, and cross-device compatibility testing to ensure a consistent user experience. It's used for validating browser support, testing responsive design, and ensuring platform compatibility by running parallel tests across a defined browser matrix and devices. Key features include using cloud services for device coverage and comparing visual screenshots.

View skill