test-environment-management
π―Skillfrom proffesor-for-testing/agentic-qe
Provisions and manages consistent, cost-effective test environments using Docker, Kubernetes, and infrastructure as code for reliable software testing.
Installation
npx skills add https://github.com/proffesor-for-testing/agentic-qe --skill test-environment-managementSkill Details
"Test environment provisioning, infrastructure as code for testing, Docker/Kubernetes for test environments, service virtualization, and cost optimization. Use when managing test infrastructure, ensuring environment parity, or optimizing testing costs."
Overview
# Test Environment Management
When managing test environments:
- DEFINE environment types (local, CI, staging, prod)
- CONTAINERIZE with Docker for consistency
- ENSURE parity with production (same versions, configs)
- MOCK external services (service virtualization)
- 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
Quick Reference Card
When to Use
- Setting up test infrastructure
- Debugging environment-specific failures
- Reducing test infrastructure costs
- Ensuring dev/prod parity
Environment Types
| Type | Purpose | Lifetime |
|------|---------|----------|
| Local | Fast feedback | Developer session |
| CI | Automated tests | Per build (ephemeral) |
| Staging | Pre-prod validation | Persistent |
| Production | Canary/synthetic | Continuous |
Dev/Prod Parity Checklist
| Item | Must Match |
|------|------------|
| OS | Same version |
| Database | Same type + version |
| Dependencies | Same versions |
| Config | Same structure |
| Env vars | Same names |
---
Docker for Test Environments
```yaml
# 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:
```bash
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
```hcl
# 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
```javascript
// 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
```bash
# 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):
```hcl
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
```typescript
// 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
```typescript
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
- [test-data-management](../test-data-management/) - Data for environments
- [continuous-testing-shift-left](../continuous-testing-shift-left/) - CI/CD environments
- [chaos-engineering-resilience](../chaos-engineering-resilience/) - Environment resilience
---
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.
More from this repository10
Automates security vulnerability scanning and penetration testing for n8n workflows, identifying potential risks and misconfigurations.
Validates database schemas, tests data integrity, verifies migrations, checks transaction isolation, and measures query performance.
Delivers unvarnished technical criticism with surgical precision, combining expert-level BS detection and zero-tolerance for low-quality work.
n8n-expression-testing skill from proffesor-for-testing/agentic-qe
Validates n8n workflow triggers by comprehensively testing webhook, schedule, polling, and event-driven mechanisms with robust payload and authentication checks.
Validates n8n integration connectivity, authentication flows, and error handling across external service APIs through comprehensive testing patterns.
Applies Six Thinking Hats methodology to systematically analyze software testing challenges from multiple perspectives, enhancing decision-making and test strategy development.
Prioritizes testing efforts by systematically assessing and ranking risks based on probability and potential impact across software components.
Accelerates software quality by moving testing earlier in development, reducing defect costs through proactive validation, automated testing, and continuous improvement practices.
context-driven-testing skill from proffesor-for-testing/agentic-qe