agentic-qe 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/qe-coverage-analyzer.md +8 -0
- package/.claude/agents/qe-flaky-test-hunter.md +9 -1
- package/.claude/agents/qe-test-generator.md +7 -0
- package/.claude/agents/reasoning/agent.md +816 -0
- package/.claude/agents/reasoning/goal-planner.md +73 -0
- package/.claude/settings.json +64 -25
- package/.claude/skills/README.md +124 -0
- package/.claude/skills/accessibility-testing/SKILL.md +777 -0
- package/.claude/skills/agentdb-advanced/SKILL.md +550 -0
- package/.claude/skills/agentdb-learning/SKILL.md +545 -0
- package/.claude/skills/agentdb-memory-patterns/SKILL.md +339 -0
- package/.claude/skills/agentdb-optimization/SKILL.md +509 -0
- package/.claude/skills/agentdb-vector-search/SKILL.md +339 -0
- package/.claude/skills/agentic-quality-engineering/SKILL.md +604 -0
- package/.claude/skills/api-testing-patterns/SKILL.md +686 -0
- package/.claude/skills/bug-reporting-excellence/SKILL.md +632 -0
- package/.claude/skills/chaos-engineering-resilience/SKILL.md +109 -0
- package/.claude/skills/code-review-quality/SKILL.md +683 -0
- package/.claude/skills/compatibility-testing/SKILL.md +101 -0
- package/.claude/skills/compliance-testing/SKILL.md +162 -0
- package/.claude/skills/consultancy-practices/SKILL.md +540 -0
- package/.claude/skills/context-driven-testing/SKILL.md +466 -0
- package/.claude/skills/contract-testing/SKILL.md +193 -0
- package/.claude/skills/database-testing/SKILL.md +243 -0
- package/.claude/skills/exploratory-testing-advanced/SKILL.md +676 -0
- package/.claude/skills/flow-nexus-neural/SKILL.md +738 -0
- package/.claude/skills/flow-nexus-platform/SKILL.md +1157 -0
- package/.claude/skills/flow-nexus-swarm/SKILL.md +610 -0
- package/.claude/skills/github-code-review/SKILL.md +1140 -0
- package/.claude/skills/github-multi-repo/SKILL.md +874 -0
- package/.claude/skills/github-project-management/SKILL.md +1277 -0
- package/.claude/skills/github-release-management/SKILL.md +1081 -0
- package/.claude/skills/github-workflow-automation/SKILL.md +1065 -0
- package/.claude/skills/hive-mind-advanced/SKILL.md +712 -0
- package/.claude/skills/holistic-testing-pact/SKILL.md +225 -0
- package/.claude/skills/hooks-automation/SKILL.md +1201 -0
- package/.claude/skills/localization-testing/SKILL.md +115 -0
- package/.claude/skills/mobile-testing/SKILL.md +548 -0
- package/.claude/skills/mutation-testing/SKILL.md +129 -0
- package/.claude/skills/pair-programming/SKILL.md +1202 -0
- package/.claude/skills/performance-analysis/SKILL.md +563 -0
- package/.claude/skills/performance-testing/SKILL.md +662 -0
- package/.claude/skills/quality-metrics/SKILL.md +592 -0
- package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
- package/.claude/skills/refactoring-patterns/SKILL.md +778 -0
- package/.claude/skills/regression-testing/SKILL.md +1045 -0
- package/.claude/skills/risk-based-testing/SKILL.md +721 -0
- package/.claude/skills/security-testing/SKILL.md +651 -0
- package/.claude/skills/shift-left-testing/SKILL.md +535 -0
- package/.claude/skills/shift-right-testing/SKILL.md +591 -0
- package/.claude/skills/skill-builder/SKILL.md +910 -0
- package/.claude/skills/sparc-methodology/SKILL.md +1115 -0
- package/.claude/skills/stream-chain/SKILL.md +563 -0
- package/.claude/skills/swarm-advanced/SKILL.md +973 -0
- package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
- package/.claude/skills/tdd-london-chicago/SKILL.md +567 -0
- package/.claude/skills/technical-writing/SKILL.md +235 -0
- package/.claude/skills/test-automation-strategy/SKILL.md +842 -0
- package/.claude/skills/test-data-management/SKILL.md +1067 -0
- package/.claude/skills/test-design-techniques/SKILL.md +160 -0
- package/.claude/skills/test-environment-management/SKILL.md +204 -0
- package/.claude/skills/test-reporting-analytics/SKILL.md +143 -0
- package/.claude/skills/verification-quality/SKILL.md +649 -0
- package/.claude/skills/visual-testing-advanced/SKILL.md +148 -0
- package/.claude/skills/xp-practices/SKILL.md +671 -0
- package/.claude/statusline-command.sh +176 -0
- package/CHANGELOG.md +623 -6
- package/README.md +101 -5
- package/config/improvement-loop.config.ts +323 -0
- package/config/neural-agent.config.ts +197 -0
- package/dist/adapters/MemoryStoreAdapter.d.ts +16 -16
- package/dist/adapters/MemoryStoreAdapter.d.ts.map +1 -1
- package/dist/adapters/MemoryStoreAdapter.js +16 -16
- package/dist/adapters/MemoryStoreAdapter.js.map +1 -1
- package/dist/agents/BaseAgent.d.ts +69 -0
- package/dist/agents/BaseAgent.d.ts.map +1 -1
- package/dist/agents/BaseAgent.js +387 -5
- package/dist/agents/BaseAgent.js.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.d.ts +13 -2
- package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.js +112 -12
- package/dist/agents/CoverageAnalyzerAgent.js.map +1 -1
- package/dist/agents/DeploymentReadinessAgent.d.ts.map +1 -1
- package/dist/agents/DeploymentReadinessAgent.js +13 -13
- package/dist/agents/DeploymentReadinessAgent.js.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.d.ts +28 -0
- package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.js +160 -4
- package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
- package/dist/agents/FleetCommanderAgent.d.ts.map +1 -1
- package/dist/agents/FleetCommanderAgent.js +4 -3
- package/dist/agents/FleetCommanderAgent.js.map +1 -1
- package/dist/agents/LearningAgent.d.ts +14 -5
- package/dist/agents/LearningAgent.d.ts.map +1 -1
- package/dist/agents/LearningAgent.js +36 -16
- package/dist/agents/LearningAgent.js.map +1 -1
- package/dist/agents/NeuralAgentExtension.d.ts +117 -0
- package/dist/agents/NeuralAgentExtension.d.ts.map +1 -0
- package/dist/agents/NeuralAgentExtension.js +288 -0
- package/dist/agents/NeuralAgentExtension.js.map +1 -0
- package/dist/agents/PerformanceTesterAgent.d.ts.map +1 -1
- package/dist/agents/PerformanceTesterAgent.js +11 -9
- package/dist/agents/PerformanceTesterAgent.js.map +1 -1
- package/dist/agents/ProductionIntelligenceAgent.d.ts.map +1 -1
- package/dist/agents/ProductionIntelligenceAgent.js +14 -13
- package/dist/agents/ProductionIntelligenceAgent.js.map +1 -1
- package/dist/agents/QualityAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/QualityAnalyzerAgent.js +39 -38
- package/dist/agents/QualityAnalyzerAgent.js.map +1 -1
- package/dist/agents/QualityGateAgent.d.ts.map +1 -1
- package/dist/agents/QualityGateAgent.js +7 -6
- package/dist/agents/QualityGateAgent.js.map +1 -1
- package/dist/agents/RegressionRiskAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/RegressionRiskAnalyzerAgent.js +22 -21
- package/dist/agents/RegressionRiskAnalyzerAgent.js.map +1 -1
- package/dist/agents/RequirementsValidatorAgent.d.ts.map +1 -1
- package/dist/agents/RequirementsValidatorAgent.js +1 -1
- package/dist/agents/RequirementsValidatorAgent.js.map +1 -1
- package/dist/agents/SecurityScannerAgent.d.ts.map +1 -1
- package/dist/agents/SecurityScannerAgent.js +8 -7
- package/dist/agents/SecurityScannerAgent.js.map +1 -1
- package/dist/agents/TestDataArchitectAgent.d.ts.map +1 -1
- package/dist/agents/TestDataArchitectAgent.js +12 -11
- package/dist/agents/TestDataArchitectAgent.js.map +1 -1
- package/dist/agents/TestExecutorAgent.d.ts.map +1 -1
- package/dist/agents/TestExecutorAgent.js +18 -19
- package/dist/agents/TestExecutorAgent.js.map +1 -1
- package/dist/agents/TestGeneratorAgent.d.ts +15 -4
- package/dist/agents/TestGeneratorAgent.d.ts.map +1 -1
- package/dist/agents/TestGeneratorAgent.js +172 -49
- package/dist/agents/TestGeneratorAgent.js.map +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/mixins/NeuralCapableMixin.d.ts +130 -0
- package/dist/agents/mixins/NeuralCapableMixin.d.ts.map +1 -0
- package/dist/agents/mixins/NeuralCapableMixin.js +358 -0
- package/dist/agents/mixins/NeuralCapableMixin.js.map +1 -0
- package/dist/agents/mixins/QUICCapableMixin.d.ts +34 -0
- package/dist/agents/mixins/QUICCapableMixin.d.ts.map +1 -0
- package/dist/agents/mixins/QUICCapableMixin.js +346 -0
- package/dist/agents/mixins/QUICCapableMixin.js.map +1 -0
- package/dist/cli/commands/agent/benchmark.d.ts.map +1 -1
- package/dist/cli/commands/agent/benchmark.js +2 -1
- package/dist/cli/commands/agent/benchmark.js.map +1 -1
- package/dist/cli/commands/agent/index.d.ts +5 -0
- package/dist/cli/commands/agent/index.d.ts.map +1 -1
- package/dist/cli/commands/agent/index.js +11 -6
- package/dist/cli/commands/agent/index.js.map +1 -1
- package/dist/cli/commands/agent/kill.d.ts +13 -0
- package/dist/cli/commands/agent/kill.d.ts.map +1 -0
- package/dist/cli/commands/agent/kill.js +65 -0
- package/dist/cli/commands/agent/kill.js.map +1 -0
- package/dist/cli/commands/agent/list.d.ts +19 -0
- package/dist/cli/commands/agent/list.d.ts.map +1 -0
- package/dist/cli/commands/agent/list.js +92 -0
- package/dist/cli/commands/agent/list.js.map +1 -0
- package/dist/cli/commands/agent/logs.d.ts +14 -0
- package/dist/cli/commands/agent/logs.d.ts.map +1 -0
- package/dist/cli/commands/agent/logs.js +77 -0
- package/dist/cli/commands/agent/logs.js.map +1 -0
- package/dist/cli/commands/agent/metrics.d.ts +21 -0
- package/dist/cli/commands/agent/metrics.d.ts.map +1 -0
- package/dist/cli/commands/agent/metrics.js +87 -0
- package/dist/cli/commands/agent/metrics.js.map +1 -0
- package/dist/cli/commands/agent/spawn.d.ts +28 -0
- package/dist/cli/commands/agent/spawn.d.ts.map +1 -0
- package/dist/cli/commands/agent/spawn.js +84 -0
- package/dist/cli/commands/agent/spawn.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -1
- package/dist/cli/commands/analyze.js +2 -1
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/config/list.d.ts.map +1 -1
- package/dist/cli/commands/config/list.js +2 -1
- package/dist/cli/commands/config/list.js.map +1 -1
- package/dist/cli/commands/config/set.d.ts +7 -0
- package/dist/cli/commands/config/set.d.ts.map +1 -1
- package/dist/cli/commands/config/set.js +35 -4
- package/dist/cli/commands/config/set.js.map +1 -1
- package/dist/cli/commands/fleet/logs.d.ts.map +1 -1
- package/dist/cli/commands/fleet/logs.js +2 -1
- package/dist/cli/commands/fleet/logs.js.map +1 -1
- package/dist/cli/commands/fleet/metrics.d.ts.map +1 -1
- package/dist/cli/commands/fleet/metrics.js +2 -1
- package/dist/cli/commands/fleet/metrics.js.map +1 -1
- package/dist/cli/commands/fleet/monitor.d.ts.map +1 -1
- package/dist/cli/commands/fleet/monitor.js +7 -5
- package/dist/cli/commands/fleet/monitor.js.map +1 -1
- package/dist/cli/commands/fleet.d.ts.map +1 -1
- package/dist/cli/commands/fleet.js +2 -1
- package/dist/cli/commands/fleet.js.map +1 -1
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +2 -1
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/improve/index.d.ts.map +1 -1
- package/dist/cli/commands/improve/index.js +12 -11
- package/dist/cli/commands/improve/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +24 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +503 -11
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learn/index.d.ts.map +1 -1
- package/dist/cli/commands/learn/index.js +13 -12
- package/dist/cli/commands/learn/index.js.map +1 -1
- package/dist/cli/commands/monitor/alerts.d.ts.map +1 -1
- package/dist/cli/commands/monitor/alerts.js +2 -1
- package/dist/cli/commands/monitor/alerts.js.map +1 -1
- package/dist/cli/commands/patterns/index.d.ts.map +1 -1
- package/dist/cli/commands/patterns/index.js +20 -19
- package/dist/cli/commands/patterns/index.js.map +1 -1
- package/dist/cli/commands/quality/decision.d.ts.map +1 -1
- package/dist/cli/commands/quality/decision.js +9 -7
- package/dist/cli/commands/quality/decision.js.map +1 -1
- package/dist/cli/commands/quality/gate.d.ts.map +1 -1
- package/dist/cli/commands/quality/gate.js +10 -8
- package/dist/cli/commands/quality/gate.js.map +1 -1
- package/dist/cli/commands/quality/policy.d.ts.map +1 -1
- package/dist/cli/commands/quality/policy.js +10 -8
- package/dist/cli/commands/quality/policy.js.map +1 -1
- package/dist/cli/commands/quality/risk.d.ts.map +1 -1
- package/dist/cli/commands/quality/risk.js +5 -3
- package/dist/cli/commands/quality/risk.js.map +1 -1
- package/dist/cli/commands/quality/validate.d.ts.map +1 -1
- package/dist/cli/commands/quality/validate.js +10 -8
- package/dist/cli/commands/quality/validate.js.map +1 -1
- package/dist/cli/commands/quantization.d.ts +6 -0
- package/dist/cli/commands/quantization.d.ts.map +1 -0
- package/dist/cli/commands/quantization.js +188 -0
- package/dist/cli/commands/quantization.js.map +1 -0
- package/dist/cli/commands/routing/index.d.ts +0 -6
- package/dist/cli/commands/routing/index.d.ts.map +1 -1
- package/dist/cli/commands/routing/index.js +17 -16
- package/dist/cli/commands/routing/index.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +2 -1
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/skills/index.d.ts +51 -0
- package/dist/cli/commands/skills/index.d.ts.map +1 -0
- package/dist/cli/commands/skills/index.js +365 -0
- package/dist/cli/commands/skills/index.js.map +1 -0
- package/dist/cli/commands/test/debug.d.ts.map +1 -1
- package/dist/cli/commands/test/debug.js +2 -1
- package/dist/cli/commands/test/debug.js.map +1 -1
- package/dist/cli/commands/test/mutate.d.ts.map +1 -1
- package/dist/cli/commands/test/mutate.js +2 -1
- package/dist/cli/commands/test/mutate.js.map +1 -1
- package/dist/cli/commands/test/parallel.d.ts.map +1 -1
- package/dist/cli/commands/test/parallel.js +6 -4
- package/dist/cli/commands/test/parallel.js.map +1 -1
- package/dist/cli/commands/test/profile.d.ts.map +1 -1
- package/dist/cli/commands/test/profile.js +3 -2
- package/dist/cli/commands/test/profile.js.map +1 -1
- package/dist/cli/commands/test/queue.d.ts.map +1 -1
- package/dist/cli/commands/test/queue.js +2 -1
- package/dist/cli/commands/test/queue.js.map +1 -1
- package/dist/cli/commands/test/retry.d.ts.map +1 -1
- package/dist/cli/commands/test/retry.js +6 -4
- package/dist/cli/commands/test/retry.js.map +1 -1
- package/dist/cli/commands/test/trace.d.ts.map +1 -1
- package/dist/cli/commands/test/trace.js +2 -1
- package/dist/cli/commands/test/trace.js.map +1 -1
- package/dist/cli/commands/test/watch.d.ts.map +1 -1
- package/dist/cli/commands/test/watch.js +3 -2
- package/dist/cli/commands/test/watch.js.map +1 -1
- package/dist/cli/commands/workflow/cancel.d.ts.map +1 -1
- package/dist/cli/commands/workflow/cancel.js +2 -1
- package/dist/cli/commands/workflow/cancel.js.map +1 -1
- package/dist/cli/index-working.js +9 -8
- package/dist/cli/index-working.js.map +1 -1
- package/dist/cli/index.js +97 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/core/EventBus.d.ts +38 -0
- package/dist/core/EventBus.d.ts.map +1 -1
- package/dist/core/EventBus.js +176 -31
- package/dist/core/EventBus.js.map +1 -1
- package/dist/core/FleetManager.d.ts +35 -1
- package/dist/core/FleetManager.d.ts.map +1 -1
- package/dist/core/FleetManager.js +121 -45
- package/dist/core/FleetManager.js.map +1 -1
- package/dist/core/MemoryManager.d.ts +19 -1
- package/dist/core/MemoryManager.d.ts.map +1 -1
- package/dist/core/MemoryManager.js +25 -1
- package/dist/core/MemoryManager.js.map +1 -1
- package/dist/core/coordination/OODACoordination.d.ts.map +1 -1
- package/dist/core/coordination/OODACoordination.js +2 -1
- package/dist/core/coordination/OODACoordination.js.map +1 -1
- package/dist/core/embeddings/EmbeddingCache.d.ts +134 -0
- package/dist/core/embeddings/EmbeddingCache.d.ts.map +1 -0
- package/dist/core/embeddings/EmbeddingCache.js +239 -0
- package/dist/core/embeddings/EmbeddingCache.js.map +1 -0
- package/dist/core/embeddings/EmbeddingGenerator.d.ts +224 -0
- package/dist/core/embeddings/EmbeddingGenerator.d.ts.map +1 -0
- package/dist/core/embeddings/EmbeddingGenerator.js +459 -0
- package/dist/core/embeddings/EmbeddingGenerator.js.map +1 -0
- package/dist/core/embeddings/index.d.ts +15 -0
- package/dist/core/embeddings/index.d.ts.map +1 -0
- package/dist/core/embeddings/index.js +22 -0
- package/dist/core/embeddings/index.js.map +1 -0
- package/dist/core/memory/AgentDBIntegration.d.ts +35 -0
- package/dist/core/memory/AgentDBIntegration.d.ts.map +1 -0
- package/dist/core/memory/AgentDBIntegration.js +75 -0
- package/dist/core/memory/AgentDBIntegration.js.map +1 -0
- package/dist/core/memory/AgentDBManager.d.ts +200 -0
- package/dist/core/memory/AgentDBManager.d.ts.map +1 -0
- package/dist/core/memory/AgentDBManager.js +246 -0
- package/dist/core/memory/AgentDBManager.js.map +1 -0
- package/dist/core/memory/AgentDBService.d.ts +160 -0
- package/dist/core/memory/AgentDBService.d.ts.map +1 -0
- package/dist/core/memory/AgentDBService.js +450 -0
- package/dist/core/memory/AgentDBService.js.map +1 -0
- package/dist/core/memory/RealAgentDBAdapter.d.ts +51 -0
- package/dist/core/memory/RealAgentDBAdapter.d.ts.map +1 -0
- package/dist/core/memory/RealAgentDBAdapter.js +231 -0
- package/dist/core/memory/RealAgentDBAdapter.js.map +1 -0
- package/dist/core/memory/ReasoningBankAdapter.d.ts +58 -0
- package/dist/core/memory/ReasoningBankAdapter.d.ts.map +1 -0
- package/dist/core/memory/ReasoningBankAdapter.js +77 -0
- package/dist/core/memory/ReasoningBankAdapter.js.map +1 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts +75 -3
- package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.js +240 -55
- package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
- package/dist/core/memory/index.d.ts +4 -0
- package/dist/core/memory/index.d.ts.map +1 -1
- package/dist/core/memory/index.js +9 -1
- package/dist/core/memory/index.js.map +1 -1
- package/dist/core/neural/NeuralTrainer.d.ts +137 -0
- package/dist/core/neural/NeuralTrainer.d.ts.map +1 -0
- package/dist/core/neural/NeuralTrainer.js +544 -0
- package/dist/core/neural/NeuralTrainer.js.map +1 -0
- package/dist/core/neural/index.d.ts +8 -0
- package/dist/core/neural/index.d.ts.map +1 -0
- package/dist/core/neural/index.js +24 -0
- package/dist/core/neural/index.js.map +1 -0
- package/dist/core/neural/types.d.ts +216 -0
- package/dist/core/neural/types.d.ts.map +1 -0
- package/dist/core/neural/types.js +8 -0
- package/dist/core/neural/types.js.map +1 -0
- package/dist/core/quantization/QuantizationManager.d.ts +83 -0
- package/dist/core/quantization/QuantizationManager.d.ts.map +1 -0
- package/dist/core/quantization/QuantizationManager.js +264 -0
- package/dist/core/quantization/QuantizationManager.js.map +1 -0
- package/dist/core/quantization/index.d.ts +5 -0
- package/dist/core/quantization/index.d.ts.map +1 -0
- package/dist/core/quantization/index.js +9 -0
- package/dist/core/quantization/index.js.map +1 -0
- package/dist/core/security/CertificateValidator.d.ts +130 -0
- package/dist/core/security/CertificateValidator.d.ts.map +1 -0
- package/dist/core/security/CertificateValidator.js +376 -0
- package/dist/core/security/CertificateValidator.js.map +1 -0
- package/dist/core/transport/QUICTransport.d.ts +62 -0
- package/dist/core/transport/QUICTransport.d.ts.map +1 -0
- package/dist/core/transport/QUICTransport.js +381 -0
- package/dist/core/transport/QUICTransport.js.map +1 -0
- package/dist/core/transport/SecureQUICTransport.d.ts +71 -0
- package/dist/core/transport/SecureQUICTransport.d.ts.map +1 -0
- package/dist/core/transport/SecureQUICTransport.js +253 -0
- package/dist/core/transport/SecureQUICTransport.js.map +1 -0
- package/dist/learning/AdvancedFeatureExtractor.d.ts +123 -0
- package/dist/learning/AdvancedFeatureExtractor.d.ts.map +1 -0
- package/dist/learning/AdvancedFeatureExtractor.js +423 -0
- package/dist/learning/AdvancedFeatureExtractor.js.map +1 -0
- package/dist/learning/FlakyPredictionModel.d.ts +11 -1
- package/dist/learning/FlakyPredictionModel.d.ts.map +1 -1
- package/dist/learning/FlakyPredictionModel.js +82 -35
- package/dist/learning/FlakyPredictionModel.js.map +1 -1
- package/dist/learning/FlakyTestDetector.d.ts +9 -0
- package/dist/learning/FlakyTestDetector.d.ts.map +1 -1
- package/dist/learning/FlakyTestDetector.js +28 -6
- package/dist/learning/FlakyTestDetector.js.map +1 -1
- package/dist/learning/ImprovementLoop.d.ts +16 -2
- package/dist/learning/ImprovementLoop.d.ts.map +1 -1
- package/dist/learning/ImprovementLoop.js +67 -8
- package/dist/learning/ImprovementLoop.js.map +1 -1
- package/dist/learning/ImprovementWorker.d.ts +83 -0
- package/dist/learning/ImprovementWorker.d.ts.map +1 -0
- package/dist/learning/ImprovementWorker.js +164 -0
- package/dist/learning/ImprovementWorker.js.map +1 -0
- package/dist/learning/NeuralPatternMatcher.d.ts +184 -0
- package/dist/learning/NeuralPatternMatcher.d.ts.map +1 -0
- package/dist/learning/NeuralPatternMatcher.js +702 -0
- package/dist/learning/NeuralPatternMatcher.js.map +1 -0
- package/dist/learning/NeuralTrainer.d.ts +209 -0
- package/dist/learning/NeuralTrainer.d.ts.map +1 -0
- package/dist/learning/NeuralTrainer.js +478 -0
- package/dist/learning/NeuralTrainer.js.map +1 -0
- package/dist/learning/index.d.ts +13 -7
- package/dist/learning/index.d.ts.map +1 -1
- package/dist/learning/index.js +27 -11
- package/dist/learning/index.js.map +1 -1
- package/dist/learning/types.d.ts +1 -0
- package/dist/learning/types.d.ts.map +1 -1
- package/dist/learning/types.js +16 -0
- package/dist/learning/types.js.map +1 -1
- package/dist/mcp/MCPToolRegistry.d.ts +34 -0
- package/dist/mcp/MCPToolRegistry.d.ts.map +1 -0
- package/dist/mcp/MCPToolRegistry.js +48 -0
- package/dist/mcp/MCPToolRegistry.js.map +1 -0
- package/dist/mcp/handlers/advanced/mutation-test-execute.d.ts +3 -3
- package/dist/mcp/handlers/advanced/mutation-test-execute.d.ts.map +1 -1
- package/dist/mcp/handlers/advanced/mutation-test-execute.js +5 -4
- package/dist/mcp/handlers/advanced/mutation-test-execute.js.map +1 -1
- package/dist/mcp/handlers/agent-spawn.d.ts.map +1 -1
- package/dist/mcp/handlers/agent-spawn.js +2 -1
- package/dist/mcp/handlers/agent-spawn.js.map +1 -1
- package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.js +9 -8
- package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.js.map +1 -1
- package/dist/mcp/handlers/analysis/coverageGapsDetect.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/coverageGapsDetect.js +6 -5
- package/dist/mcp/handlers/analysis/coverageGapsDetect.js.map +1 -1
- package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js +5 -4
- package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js.map +1 -1
- package/dist/mcp/handlers/analysis/performanceBenchmarkRun.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/performanceBenchmarkRun.js +8 -7
- package/dist/mcp/handlers/analysis/performanceBenchmarkRun.js.map +1 -1
- package/dist/mcp/handlers/analysis/performanceMonitorRealtime.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/performanceMonitorRealtime.js +7 -6
- package/dist/mcp/handlers/analysis/performanceMonitorRealtime.js.map +1 -1
- package/dist/mcp/handlers/analysis/securityScanComprehensive.d.ts.map +1 -1
- package/dist/mcp/handlers/analysis/securityScanComprehensive.js +18 -21
- package/dist/mcp/handlers/analysis/securityScanComprehensive.js.map +1 -1
- package/dist/mcp/handlers/base-handler.d.ts.map +1 -1
- package/dist/mcp/handlers/base-handler.js +2 -9
- package/dist/mcp/handlers/base-handler.js.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-failure.d.ts.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-failure.js +4 -3
- package/dist/mcp/handlers/chaos/chaos-inject-failure.js.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-latency.d.ts.map +1 -1
- package/dist/mcp/handlers/chaos/chaos-inject-latency.js +6 -5
- package/dist/mcp/handlers/chaos/chaos-inject-latency.js.map +1 -1
- package/dist/mcp/handlers/coordination/event-emit.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/event-emit.js +2 -1
- package/dist/mcp/handlers/coordination/event-emit.js.map +1 -1
- package/dist/mcp/handlers/coordination/event-subscribe.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/event-subscribe.js +2 -1
- package/dist/mcp/handlers/coordination/event-subscribe.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-checkpoint.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-checkpoint.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-checkpoint.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-create.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-create.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-create.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-execute.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-execute.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-execute.js.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-resume.d.ts.map +1 -1
- package/dist/mcp/handlers/coordination/workflow-resume.js +2 -1
- package/dist/mcp/handlers/coordination/workflow-resume.js.map +1 -1
- package/dist/mcp/handlers/fleet-init.d.ts.map +1 -1
- package/dist/mcp/handlers/fleet-init.js +2 -1
- package/dist/mcp/handlers/fleet-init.js.map +1 -1
- package/dist/mcp/handlers/fleet-status.d.ts.map +1 -1
- package/dist/mcp/handlers/fleet-status.js +31 -30
- package/dist/mcp/handlers/fleet-status.js.map +1 -1
- package/dist/mcp/handlers/integration/dependency-check.d.ts.map +1 -1
- package/dist/mcp/handlers/integration/dependency-check.js +3 -2
- package/dist/mcp/handlers/integration/dependency-check.js.map +1 -1
- package/dist/mcp/handlers/integration/integration-test-orchestrate.d.ts.map +1 -1
- package/dist/mcp/handlers/integration/integration-test-orchestrate.js +2 -1
- package/dist/mcp/handlers/integration/integration-test-orchestrate.js.map +1 -1
- package/dist/mcp/handlers/optimize-tests.d.ts.map +1 -1
- package/dist/mcp/handlers/optimize-tests.js +33 -32
- package/dist/mcp/handlers/optimize-tests.js.map +1 -1
- package/dist/mcp/handlers/predict-defects.d.ts.map +1 -1
- package/dist/mcp/handlers/predict-defects.js +46 -45
- package/dist/mcp/handlers/predict-defects.js.map +1 -1
- package/dist/mcp/handlers/prediction/deployment-readiness-check.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/deployment-readiness-check.js +24 -23
- package/dist/mcp/handlers/prediction/deployment-readiness-check.js.map +1 -1
- package/dist/mcp/handlers/prediction/predict-defects-ai.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/predict-defects-ai.js +10 -9
- package/dist/mcp/handlers/prediction/predict-defects-ai.js.map +1 -1
- package/dist/mcp/handlers/prediction/regression-risk-analyze.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/regression-risk-analyze.js +10 -9
- package/dist/mcp/handlers/prediction/regression-risk-analyze.js.map +1 -1
- package/dist/mcp/handlers/prediction/visual-test-regression.d.ts.map +1 -1
- package/dist/mcp/handlers/prediction/visual-test-regression.js +7 -6
- package/dist/mcp/handlers/prediction/visual-test-regression.js.map +1 -1
- package/dist/mcp/handlers/quality-analyze.d.ts.map +1 -1
- package/dist/mcp/handlers/quality-analyze.js +53 -52
- package/dist/mcp/handlers/quality-analyze.js.map +1 -1
- package/dist/mcp/handlers/task-orchestrate.d.ts.map +1 -1
- package/dist/mcp/handlers/task-orchestrate.js +19 -18
- package/dist/mcp/handlers/task-orchestrate.js.map +1 -1
- package/dist/mcp/handlers/test/test-execute-parallel.d.ts.map +1 -1
- package/dist/mcp/handlers/test/test-execute-parallel.js +7 -6
- package/dist/mcp/handlers/test/test-execute-parallel.js.map +1 -1
- package/dist/mcp/handlers/test/test-generate-enhanced.d.ts.map +1 -1
- package/dist/mcp/handlers/test/test-generate-enhanced.js +2 -1
- package/dist/mcp/handlers/test/test-generate-enhanced.js.map +1 -1
- package/dist/mcp/handlers/test/test-optimize-sublinear.d.ts.map +1 -1
- package/dist/mcp/handlers/test/test-optimize-sublinear.js +3 -2
- package/dist/mcp/handlers/test/test-optimize-sublinear.js.map +1 -1
- package/dist/mcp/handlers/test-execute.d.ts.map +1 -1
- package/dist/mcp/handlers/test-execute.js +11 -10
- package/dist/mcp/handlers/test-execute.js.map +1 -1
- package/dist/mcp/handlers/test-generate.d.ts.map +1 -1
- package/dist/mcp/handlers/test-generate.js +4 -3
- package/dist/mcp/handlers/test-generate.js.map +1 -1
- package/dist/mcp/server.d.ts +4 -4
- package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
- package/dist/mcp/services/AgentRegistry.js +9 -2
- package/dist/mcp/services/AgentRegistry.js.map +1 -1
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.d.ts.map +1 -1
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js +10 -9
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js.map +1 -1
- package/dist/mcp/streaming/StreamingMCPTool.d.ts.map +1 -1
- package/dist/mcp/streaming/StreamingMCPTool.js +2 -1
- package/dist/mcp/streaming/StreamingMCPTool.js.map +1 -1
- package/dist/mcp/streaming/TestExecuteStreamHandler.d.ts.map +1 -1
- package/dist/mcp/streaming/TestExecuteStreamHandler.js +6 -5
- package/dist/mcp/streaming/TestExecuteStreamHandler.js.map +1 -1
- package/dist/reasoning/TestTemplateCreator.d.ts +10 -2
- package/dist/reasoning/TestTemplateCreator.d.ts.map +1 -1
- package/dist/reasoning/TestTemplateCreator.js +81 -21
- package/dist/reasoning/TestTemplateCreator.js.map +1 -1
- package/dist/transport/QUICTransport.d.ts +340 -0
- package/dist/transport/QUICTransport.d.ts.map +1 -0
- package/dist/transport/QUICTransport.js +814 -0
- package/dist/transport/QUICTransport.js.map +1 -0
- package/dist/transport/UDPTransport.d.ts +348 -0
- package/dist/transport/UDPTransport.d.ts.map +1 -0
- package/dist/transport/UDPTransport.js +820 -0
- package/dist/transport/UDPTransport.js.map +1 -0
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/index.d.ts +37 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/pattern.types.d.ts +39 -3
- package/dist/types/pattern.types.d.ts.map +1 -1
- package/dist/types/quic.d.ts +339 -0
- package/dist/types/quic.d.ts.map +1 -0
- package/dist/types/quic.js +48 -0
- package/dist/types/quic.js.map +1 -0
- package/dist/utils/Config.js +3 -3
- package/dist/utils/Config.js.map +1 -1
- package/dist/utils/Database.d.ts +14 -0
- package/dist/utils/Database.d.ts.map +1 -1
- package/dist/utils/Database.js +51 -4
- package/dist/utils/Database.js.map +1 -1
- package/dist/utils/Logger.d.ts.map +1 -1
- package/dist/utils/Logger.js +111 -26
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/ProcessExit.d.ts +23 -0
- package/dist/utils/ProcessExit.d.ts.map +1 -0
- package/dist/utils/ProcessExit.js +40 -0
- package/dist/utils/ProcessExit.js.map +1 -0
- package/dist/utils/SecureRandom.d.ts +171 -0
- package/dist/utils/SecureRandom.d.ts.map +1 -0
- package/dist/utils/SecureRandom.js +229 -0
- package/dist/utils/SecureRandom.js.map +1 -0
- package/dist/utils/SecureUrlValidator.d.ts +167 -0
- package/dist/utils/SecureUrlValidator.d.ts.map +1 -0
- package/dist/utils/SecureUrlValidator.js +306 -0
- package/dist/utils/SecureUrlValidator.js.map +1 -0
- package/dist/utils/SecureValidation.d.ts +131 -0
- package/dist/utils/SecureValidation.d.ts.map +1 -0
- package/dist/utils/SecureValidation.js +265 -0
- package/dist/utils/SecureValidation.js.map +1 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +5 -4
- package/dist/utils/validation.js.map +1 -1
- package/package.json +31 -8
|
@@ -0,0 +1,1067 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-data-management
|
|
3
|
+
description: Strategic test data generation, management, and privacy compliance. Use when creating test data, handling PII, ensuring GDPR/CCPA compliance, or scaling data generation for realistic testing scenarios.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
category: testing-infrastructure
|
|
6
|
+
tags:
|
|
7
|
+
- test-data
|
|
8
|
+
- data-generation
|
|
9
|
+
- data-privacy
|
|
10
|
+
- gdpr-compliance
|
|
11
|
+
- synthetic-data
|
|
12
|
+
- data-masking
|
|
13
|
+
- test-fixtures
|
|
14
|
+
difficulty: intermediate
|
|
15
|
+
estimated_time: 60-90 minutes
|
|
16
|
+
author: agentic-qe
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Test Data Management
|
|
20
|
+
|
|
21
|
+
## Core Principle
|
|
22
|
+
|
|
23
|
+
**Test data is the fuel for testing. Poor data = poor tests.**
|
|
24
|
+
|
|
25
|
+
78% of QE teams cite test data as their #1 bottleneck. Good test data management enables fast, reliable, compliant testing at scale.
|
|
26
|
+
|
|
27
|
+
## What is Test Data Management?
|
|
28
|
+
|
|
29
|
+
**Test Data Management:** Strategic creation, maintenance, and lifecycle management of data needed for testing, while ensuring privacy compliance and realistic scenarios.
|
|
30
|
+
|
|
31
|
+
**Why Critical:**
|
|
32
|
+
- 40% of test failures caused by inadequate test data
|
|
33
|
+
- GDPR/CCPA fines up to $20M or 4% of revenue
|
|
34
|
+
- Production data contains PII (illegal to use directly)
|
|
35
|
+
- AI/ML systems need massive, diverse datasets
|
|
36
|
+
- Manual data creation doesn't scale
|
|
37
|
+
|
|
38
|
+
**Goal:** Fast, realistic, compliant, scalable test data generation.
|
|
39
|
+
|
|
40
|
+
## Test Data Strategies
|
|
41
|
+
|
|
42
|
+
### Strategy 1: Minimal vs Realistic Data
|
|
43
|
+
|
|
44
|
+
**Minimal Data (Fast Tests)**
|
|
45
|
+
```javascript
|
|
46
|
+
// Just enough to test logic
|
|
47
|
+
const user = {
|
|
48
|
+
id: 1,
|
|
49
|
+
email: 'test@example.com',
|
|
50
|
+
role: 'customer'
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Benefits:
|
|
54
|
+
// - Fast test execution
|
|
55
|
+
// - Easy to understand
|
|
56
|
+
// - Deterministic
|
|
57
|
+
// - No cleanup needed
|
|
58
|
+
|
|
59
|
+
// Use when:
|
|
60
|
+
// - Unit tests
|
|
61
|
+
// - Logic validation
|
|
62
|
+
// - Fast feedback needed
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Realistic Data (Production-Like)**
|
|
66
|
+
```javascript
|
|
67
|
+
// Production-like complexity
|
|
68
|
+
const user = {
|
|
69
|
+
id: '7f3a9c2e-4b1d-4e8a-9f2c-6d5e8a1b3c4d',
|
|
70
|
+
email: 'sarah.johnson@techcorp.com',
|
|
71
|
+
firstName: 'Sarah',
|
|
72
|
+
lastName: 'Johnson',
|
|
73
|
+
phone: '+1-555-0123',
|
|
74
|
+
address: {
|
|
75
|
+
street: '742 Evergreen Terrace',
|
|
76
|
+
city: 'Springfield',
|
|
77
|
+
state: 'IL',
|
|
78
|
+
zip: '62701',
|
|
79
|
+
country: 'US'
|
|
80
|
+
},
|
|
81
|
+
preferences: {
|
|
82
|
+
newsletter: true,
|
|
83
|
+
language: 'en-US',
|
|
84
|
+
timezone: 'America/Chicago'
|
|
85
|
+
},
|
|
86
|
+
createdAt: '2025-01-15T10:30:00Z',
|
|
87
|
+
lastLogin: '2025-10-24T14:22:15Z'
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Benefits:
|
|
91
|
+
// - Catches edge cases
|
|
92
|
+
// - Tests real-world scenarios
|
|
93
|
+
// - Validates integrations
|
|
94
|
+
// - Performance realistic
|
|
95
|
+
|
|
96
|
+
// Use when:
|
|
97
|
+
// - Integration tests
|
|
98
|
+
// - E2E tests
|
|
99
|
+
// - Performance tests
|
|
100
|
+
// - Production validation
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Hybrid Approach (Best Practice)**
|
|
104
|
+
```javascript
|
|
105
|
+
// Minimal for fast tests, realistic for critical paths
|
|
106
|
+
describe('User Service', () => {
|
|
107
|
+
// Unit test: minimal data
|
|
108
|
+
test('validates email format', () => {
|
|
109
|
+
expect(validateEmail('test@example.com')).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Integration test: realistic data
|
|
113
|
+
test('creates user with full profile', async () => {
|
|
114
|
+
const user = generateRealisticUser(); // Full data
|
|
115
|
+
const result = await userService.create(user);
|
|
116
|
+
expect(result.profile.address.country).toBe('US');
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### Strategy 2: Shared vs Isolated Data
|
|
124
|
+
|
|
125
|
+
**Shared Data (Read-Only)**
|
|
126
|
+
```javascript
|
|
127
|
+
// Seed database once, many tests use it
|
|
128
|
+
beforeAll(async () => {
|
|
129
|
+
await db.seed({
|
|
130
|
+
users: [
|
|
131
|
+
{ id: 1, email: 'admin@example.com', role: 'admin' },
|
|
132
|
+
{ id: 2, email: 'user@example.com', role: 'customer' }
|
|
133
|
+
],
|
|
134
|
+
products: [
|
|
135
|
+
{ id: 1, name: 'Widget', price: 9.99 },
|
|
136
|
+
{ id: 2, name: 'Gadget', price: 19.99 }
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// Tests can read but not modify
|
|
142
|
+
test('admin can list all products', async () => {
|
|
143
|
+
const admin = await db.users.find({ id: 1 });
|
|
144
|
+
const products = await productService.list(admin);
|
|
145
|
+
expect(products.length).toBeGreaterThan(0);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// Benefits:
|
|
149
|
+
// - Fast (no setup per test)
|
|
150
|
+
// - Can run tests in parallel
|
|
151
|
+
// - Low resource usage
|
|
152
|
+
|
|
153
|
+
// Risks:
|
|
154
|
+
// - Tests must not modify data
|
|
155
|
+
// - Harder to debug (shared state)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Isolated Data (Per-Test)**
|
|
159
|
+
```javascript
|
|
160
|
+
// Each test gets its own data
|
|
161
|
+
test('user can update profile', async () => {
|
|
162
|
+
// Generate unique data for this test
|
|
163
|
+
const user = await createTestUser({
|
|
164
|
+
email: `test-${Date.now()}@example.com`
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
await userService.updateProfile(user.id, { firstName: 'Updated' });
|
|
168
|
+
|
|
169
|
+
const updated = await db.users.find({ id: user.id });
|
|
170
|
+
expect(updated.firstName).toBe('Updated');
|
|
171
|
+
|
|
172
|
+
// Cleanup
|
|
173
|
+
await db.users.delete({ id: user.id });
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Benefits:
|
|
177
|
+
// - Tests independent
|
|
178
|
+
// - Can modify data freely
|
|
179
|
+
// - Easy to debug
|
|
180
|
+
// - No test pollution
|
|
181
|
+
|
|
182
|
+
// Costs:
|
|
183
|
+
// - Slower (setup per test)
|
|
184
|
+
// - More resource usage
|
|
185
|
+
// - Cleanup needed
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Database Transactions (Best of Both)**
|
|
189
|
+
```javascript
|
|
190
|
+
// Use transactions for isolation without cleanup
|
|
191
|
+
beforeEach(async () => {
|
|
192
|
+
await db.beginTransaction();
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
afterEach(async () => {
|
|
196
|
+
await db.rollbackTransaction(); // Auto cleanup!
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test('user registration', async () => {
|
|
200
|
+
// Data exists only in this transaction
|
|
201
|
+
const user = await userService.register({
|
|
202
|
+
email: 'test@example.com'
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
expect(user.id).toBeDefined();
|
|
206
|
+
// Automatic rollback after test
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Benefits:
|
|
210
|
+
// - Isolated (transaction boundary)
|
|
211
|
+
// - Fast (no manual cleanup)
|
|
212
|
+
// - Reliable (guaranteed cleanup)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### Strategy 3: Production Data vs Synthetic Data
|
|
218
|
+
|
|
219
|
+
**❌ Production Data (DANGER!)**
|
|
220
|
+
```javascript
|
|
221
|
+
// NEVER do this:
|
|
222
|
+
const prodDb = connectTo('production://...');
|
|
223
|
+
const users = await prodDb.users.findAll(); // ⚠️ PII exposure!
|
|
224
|
+
|
|
225
|
+
// Problems:
|
|
226
|
+
// - Contains real PII (GDPR/CCPA violation)
|
|
227
|
+
// - Can modify production data accidentally
|
|
228
|
+
// - Performance impact on prod
|
|
229
|
+
// - Security risk
|
|
230
|
+
// - Legal liability
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**✅ Anonymized Production Data**
|
|
234
|
+
```javascript
|
|
235
|
+
// Mask/anonymize production data
|
|
236
|
+
const anonymizedUsers = prodUsers.map(user => ({
|
|
237
|
+
id: user.id, // Keep ID for relationships
|
|
238
|
+
email: `user-${user.id}@example.com`, // Fake email
|
|
239
|
+
firstName: faker.name.firstName(), // Generated name
|
|
240
|
+
lastName: faker.name.lastName(),
|
|
241
|
+
phone: null, // Remove PII
|
|
242
|
+
address: {
|
|
243
|
+
city: user.address.city, // Keep non-PII
|
|
244
|
+
state: user.address.state,
|
|
245
|
+
zip: user.address.zip.substring(0, 3) + 'XX', // Partial zip
|
|
246
|
+
street: '***REDACTED***'
|
|
247
|
+
},
|
|
248
|
+
createdAt: user.createdAt // Keep timestamps
|
|
249
|
+
}));
|
|
250
|
+
|
|
251
|
+
// Benefits:
|
|
252
|
+
// - Realistic data patterns
|
|
253
|
+
// - Compliant with privacy laws
|
|
254
|
+
// - Safe for testing
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**✅ Synthetic Data (Best Practice)**
|
|
258
|
+
```javascript
|
|
259
|
+
import { faker } from '@faker-js/faker';
|
|
260
|
+
|
|
261
|
+
// Generate realistic but fake data
|
|
262
|
+
function generateUser() {
|
|
263
|
+
return {
|
|
264
|
+
id: faker.string.uuid(),
|
|
265
|
+
email: faker.internet.email(),
|
|
266
|
+
firstName: faker.person.firstName(),
|
|
267
|
+
lastName: faker.person.lastName(),
|
|
268
|
+
phone: faker.phone.number(),
|
|
269
|
+
address: {
|
|
270
|
+
street: faker.location.streetAddress(),
|
|
271
|
+
city: faker.location.city(),
|
|
272
|
+
state: faker.location.state({ abbreviated: true }),
|
|
273
|
+
zip: faker.location.zipCode(),
|
|
274
|
+
country: 'US'
|
|
275
|
+
},
|
|
276
|
+
age: faker.number.int({ min: 18, max: 90 }),
|
|
277
|
+
createdAt: faker.date.past()
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Benefits:
|
|
282
|
+
// - No PII (privacy compliant)
|
|
283
|
+
// - Unlimited volume
|
|
284
|
+
// - Controlled characteristics
|
|
285
|
+
// - Repeatable with seeds
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Data Generation Techniques
|
|
291
|
+
|
|
292
|
+
### Technique 1: Faker Libraries
|
|
293
|
+
|
|
294
|
+
**Basic Usage**
|
|
295
|
+
```javascript
|
|
296
|
+
import { faker } from '@faker-js/faker';
|
|
297
|
+
|
|
298
|
+
// Seed for reproducibility
|
|
299
|
+
faker.seed(123);
|
|
300
|
+
|
|
301
|
+
// Generate various data types
|
|
302
|
+
const testData = {
|
|
303
|
+
// Personal
|
|
304
|
+
name: faker.person.fullName(),
|
|
305
|
+
email: faker.internet.email(),
|
|
306
|
+
avatar: faker.image.avatar(),
|
|
307
|
+
bio: faker.person.bio(),
|
|
308
|
+
|
|
309
|
+
// Location
|
|
310
|
+
address: faker.location.streetAddress(),
|
|
311
|
+
city: faker.location.city(),
|
|
312
|
+
country: faker.location.country(),
|
|
313
|
+
coordinates: faker.location.nearbyGPSCoordinate(),
|
|
314
|
+
|
|
315
|
+
// Financial
|
|
316
|
+
accountNumber: faker.finance.accountNumber(),
|
|
317
|
+
amount: faker.finance.amount(),
|
|
318
|
+
currency: faker.finance.currencyCode(),
|
|
319
|
+
iban: faker.finance.iban(),
|
|
320
|
+
|
|
321
|
+
// Commerce
|
|
322
|
+
product: faker.commerce.productName(),
|
|
323
|
+
price: faker.commerce.price(),
|
|
324
|
+
department: faker.commerce.department(),
|
|
325
|
+
|
|
326
|
+
// Internet
|
|
327
|
+
username: faker.internet.userName(),
|
|
328
|
+
password: faker.internet.password(),
|
|
329
|
+
url: faker.internet.url(),
|
|
330
|
+
ipv4: faker.internet.ipv4(),
|
|
331
|
+
|
|
332
|
+
// Date/Time
|
|
333
|
+
pastDate: faker.date.past(),
|
|
334
|
+
futureDate: faker.date.future(),
|
|
335
|
+
recentDate: faker.date.recent(),
|
|
336
|
+
|
|
337
|
+
// Random
|
|
338
|
+
uuid: faker.string.uuid(),
|
|
339
|
+
alphanumeric: faker.string.alphanumeric(10),
|
|
340
|
+
hexadecimal: faker.string.hexadecimal(16)
|
|
341
|
+
};
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Schema-Based Generation**
|
|
345
|
+
```typescript
|
|
346
|
+
interface User {
|
|
347
|
+
id: string;
|
|
348
|
+
email: string;
|
|
349
|
+
profile: {
|
|
350
|
+
firstName: string;
|
|
351
|
+
lastName: string;
|
|
352
|
+
age: number;
|
|
353
|
+
};
|
|
354
|
+
roles: string[];
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function generateUsers(count: number): User[] {
|
|
358
|
+
return Array.from({ length: count }, () => ({
|
|
359
|
+
id: faker.string.uuid(),
|
|
360
|
+
email: faker.internet.email(),
|
|
361
|
+
profile: {
|
|
362
|
+
firstName: faker.person.firstName(),
|
|
363
|
+
lastName: faker.person.lastName(),
|
|
364
|
+
age: faker.number.int({ min: 18, max: 90 })
|
|
365
|
+
},
|
|
366
|
+
roles: faker.helpers.arrayElements(['user', 'admin', 'moderator'])
|
|
367
|
+
}));
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Generate 1000 users
|
|
371
|
+
const users = generateUsers(1000);
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
### Technique 2: Test Data Builders
|
|
377
|
+
|
|
378
|
+
**Builder Pattern**
|
|
379
|
+
```typescript
|
|
380
|
+
class UserBuilder {
|
|
381
|
+
private user: Partial<User> = {};
|
|
382
|
+
|
|
383
|
+
withId(id: string) {
|
|
384
|
+
this.user.id = id;
|
|
385
|
+
return this;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
withEmail(email: string) {
|
|
389
|
+
this.user.email = email;
|
|
390
|
+
return this;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
withRole(role: string) {
|
|
394
|
+
this.user.role = role;
|
|
395
|
+
return this;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
asAdmin() {
|
|
399
|
+
this.user.role = 'admin';
|
|
400
|
+
this.user.permissions = ['read', 'write', 'delete'];
|
|
401
|
+
return this;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
asCustomer() {
|
|
405
|
+
this.user.role = 'customer';
|
|
406
|
+
this.user.permissions = ['read'];
|
|
407
|
+
return this;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
build(): User {
|
|
411
|
+
// Fill in defaults for missing fields
|
|
412
|
+
return {
|
|
413
|
+
id: this.user.id ?? faker.string.uuid(),
|
|
414
|
+
email: this.user.email ?? faker.internet.email(),
|
|
415
|
+
role: this.user.role ?? 'customer',
|
|
416
|
+
permissions: this.user.permissions ?? ['read'],
|
|
417
|
+
createdAt: new Date()
|
|
418
|
+
} as User;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Usage
|
|
423
|
+
const admin = new UserBuilder()
|
|
424
|
+
.asAdmin()
|
|
425
|
+
.withEmail('admin@example.com')
|
|
426
|
+
.build();
|
|
427
|
+
|
|
428
|
+
const customer = new UserBuilder()
|
|
429
|
+
.asCustomer()
|
|
430
|
+
.build();
|
|
431
|
+
|
|
432
|
+
// Flexible, readable, maintainable
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
### Technique 3: Fixtures and Factories
|
|
438
|
+
|
|
439
|
+
**Fixture Files**
|
|
440
|
+
```javascript
|
|
441
|
+
// fixtures/users.js
|
|
442
|
+
export const fixtures = {
|
|
443
|
+
adminUser: {
|
|
444
|
+
id: 1,
|
|
445
|
+
email: 'admin@example.com',
|
|
446
|
+
role: 'admin',
|
|
447
|
+
verified: true
|
|
448
|
+
},
|
|
449
|
+
|
|
450
|
+
regularUser: {
|
|
451
|
+
id: 2,
|
|
452
|
+
email: 'user@example.com',
|
|
453
|
+
role: 'customer',
|
|
454
|
+
verified: true
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
unverifiedUser: {
|
|
458
|
+
id: 3,
|
|
459
|
+
email: 'unverified@example.com',
|
|
460
|
+
role: 'customer',
|
|
461
|
+
verified: false
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// Use in tests
|
|
466
|
+
import { fixtures } from './fixtures/users';
|
|
467
|
+
|
|
468
|
+
test('admin can delete users', async () => {
|
|
469
|
+
const admin = await createUser(fixtures.adminUser);
|
|
470
|
+
const user = await createUser(fixtures.regularUser);
|
|
471
|
+
|
|
472
|
+
await userService.delete(admin, user.id);
|
|
473
|
+
expect(await db.users.find(user.id)).toBeNull();
|
|
474
|
+
});
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
**Factory Functions**
|
|
478
|
+
```javascript
|
|
479
|
+
// factories/userFactory.js
|
|
480
|
+
export function createUser(overrides = {}) {
|
|
481
|
+
const defaults = {
|
|
482
|
+
id: faker.string.uuid(),
|
|
483
|
+
email: faker.internet.email(),
|
|
484
|
+
firstName: faker.person.firstName(),
|
|
485
|
+
lastName: faker.person.lastName(),
|
|
486
|
+
role: 'customer',
|
|
487
|
+
verified: true,
|
|
488
|
+
createdAt: new Date()
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
return { ...defaults, ...overrides };
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export function createAdmin(overrides = {}) {
|
|
495
|
+
return createUser({
|
|
496
|
+
role: 'admin',
|
|
497
|
+
permissions: ['read', 'write', 'delete'],
|
|
498
|
+
...overrides
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// Use in tests
|
|
503
|
+
test('admin dashboard', async () => {
|
|
504
|
+
const admin = createAdmin({ email: 'specific@example.com' });
|
|
505
|
+
// Test with admin user
|
|
506
|
+
});
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
---
|
|
510
|
+
|
|
511
|
+
## Data Privacy & Compliance
|
|
512
|
+
|
|
513
|
+
### GDPR/CCPA Requirements
|
|
514
|
+
|
|
515
|
+
**What You Must Do:**
|
|
516
|
+
1. **Minimize PII Collection**
|
|
517
|
+
- Only collect necessary data for testing
|
|
518
|
+
- Use synthetic data instead of production data
|
|
519
|
+
- Delete test data after use
|
|
520
|
+
|
|
521
|
+
2. **Secure Storage**
|
|
522
|
+
- Encrypt sensitive test data
|
|
523
|
+
- Access controls on test databases
|
|
524
|
+
- Separate test from production
|
|
525
|
+
|
|
526
|
+
3. **Data Anonymization**
|
|
527
|
+
- Mask/pseudonymize production data if used
|
|
528
|
+
- Remove direct identifiers
|
|
529
|
+
- K-anonymity for aggregate data
|
|
530
|
+
|
|
531
|
+
4. **Right to Erasure**
|
|
532
|
+
- Easy deletion of test accounts
|
|
533
|
+
- Automated cleanup processes
|
|
534
|
+
- Audit trail of deletions
|
|
535
|
+
|
|
536
|
+
**Anonymization Techniques**
|
|
537
|
+
```javascript
|
|
538
|
+
// Data masking
|
|
539
|
+
function maskEmail(email) {
|
|
540
|
+
const [user, domain] = email.split('@');
|
|
541
|
+
return `${user[0]}***@${domain}`;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function maskPhone(phone) {
|
|
545
|
+
return phone.replace(/\d(?=\d{4})/g, '*');
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function maskCreditCard(cc) {
|
|
549
|
+
return `****-****-****-${cc.slice(-4)}`;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// Pseudonymization (reversible with key)
|
|
553
|
+
const crypto = require('crypto');
|
|
554
|
+
|
|
555
|
+
function pseudonymize(value, key) {
|
|
556
|
+
const cipher = crypto.createCipher('aes-256-cbc', key);
|
|
557
|
+
return cipher.update(value, 'utf8', 'hex') + cipher.final('hex');
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function depseudonymize(encrypted, key) {
|
|
561
|
+
const decipher = crypto.createDecipher('aes-256-cbc', key);
|
|
562
|
+
return decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// Use in tests
|
|
566
|
+
const user = {
|
|
567
|
+
realEmail: 'john@example.com',
|
|
568
|
+
maskedEmail: maskEmail('john@example.com'), // 'j***@example.com'
|
|
569
|
+
pseudoEmail: pseudonymize('john@example.com', SECRET_KEY)
|
|
570
|
+
};
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
**Data Retention Policies**
|
|
574
|
+
```javascript
|
|
575
|
+
// Auto-delete old test data
|
|
576
|
+
async function cleanupOldTestData() {
|
|
577
|
+
const thirtyDaysAgo = new Date();
|
|
578
|
+
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
|
|
579
|
+
|
|
580
|
+
// Delete test users older than 30 days
|
|
581
|
+
await db.users.deleteMany({
|
|
582
|
+
email: { $regex: /@example\.com$/ }, // Test emails
|
|
583
|
+
createdAt: { $lt: thirtyDaysAgo }
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
console.log('Cleaned up old test data');
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// Run daily
|
|
590
|
+
schedule.scheduleJob('0 2 * * *', cleanupOldTestData);
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## Test Data Lifecycle
|
|
596
|
+
|
|
597
|
+
### Phase 1: Setup/Seeding
|
|
598
|
+
|
|
599
|
+
**Database Seeding**
|
|
600
|
+
```javascript
|
|
601
|
+
// seed.js
|
|
602
|
+
const seedData = {
|
|
603
|
+
users: [
|
|
604
|
+
{ id: 1, email: 'admin@example.com', role: 'admin' },
|
|
605
|
+
{ id: 2, email: 'user@example.com', role: 'customer' }
|
|
606
|
+
],
|
|
607
|
+
products: [
|
|
608
|
+
{ id: 1, name: 'Widget', price: 9.99, inStock: true },
|
|
609
|
+
{ id: 2, name: 'Gadget', price: 19.99, inStock: true }
|
|
610
|
+
]
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
async function seedDatabase() {
|
|
614
|
+
await db.users.insertMany(seedData.users);
|
|
615
|
+
await db.products.insertMany(seedData.products);
|
|
616
|
+
console.log('Database seeded');
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// Run before tests
|
|
620
|
+
beforeAll(async () => {
|
|
621
|
+
await seedDatabase();
|
|
622
|
+
});
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
627
|
+
### Phase 2: Test Execution
|
|
628
|
+
|
|
629
|
+
**Data Isolation During Tests**
|
|
630
|
+
```javascript
|
|
631
|
+
describe('Order Service', () => {
|
|
632
|
+
let testUser;
|
|
633
|
+
let testProduct;
|
|
634
|
+
|
|
635
|
+
beforeEach(async () => {
|
|
636
|
+
// Create fresh data per test
|
|
637
|
+
testUser = await createTestUser();
|
|
638
|
+
testProduct = await createTestProduct();
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
afterEach(async () => {
|
|
642
|
+
// Cleanup after test
|
|
643
|
+
await deleteTestUser(testUser.id);
|
|
644
|
+
await deleteTestProduct(testProduct.id);
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
test('user can place order', async () => {
|
|
648
|
+
const order = await orderService.create({
|
|
649
|
+
userId: testUser.id,
|
|
650
|
+
productId: testProduct.id,
|
|
651
|
+
quantity: 1
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
expect(order.total).toBe(testProduct.price);
|
|
655
|
+
});
|
|
656
|
+
});
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
---
|
|
660
|
+
|
|
661
|
+
### Phase 3: Cleanup/Reset
|
|
662
|
+
|
|
663
|
+
**Transaction-Based Cleanup**
|
|
664
|
+
```javascript
|
|
665
|
+
// Best practice: use transactions
|
|
666
|
+
beforeEach(async () => {
|
|
667
|
+
await db.beginTransaction();
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
afterEach(async () => {
|
|
671
|
+
await db.rollbackTransaction(); // Auto cleanup
|
|
672
|
+
});
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
**Manual Cleanup**
|
|
676
|
+
```javascript
|
|
677
|
+
// Track created entities
|
|
678
|
+
const createdIds = {
|
|
679
|
+
users: [],
|
|
680
|
+
orders: [],
|
|
681
|
+
products: []
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
afterEach(async () => {
|
|
685
|
+
// Delete in reverse order (handle foreign keys)
|
|
686
|
+
await db.orders.deleteMany({ id: { $in: createdIds.orders } });
|
|
687
|
+
await db.products.deleteMany({ id: { $in: createdIds.products } });
|
|
688
|
+
await db.users.deleteMany({ id: { $in: createdIds.users } });
|
|
689
|
+
|
|
690
|
+
// Reset tracking
|
|
691
|
+
createdIds.users = [];
|
|
692
|
+
createdIds.orders = [];
|
|
693
|
+
createdIds.products = [];
|
|
694
|
+
});
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
---
|
|
698
|
+
|
|
699
|
+
## Advanced Patterns
|
|
700
|
+
|
|
701
|
+
### Pattern 1: Relational Data Generation
|
|
702
|
+
|
|
703
|
+
**Generate Related Entities**
|
|
704
|
+
```javascript
|
|
705
|
+
async function generateOrderWithRelations() {
|
|
706
|
+
// Create user
|
|
707
|
+
const user = await db.users.create({
|
|
708
|
+
email: faker.internet.email(),
|
|
709
|
+
firstName: faker.person.firstName()
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
// Create products
|
|
713
|
+
const products = await Promise.all([
|
|
714
|
+
db.products.create({
|
|
715
|
+
name: faker.commerce.productName(),
|
|
716
|
+
price: faker.commerce.price()
|
|
717
|
+
}),
|
|
718
|
+
db.products.create({
|
|
719
|
+
name: faker.commerce.productName(),
|
|
720
|
+
price: faker.commerce.price()
|
|
721
|
+
})
|
|
722
|
+
]);
|
|
723
|
+
|
|
724
|
+
// Create order with line items
|
|
725
|
+
const order = await db.orders.create({
|
|
726
|
+
userId: user.id,
|
|
727
|
+
status: 'pending',
|
|
728
|
+
lineItems: products.map(p => ({
|
|
729
|
+
productId: p.id,
|
|
730
|
+
quantity: faker.number.int({ min: 1, max: 5 }),
|
|
731
|
+
price: p.price
|
|
732
|
+
}))
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
return { user, products, order };
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// Use in test
|
|
739
|
+
test('order total calculation', async () => {
|
|
740
|
+
const { order } = await generateOrderWithRelations();
|
|
741
|
+
expect(order.total).toBeGreaterThan(0);
|
|
742
|
+
});
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
---
|
|
746
|
+
|
|
747
|
+
### Pattern 2: Edge Case Data
|
|
748
|
+
|
|
749
|
+
**Generate Boundary Values**
|
|
750
|
+
```javascript
|
|
751
|
+
function generateEdgeCaseUsers() {
|
|
752
|
+
return [
|
|
753
|
+
// Minimum values
|
|
754
|
+
{
|
|
755
|
+
email: 'a@b.c', // Shortest valid email
|
|
756
|
+
age: 18, // Minimum age
|
|
757
|
+
name: 'A' // Single character
|
|
758
|
+
},
|
|
759
|
+
|
|
760
|
+
// Maximum values
|
|
761
|
+
{
|
|
762
|
+
email: 'a'.repeat(64) + '@' + 'b'.repeat(255), // Max length
|
|
763
|
+
age: 120,
|
|
764
|
+
name: 'A'.repeat(255)
|
|
765
|
+
},
|
|
766
|
+
|
|
767
|
+
// Special characters
|
|
768
|
+
{
|
|
769
|
+
email: "test+tag@example.com",
|
|
770
|
+
name: "O'Brien",
|
|
771
|
+
bio: "Test <script>alert('xss')</script>"
|
|
772
|
+
},
|
|
773
|
+
|
|
774
|
+
// Unicode
|
|
775
|
+
{
|
|
776
|
+
email: 'user@例え.jp',
|
|
777
|
+
name: '山田太郎',
|
|
778
|
+
city: '北京'
|
|
779
|
+
},
|
|
780
|
+
|
|
781
|
+
// Empty/null
|
|
782
|
+
{
|
|
783
|
+
email: 'empty@example.com',
|
|
784
|
+
middleName: null,
|
|
785
|
+
phone: ''
|
|
786
|
+
}
|
|
787
|
+
];
|
|
788
|
+
}
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
---
|
|
792
|
+
|
|
793
|
+
### Pattern 3: Volume Data Generation
|
|
794
|
+
|
|
795
|
+
**Generate Large Datasets**
|
|
796
|
+
```javascript
|
|
797
|
+
// Generate 10,000 users efficiently
|
|
798
|
+
async function generateLargeUserDataset(count = 10000) {
|
|
799
|
+
const batchSize = 1000;
|
|
800
|
+
const batches = Math.ceil(count / batchSize);
|
|
801
|
+
|
|
802
|
+
for (let i = 0; i < batches; i++) {
|
|
803
|
+
const users = Array.from({ length: batchSize }, (_, index) => ({
|
|
804
|
+
id: i * batchSize + index,
|
|
805
|
+
email: `user${i * batchSize + index}@example.com`,
|
|
806
|
+
firstName: faker.person.firstName(),
|
|
807
|
+
lastName: faker.person.lastName(),
|
|
808
|
+
createdAt: faker.date.past()
|
|
809
|
+
}));
|
|
810
|
+
|
|
811
|
+
// Batch insert for performance
|
|
812
|
+
await db.users.insertMany(users);
|
|
813
|
+
|
|
814
|
+
console.log(`Inserted batch ${i + 1}/${batches}`);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// Performance test with realistic volume
|
|
819
|
+
test('search performs well with 10k users', async () => {
|
|
820
|
+
await generateLargeUserDataset(10000);
|
|
821
|
+
|
|
822
|
+
const start = Date.now();
|
|
823
|
+
const results = await userService.search('John');
|
|
824
|
+
const duration = Date.now() - start;
|
|
825
|
+
|
|
826
|
+
expect(duration).toBeLessThan(100); // < 100ms
|
|
827
|
+
});
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
---
|
|
831
|
+
|
|
832
|
+
## Using with QE Agents
|
|
833
|
+
|
|
834
|
+
### qe-test-data-architect: High-Speed Generation
|
|
835
|
+
|
|
836
|
+
**Generate 10k+ Records per Second**
|
|
837
|
+
```typescript
|
|
838
|
+
// Agent generates realistic, schema-aware data
|
|
839
|
+
const testData = await agent.generateTestData({
|
|
840
|
+
schema: 'users',
|
|
841
|
+
count: 10000,
|
|
842
|
+
realistic: true,
|
|
843
|
+
constraints: {
|
|
844
|
+
age: { min: 18, max: 90 },
|
|
845
|
+
roles: ['customer', 'admin', 'moderator'],
|
|
846
|
+
emailDomain: 'example.com'
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
// Returns 10,000 fully populated user records
|
|
851
|
+
// With relationships, constraints, realistic patterns
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
**Edge Case Discovery**
|
|
855
|
+
```typescript
|
|
856
|
+
// Agent auto-discovers edge cases
|
|
857
|
+
const edgeCases = await agent.generateEdgeCases({
|
|
858
|
+
field: 'email',
|
|
859
|
+
patterns: [
|
|
860
|
+
'special-chars',
|
|
861
|
+
'unicode',
|
|
862
|
+
'max-length',
|
|
863
|
+
'min-length',
|
|
864
|
+
'sql-injection',
|
|
865
|
+
'xss-attempts'
|
|
866
|
+
]
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
// Returns comprehensive edge case dataset
|
|
870
|
+
// 50+ edge cases for email field
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
**GDPR-Compliant Data**
|
|
874
|
+
```typescript
|
|
875
|
+
// Agent ensures privacy compliance
|
|
876
|
+
const anonymizedData = await agent.anonymizeProductionData({
|
|
877
|
+
source: productionSnapshot,
|
|
878
|
+
piiFields: ['email', 'phone', 'ssn', 'address'],
|
|
879
|
+
method: 'pseudonymization',
|
|
880
|
+
retainStructure: true
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
// Returns anonymized data maintaining referential integrity
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
---
|
|
887
|
+
|
|
888
|
+
### Fleet Coordination for Complex Data Graphs
|
|
889
|
+
|
|
890
|
+
```typescript
|
|
891
|
+
// Multiple agents coordinate for complex data
|
|
892
|
+
const dataFleet = await FleetManager.coordinate({
|
|
893
|
+
strategy: 'test-data-generation',
|
|
894
|
+
agents: [
|
|
895
|
+
'qe-test-data-architect', // Generate base data
|
|
896
|
+
'qe-test-generator', // Generate tests using data
|
|
897
|
+
'qe-test-executor' // Execute with generated data
|
|
898
|
+
],
|
|
899
|
+
topology: 'sequential'
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
await dataFleet.execute({
|
|
903
|
+
scenario: 'e-commerce-checkout',
|
|
904
|
+
volume: {
|
|
905
|
+
users: 1000,
|
|
906
|
+
products: 500,
|
|
907
|
+
orders: 5000
|
|
908
|
+
},
|
|
909
|
+
relationships: true,
|
|
910
|
+
realistic: true
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
// Generates full data graph:
|
|
914
|
+
// - 1000 users with profiles
|
|
915
|
+
// - 500 products with inventory
|
|
916
|
+
// - 5000 orders with line items
|
|
917
|
+
// - All relationships maintained
|
|
918
|
+
// - Tests generated and executed
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
---
|
|
922
|
+
|
|
923
|
+
## Tools & Libraries
|
|
924
|
+
|
|
925
|
+
### Data Generation
|
|
926
|
+
- **@faker-js/faker** - Comprehensive fake data generation
|
|
927
|
+
- **Mockaroo** - Online data generator (CSV, JSON, SQL)
|
|
928
|
+
- **Chance.js** - Random data generation
|
|
929
|
+
- **Casual** - Minimalist fake data
|
|
930
|
+
- **JSON Schema Faker** - Generate from JSON schemas
|
|
931
|
+
|
|
932
|
+
### Database Tools
|
|
933
|
+
- **Factory Bot** (Ruby) - Test data factories
|
|
934
|
+
- **FactoryGuy** (JavaScript) - Ember.js factories
|
|
935
|
+
- **Fishery** (TypeScript) - Type-safe factories
|
|
936
|
+
- **Knex.js** - SQL query builder with seeding
|
|
937
|
+
- **Prisma** - ORM with seeding support
|
|
938
|
+
|
|
939
|
+
### Privacy Tools
|
|
940
|
+
- **ARX Data Anonymization Tool** - GDPR compliance
|
|
941
|
+
- **sdv (Synthetic Data Vault)** - AI-generated synthetic data
|
|
942
|
+
- **Presidio** - PII detection and anonymization
|
|
943
|
+
- **Faker** - Built-in data masking
|
|
944
|
+
|
|
945
|
+
---
|
|
946
|
+
|
|
947
|
+
## Common Pitfalls
|
|
948
|
+
|
|
949
|
+
### ❌ Using Production Data Directly
|
|
950
|
+
```javascript
|
|
951
|
+
// NEVER do this
|
|
952
|
+
const prodUsers = await prodDb.query('SELECT * FROM users');
|
|
953
|
+
await testDb.insertMany(prodUsers); // ⚠️ PII violation
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
**Fix:** Anonymize first or use synthetic data
|
|
957
|
+
|
|
958
|
+
### ❌ Not Cleaning Up Test Data
|
|
959
|
+
```javascript
|
|
960
|
+
// Creates 100 users per test, never deleted
|
|
961
|
+
test('many tests', async () => {
|
|
962
|
+
const users = await generateUsers(100);
|
|
963
|
+
// ... test code
|
|
964
|
+
// No cleanup! Database fills up
|
|
965
|
+
});
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
**Fix:** Use transactions or cleanup hooks
|
|
969
|
+
|
|
970
|
+
### ❌ Hard-Coded IDs
|
|
971
|
+
```javascript
|
|
972
|
+
// Breaks when run in parallel or multiple times
|
|
973
|
+
const user = await createUser({ id: 1 }); // ⚠️ Collision risk
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
**Fix:** Use generated UUIDs or auto-increment
|
|
977
|
+
|
|
978
|
+
### ❌ Shared Mutable Data
|
|
979
|
+
```javascript
|
|
980
|
+
// Tests pollute shared data
|
|
981
|
+
const sharedUser = createUser();
|
|
982
|
+
|
|
983
|
+
test('update email', () => {
|
|
984
|
+
sharedUser.email = 'new@example.com'; // Affects other tests!
|
|
985
|
+
});
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
**Fix:** Create fresh data per test
|
|
989
|
+
|
|
990
|
+
---
|
|
991
|
+
|
|
992
|
+
## Best Practices Checklist
|
|
993
|
+
|
|
994
|
+
**Data Generation:**
|
|
995
|
+
- [ ] Use faker or similar library for realistic data
|
|
996
|
+
- [ ] Generate data with proper constraints
|
|
997
|
+
- [ ] Create both minimal and realistic datasets
|
|
998
|
+
- [ ] Include edge cases and boundary values
|
|
999
|
+
- [ ] Use builders/factories for complex entities
|
|
1000
|
+
|
|
1001
|
+
**Privacy & Compliance:**
|
|
1002
|
+
- [ ] Never use production PII directly
|
|
1003
|
+
- [ ] Anonymize/pseudonymize production data snapshots
|
|
1004
|
+
- [ ] Use synthetic data as default
|
|
1005
|
+
- [ ] Implement data retention policies
|
|
1006
|
+
- [ ] Document data handling procedures
|
|
1007
|
+
|
|
1008
|
+
**Performance:**
|
|
1009
|
+
- [ ] Batch insert for large datasets
|
|
1010
|
+
- [ ] Use database transactions for isolation
|
|
1011
|
+
- [ ] Generate data lazily when possible
|
|
1012
|
+
- [ ] Cache commonly used fixtures
|
|
1013
|
+
- [ ] Clean up data after tests
|
|
1014
|
+
|
|
1015
|
+
**Maintainability:**
|
|
1016
|
+
- [ ] Centralize test data generation
|
|
1017
|
+
- [ ] Version control seed data
|
|
1018
|
+
- [ ] Document data schemas
|
|
1019
|
+
- [ ] Use type-safe factories (TypeScript)
|
|
1020
|
+
- [ ] Keep data generation DRY
|
|
1021
|
+
|
|
1022
|
+
---
|
|
1023
|
+
|
|
1024
|
+
## Related Skills
|
|
1025
|
+
|
|
1026
|
+
**Testing Infrastructure:**
|
|
1027
|
+
- [test-automation-strategy](../test-automation-strategy/) - Automation includes data setup
|
|
1028
|
+
- [test-environment-management](../test-environment-management/) - Environments need data
|
|
1029
|
+
- [database-testing](../database-testing/) - Database schema and data integrity
|
|
1030
|
+
|
|
1031
|
+
**Testing Methodologies:**
|
|
1032
|
+
- [regression-testing](../regression-testing/) - Regression needs stable test data
|
|
1033
|
+
- [performance-testing](../performance-testing/) - Performance tests need volume data
|
|
1034
|
+
- [api-testing-patterns](../api-testing-patterns/) - API tests need request data
|
|
1035
|
+
|
|
1036
|
+
**Quality Management:**
|
|
1037
|
+
- [agentic-quality-engineering](../agentic-quality-engineering/) - Agent-driven data generation
|
|
1038
|
+
- [compliance-testing](../compliance-testing/) - GDPR/CCPA compliance validation
|
|
1039
|
+
|
|
1040
|
+
---
|
|
1041
|
+
|
|
1042
|
+
## Remember
|
|
1043
|
+
|
|
1044
|
+
**Test data is infrastructure, not an afterthought.**
|
|
1045
|
+
|
|
1046
|
+
Poor test data causes:
|
|
1047
|
+
- 40% of test failures
|
|
1048
|
+
- Hours wasted debugging
|
|
1049
|
+
- Unreliable test results
|
|
1050
|
+
- Privacy violations
|
|
1051
|
+
- Scaling bottlenecks
|
|
1052
|
+
|
|
1053
|
+
**Good test data management enables:**
|
|
1054
|
+
- Fast, reliable tests
|
|
1055
|
+
- Realistic scenarios
|
|
1056
|
+
- Privacy compliance
|
|
1057
|
+
- Scalable testing
|
|
1058
|
+
- Confident deployments
|
|
1059
|
+
|
|
1060
|
+
**Golden Rules:**
|
|
1061
|
+
1. Never use production PII
|
|
1062
|
+
2. Automate data generation
|
|
1063
|
+
3. Clean up after tests
|
|
1064
|
+
4. Use transactions for isolation
|
|
1065
|
+
5. Generate edge cases systematically
|
|
1066
|
+
|
|
1067
|
+
**With Agents:** `qe-test-data-architect` generates 10k+ records/sec with realistic patterns, constraints, and relationships. Use agents to eliminate test data bottlenecks and ensure GDPR/CCPA compliance automatically.
|