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,686 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-testing-patterns
|
|
3
|
+
description: Apply comprehensive API testing patterns including contract testing, REST/GraphQL testing, and integration testing. Use when testing APIs, microservices, or designing API test strategies.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
category: testing
|
|
6
|
+
tags:
|
|
7
|
+
- api-testing
|
|
8
|
+
- contract-testing
|
|
9
|
+
- rest-api
|
|
10
|
+
- graphql
|
|
11
|
+
- microservices
|
|
12
|
+
- integration-testing
|
|
13
|
+
difficulty: intermediate
|
|
14
|
+
estimated_time: 45-60 minutes
|
|
15
|
+
author: user
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# API Testing Patterns
|
|
19
|
+
|
|
20
|
+
## Core Principles
|
|
21
|
+
|
|
22
|
+
APIs are contracts. Test the contract, not the implementation. Focus on behavior from the consumer's perspective, not the provider's internals.
|
|
23
|
+
|
|
24
|
+
## Testing Levels
|
|
25
|
+
|
|
26
|
+
### 1. Contract Testing
|
|
27
|
+
|
|
28
|
+
**Purpose:** Verify API provider and consumer agree on the contract.
|
|
29
|
+
|
|
30
|
+
**Pattern: Consumer-Driven Contracts**
|
|
31
|
+
```javascript
|
|
32
|
+
// Consumer defines expectations
|
|
33
|
+
const expectedContract = {
|
|
34
|
+
request: {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
path: '/orders',
|
|
37
|
+
body: { productId: 'abc', quantity: 2 }
|
|
38
|
+
},
|
|
39
|
+
response: {
|
|
40
|
+
status: 201,
|
|
41
|
+
body: { orderId: 'string', total: 'number' }
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Provider must fulfill this contract
|
|
46
|
+
test('order API meets consumer contract', async () => {
|
|
47
|
+
const response = await api.post('/orders', {
|
|
48
|
+
productId: 'abc',
|
|
49
|
+
quantity: 2
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
expect(response.status).toBe(201);
|
|
53
|
+
expect(response.body).toMatchSchema({
|
|
54
|
+
orderId: expect.any(String),
|
|
55
|
+
total: expect.any(Number)
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Tools:** Pact, Spring Cloud Contract
|
|
61
|
+
|
|
62
|
+
**When to use:** Microservices, distributed systems, third-party integrations
|
|
63
|
+
|
|
64
|
+
### 2. Integration Testing
|
|
65
|
+
|
|
66
|
+
**Purpose:** Verify API works with real dependencies (database, external services).
|
|
67
|
+
|
|
68
|
+
**Pattern: Test with Real Dependencies**
|
|
69
|
+
```javascript
|
|
70
|
+
describe('Order API integration', () => {
|
|
71
|
+
beforeEach(async () => {
|
|
72
|
+
await db.migrate();
|
|
73
|
+
await db.seed();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
afterEach(async () => {
|
|
77
|
+
await db.rollback();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('creates order and updates inventory', async () => {
|
|
81
|
+
const response = await api.post('/orders', {
|
|
82
|
+
productId: 'product-123',
|
|
83
|
+
quantity: 2
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
expect(response.status).toBe(201);
|
|
87
|
+
|
|
88
|
+
// Verify side effects
|
|
89
|
+
const inventory = await db.inventory.findById('product-123');
|
|
90
|
+
expect(inventory.quantity).toBe(8); // Was 10, now 8
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**When to use:** Testing business logic that spans multiple components
|
|
96
|
+
|
|
97
|
+
### 3. Component Testing
|
|
98
|
+
|
|
99
|
+
**Purpose:** Test API in isolation with mocked dependencies.
|
|
100
|
+
|
|
101
|
+
**Pattern: Mock External Dependencies**
|
|
102
|
+
```javascript
|
|
103
|
+
describe('Order API component', () => {
|
|
104
|
+
it('handles payment service timeout', async () => {
|
|
105
|
+
const paymentService = mockPaymentService({
|
|
106
|
+
charge: () => { throw new TimeoutError(); }
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const api = createAPI({ paymentService });
|
|
110
|
+
const response = await api.post('/orders', orderData);
|
|
111
|
+
|
|
112
|
+
expect(response.status).toBe(503);
|
|
113
|
+
expect(response.body.error).toBe('Payment service unavailable');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**When to use:** Testing error handling, edge cases, without hitting real services
|
|
119
|
+
|
|
120
|
+
## Critical Test Scenarios
|
|
121
|
+
|
|
122
|
+
### Authentication & Authorization
|
|
123
|
+
|
|
124
|
+
```javascript
|
|
125
|
+
describe('Authentication', () => {
|
|
126
|
+
it('rejects requests without token', async () => {
|
|
127
|
+
const response = await api.get('/orders');
|
|
128
|
+
expect(response.status).toBe(401);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('rejects requests with expired token', async () => {
|
|
132
|
+
const expiredToken = generateExpiredToken();
|
|
133
|
+
const response = await api.get('/orders', {
|
|
134
|
+
headers: { Authorization: `Bearer ${expiredToken}` }
|
|
135
|
+
});
|
|
136
|
+
expect(response.status).toBe(401);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('allows access only to authorized resources', async () => {
|
|
140
|
+
const userAToken = generateToken({ userId: 'A' });
|
|
141
|
+
const response = await api.get('/orders/user-B-order', {
|
|
142
|
+
headers: { Authorization: `Bearer ${userAToken}` }
|
|
143
|
+
});
|
|
144
|
+
expect(response.status).toBe(403);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Input Validation
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
describe('Input validation', () => {
|
|
153
|
+
it('validates required fields', async () => {
|
|
154
|
+
const response = await api.post('/orders', {
|
|
155
|
+
// Missing productId
|
|
156
|
+
quantity: 2
|
|
157
|
+
});
|
|
158
|
+
expect(response.status).toBe(400);
|
|
159
|
+
expect(response.body.errors).toContain('productId is required');
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('validates data types', async () => {
|
|
163
|
+
const response = await api.post('/orders', {
|
|
164
|
+
productId: 'abc',
|
|
165
|
+
quantity: 'two' // Should be number
|
|
166
|
+
});
|
|
167
|
+
expect(response.status).toBe(400);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it('validates value ranges', async () => {
|
|
171
|
+
const response = await api.post('/orders', {
|
|
172
|
+
productId: 'abc',
|
|
173
|
+
quantity: -5 // Negative quantity
|
|
174
|
+
});
|
|
175
|
+
expect(response.status).toBe(400);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Error Handling
|
|
181
|
+
|
|
182
|
+
```javascript
|
|
183
|
+
describe('Error handling', () => {
|
|
184
|
+
it('handles database connection failure', async () => {
|
|
185
|
+
db.disconnect();
|
|
186
|
+
const response = await api.get('/orders');
|
|
187
|
+
expect(response.status).toBe(503);
|
|
188
|
+
expect(response.body.error).toMatch(/service unavailable/i);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('handles malformed JSON', async () => {
|
|
192
|
+
const response = await fetch('/orders', {
|
|
193
|
+
method: 'POST',
|
|
194
|
+
body: 'not-json'
|
|
195
|
+
});
|
|
196
|
+
expect(response.status).toBe(400);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('handles unexpected errors gracefully', async () => {
|
|
200
|
+
// Simulate internal error
|
|
201
|
+
orderService.create = () => { throw new Error('Unexpected'); };
|
|
202
|
+
|
|
203
|
+
const response = await api.post('/orders', validOrder);
|
|
204
|
+
expect(response.status).toBe(500);
|
|
205
|
+
expect(response.body.error).not.toContain('Unexpected'); // Don't leak internals
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Idempotency
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
describe('Idempotent operations', () => {
|
|
214
|
+
it('PUT is idempotent', async () => {
|
|
215
|
+
const updateData = { status: 'shipped' };
|
|
216
|
+
|
|
217
|
+
await api.put('/orders/123', updateData);
|
|
218
|
+
const response = await api.put('/orders/123', updateData);
|
|
219
|
+
|
|
220
|
+
expect(response.status).toBe(200);
|
|
221
|
+
// Verify state hasn't changed incorrectly
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('POST with idempotency key prevents duplicates', async () => {
|
|
225
|
+
const idempotencyKey = 'unique-key-123';
|
|
226
|
+
const orderData = { productId: 'abc', quantity: 2 };
|
|
227
|
+
|
|
228
|
+
const response1 = await api.post('/orders', orderData, {
|
|
229
|
+
headers: { 'Idempotency-Key': idempotencyKey }
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const response2 = await api.post('/orders', orderData, {
|
|
233
|
+
headers: { 'Idempotency-Key': idempotencyKey }
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
expect(response1.body.orderId).toBe(response2.body.orderId);
|
|
237
|
+
// Verify only one order was created
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Concurrency
|
|
243
|
+
|
|
244
|
+
```javascript
|
|
245
|
+
describe('Concurrent requests', () => {
|
|
246
|
+
it('handles race condition on inventory update', async () => {
|
|
247
|
+
const promises = Array(10).fill().map(() =>
|
|
248
|
+
api.post('/orders', { productId: 'abc', quantity: 1 })
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
const responses = await Promise.all(promises);
|
|
252
|
+
const successful = responses.filter(r => r.status === 201);
|
|
253
|
+
|
|
254
|
+
// Verify inventory wasn't oversold
|
|
255
|
+
const inventory = await db.inventory.findById('abc');
|
|
256
|
+
expect(inventory.quantity).toBe(initialQuantity - successful.length);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## REST API Testing Patterns
|
|
262
|
+
|
|
263
|
+
### CRUD Operations
|
|
264
|
+
|
|
265
|
+
```javascript
|
|
266
|
+
describe('Product CRUD', () => {
|
|
267
|
+
let productId;
|
|
268
|
+
|
|
269
|
+
it('CREATE: creates new product', async () => {
|
|
270
|
+
const response = await api.post('/products', {
|
|
271
|
+
name: 'Widget',
|
|
272
|
+
price: 10.00
|
|
273
|
+
});
|
|
274
|
+
expect(response.status).toBe(201);
|
|
275
|
+
expect(response.headers.location).toMatch(/\/products\/\w+/);
|
|
276
|
+
productId = response.body.id;
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
it('READ: retrieves product', async () => {
|
|
280
|
+
const response = await api.get(`/products/${productId}`);
|
|
281
|
+
expect(response.status).toBe(200);
|
|
282
|
+
expect(response.body.name).toBe('Widget');
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it('UPDATE: modifies product', async () => {
|
|
286
|
+
const response = await api.put(`/products/${productId}`, {
|
|
287
|
+
name: 'Widget',
|
|
288
|
+
price: 12.00
|
|
289
|
+
});
|
|
290
|
+
expect(response.status).toBe(200);
|
|
291
|
+
expect(response.body.price).toBe(12.00);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
it('DELETE: removes product', async () => {
|
|
295
|
+
const response = await api.delete(`/products/${productId}`);
|
|
296
|
+
expect(response.status).toBe(204);
|
|
297
|
+
|
|
298
|
+
const getResponse = await api.get(`/products/${productId}`);
|
|
299
|
+
expect(getResponse.status).toBe(404);
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Pagination
|
|
305
|
+
|
|
306
|
+
```javascript
|
|
307
|
+
describe('Pagination', () => {
|
|
308
|
+
it('returns first page by default', async () => {
|
|
309
|
+
const response = await api.get('/products');
|
|
310
|
+
expect(response.body.items).toHaveLength(20); // Default page size
|
|
311
|
+
expect(response.body.page).toBe(1);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
it('supports custom page size', async () => {
|
|
315
|
+
const response = await api.get('/products?pageSize=50');
|
|
316
|
+
expect(response.body.items).toHaveLength(50);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
it('includes pagination metadata', async () => {
|
|
320
|
+
const response = await api.get('/products');
|
|
321
|
+
expect(response.body).toHaveProperty('totalItems');
|
|
322
|
+
expect(response.body).toHaveProperty('totalPages');
|
|
323
|
+
expect(response.body).toHaveProperty('nextPage');
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Filtering & Sorting
|
|
329
|
+
|
|
330
|
+
```javascript
|
|
331
|
+
describe('Filtering and sorting', () => {
|
|
332
|
+
it('filters by category', async () => {
|
|
333
|
+
const response = await api.get('/products?category=electronics');
|
|
334
|
+
expect(response.body.items.every(p => p.category === 'electronics')).toBe(true);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it('sorts by price ascending', async () => {
|
|
338
|
+
const response = await api.get('/products?sort=price:asc');
|
|
339
|
+
const prices = response.body.items.map(p => p.price);
|
|
340
|
+
expect(prices).toEqual([...prices].sort((a, b) => a - b));
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
it('combines multiple filters', async () => {
|
|
344
|
+
const response = await api.get('/products?category=electronics&minPrice=100');
|
|
345
|
+
expect(response.body.items.every(p =>
|
|
346
|
+
p.category === 'electronics' && p.price >= 100
|
|
347
|
+
)).toBe(true);
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## GraphQL Testing Patterns
|
|
353
|
+
|
|
354
|
+
```javascript
|
|
355
|
+
describe('GraphQL API', () => {
|
|
356
|
+
it('queries nested data', async () => {
|
|
357
|
+
const query = `
|
|
358
|
+
query {
|
|
359
|
+
order(id: "123") {
|
|
360
|
+
id
|
|
361
|
+
items {
|
|
362
|
+
product {
|
|
363
|
+
name
|
|
364
|
+
price
|
|
365
|
+
}
|
|
366
|
+
quantity
|
|
367
|
+
}
|
|
368
|
+
total
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
`;
|
|
372
|
+
|
|
373
|
+
const response = await graphql.query(query);
|
|
374
|
+
expect(response.data.order.items).toBeDefined();
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
it('handles query complexity limits', async () => {
|
|
378
|
+
const complexQuery = `
|
|
379
|
+
query {
|
|
380
|
+
orders {
|
|
381
|
+
items {
|
|
382
|
+
product {
|
|
383
|
+
reviews {
|
|
384
|
+
author {
|
|
385
|
+
orders { ... }
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
`;
|
|
393
|
+
|
|
394
|
+
const response = await graphql.query(complexQuery);
|
|
395
|
+
expect(response.errors[0].message).toMatch(/query too complex/i);
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Performance Testing
|
|
401
|
+
|
|
402
|
+
```javascript
|
|
403
|
+
describe('API performance', () => {
|
|
404
|
+
it('responds within acceptable time', async () => {
|
|
405
|
+
const start = Date.now();
|
|
406
|
+
await api.get('/products');
|
|
407
|
+
const duration = Date.now() - start;
|
|
408
|
+
|
|
409
|
+
expect(duration).toBeLessThan(200); // 200ms SLA
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it('handles load of 100 concurrent requests', async () => {
|
|
413
|
+
const requests = Array(100).fill().map(() => api.get('/products'));
|
|
414
|
+
const responses = await Promise.all(requests);
|
|
415
|
+
|
|
416
|
+
const successful = responses.filter(r => r.status === 200);
|
|
417
|
+
expect(successful.length).toBeGreaterThan(95); // 95% success rate
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## Testing Tools
|
|
423
|
+
|
|
424
|
+
### REST APIs
|
|
425
|
+
- **Supertest** (Node.js) - HTTP assertions
|
|
426
|
+
- **REST-assured** (Java) - Fluent API testing
|
|
427
|
+
- **Postman/Newman** - Collection-based testing
|
|
428
|
+
- **Playwright API** - E2E with API calls
|
|
429
|
+
|
|
430
|
+
### Contract Testing
|
|
431
|
+
- **Pact** - Consumer-driven contracts
|
|
432
|
+
- **Spring Cloud Contract** - JVM contract testing
|
|
433
|
+
|
|
434
|
+
### Load Testing
|
|
435
|
+
- **k6** - Modern load testing
|
|
436
|
+
- **Apache JMeter** - Enterprise load testing
|
|
437
|
+
- **Artillery** - Modern performance testing
|
|
438
|
+
|
|
439
|
+
## Common Pitfalls
|
|
440
|
+
|
|
441
|
+
### ❌ Testing Implementation, Not Contract
|
|
442
|
+
Don't test internal database queries. Test the API response.
|
|
443
|
+
|
|
444
|
+
### ❌ Ignoring HTTP Semantics
|
|
445
|
+
Use correct status codes (200, 201, 400, 404, 500) and methods (GET, POST, PUT, DELETE).
|
|
446
|
+
|
|
447
|
+
### ❌ No Negative Testing
|
|
448
|
+
Always test error cases, not just happy paths.
|
|
449
|
+
|
|
450
|
+
### ❌ Brittle Tests
|
|
451
|
+
Don't assert on field order or extra fields. Focus on contract.
|
|
452
|
+
|
|
453
|
+
### ❌ Slow Tests
|
|
454
|
+
Mock external services. Don't wait for real third-party APIs.
|
|
455
|
+
|
|
456
|
+
## Best Practices
|
|
457
|
+
|
|
458
|
+
### ✅ Test from Consumer Perspective
|
|
459
|
+
Write tests as if you're using the API, not implementing it.
|
|
460
|
+
|
|
461
|
+
### ✅ Use Schema Validation
|
|
462
|
+
Validate response structure, not exact values.
|
|
463
|
+
|
|
464
|
+
### ✅ Test Error Scenarios
|
|
465
|
+
Network failures, timeouts, invalid input, authorization errors.
|
|
466
|
+
|
|
467
|
+
### ✅ Version Your API Tests
|
|
468
|
+
Keep tests for each API version to prevent breaking changes.
|
|
469
|
+
|
|
470
|
+
### ✅ Automate in CI/CD
|
|
471
|
+
Run API tests on every commit, not just before release.
|
|
472
|
+
|
|
473
|
+
## Real-World Example: E-Commerce API
|
|
474
|
+
|
|
475
|
+
```javascript
|
|
476
|
+
describe('E-Commerce Order API', () => {
|
|
477
|
+
describe('Happy path', () => {
|
|
478
|
+
it('complete order flow', async () => {
|
|
479
|
+
// Add to cart
|
|
480
|
+
const cart = await api.post('/cart', { productId: 'abc', quantity: 2 });
|
|
481
|
+
|
|
482
|
+
// Apply discount
|
|
483
|
+
await api.post('/cart/discount', { code: 'SAVE10' });
|
|
484
|
+
|
|
485
|
+
// Checkout
|
|
486
|
+
const order = await api.post('/orders', {
|
|
487
|
+
cartId: cart.body.id,
|
|
488
|
+
payment: { method: 'card', token: 'tok_123' }
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
expect(order.status).toBe(201);
|
|
492
|
+
expect(order.body.status).toBe('pending');
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
describe('Edge cases', () => {
|
|
497
|
+
it('handles out of stock during checkout', async () => {
|
|
498
|
+
// Product sold out between cart and checkout
|
|
499
|
+
const order = await api.post('/orders', {
|
|
500
|
+
cartId: 'cart-with-sold-out-item'
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
expect(order.status).toBe(409); // Conflict
|
|
504
|
+
expect(order.body.error).toMatch(/out of stock/i);
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
});
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
## Using with QE Agents
|
|
511
|
+
|
|
512
|
+
### Automated Contract Testing
|
|
513
|
+
|
|
514
|
+
**qe-api-contract-validator** ensures API contracts are maintained:
|
|
515
|
+
```typescript
|
|
516
|
+
// Agent validates API contract against specification
|
|
517
|
+
await agent.validateContract({
|
|
518
|
+
spec: 'openapi.yaml',
|
|
519
|
+
endpoint: '/orders',
|
|
520
|
+
method: 'POST',
|
|
521
|
+
checkBreakingChanges: true
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
// Returns:
|
|
525
|
+
// {
|
|
526
|
+
// valid: false,
|
|
527
|
+
// breakingChanges: [
|
|
528
|
+
// 'Field "orderId" changed from string to number'
|
|
529
|
+
// ],
|
|
530
|
+
// warnings: ['New optional field "metadata" added']
|
|
531
|
+
// }
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### Agent-Generated API Test Suites
|
|
535
|
+
|
|
536
|
+
**qe-test-generator** creates comprehensive API tests:
|
|
537
|
+
```typescript
|
|
538
|
+
// Generate tests from OpenAPI spec
|
|
539
|
+
await agent.generateFromSpec({
|
|
540
|
+
spec: 'openapi.yaml',
|
|
541
|
+
coverage: 'comprehensive',
|
|
542
|
+
include: [
|
|
543
|
+
'happy-paths',
|
|
544
|
+
'input-validation',
|
|
545
|
+
'auth-scenarios',
|
|
546
|
+
'error-handling',
|
|
547
|
+
'idempotency',
|
|
548
|
+
'concurrency'
|
|
549
|
+
]
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
// → Creates 200+ tests covering all API patterns
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Real-Time API Test Execution
|
|
556
|
+
|
|
557
|
+
**qe-test-executor** runs API tests with smart retry logic:
|
|
558
|
+
```typescript
|
|
559
|
+
// Execute API tests with intelligent retry for flakiness
|
|
560
|
+
await agent.executeAPITests({
|
|
561
|
+
suite: 'integration',
|
|
562
|
+
parallel: true,
|
|
563
|
+
retryStrategy: 'exponential-backoff',
|
|
564
|
+
flakyDetection: true
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
// → Detects and reports network-related flakiness
|
|
568
|
+
// → Auto-retries transient failures (503, timeout)
|
|
569
|
+
// → Fails fast on persistent errors (401, 404)
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
### Contract-Based Integration Testing
|
|
573
|
+
|
|
574
|
+
```typescript
|
|
575
|
+
// Agent coordinates contract testing between services
|
|
576
|
+
const contractFleet = await FleetManager.coordinate({
|
|
577
|
+
strategy: 'contract-testing',
|
|
578
|
+
agents: [
|
|
579
|
+
'qe-api-contract-validator', // Validate contracts
|
|
580
|
+
'qe-test-generator', // Generate consumer tests
|
|
581
|
+
'qe-test-executor' // Execute against provider
|
|
582
|
+
],
|
|
583
|
+
topology: 'mesh' // Consumer-provider pairs
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
// Microservices contract validation
|
|
587
|
+
await contractFleet.execute({
|
|
588
|
+
services: [
|
|
589
|
+
{ name: 'orders-api', consumers: ['checkout-ui', 'admin-api'] },
|
|
590
|
+
{ name: 'payment-api', consumers: ['orders-api'] }
|
|
591
|
+
]
|
|
592
|
+
});
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
### Performance Testing for APIs
|
|
596
|
+
|
|
597
|
+
**qe-performance-tester** load tests critical endpoints:
|
|
598
|
+
```typescript
|
|
599
|
+
// Agent runs load tests on API endpoints
|
|
600
|
+
await agent.loadTest({
|
|
601
|
+
endpoint: '/orders',
|
|
602
|
+
method: 'POST',
|
|
603
|
+
rps: 1000, // 1000 requests per second
|
|
604
|
+
duration: '5min',
|
|
605
|
+
scenarios: [
|
|
606
|
+
'create-order',
|
|
607
|
+
'concurrent-checkouts',
|
|
608
|
+
'bulk-operations'
|
|
609
|
+
]
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
// Returns:
|
|
613
|
+
// {
|
|
614
|
+
// avgResponseTime: '45ms',
|
|
615
|
+
// p95: '120ms',
|
|
616
|
+
// p99: '250ms',
|
|
617
|
+
// errorRate: 0.02, // 2% error rate
|
|
618
|
+
// bottlenecks: ['database connection pool']
|
|
619
|
+
// }
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
### Security Testing for APIs
|
|
623
|
+
|
|
624
|
+
**qe-security-scanner** tests API vulnerabilities:
|
|
625
|
+
```typescript
|
|
626
|
+
// Agent scans for API security issues
|
|
627
|
+
await agent.scanAPI({
|
|
628
|
+
spec: 'openapi.yaml',
|
|
629
|
+
checks: [
|
|
630
|
+
'sql-injection',
|
|
631
|
+
'xss',
|
|
632
|
+
'broken-auth',
|
|
633
|
+
'excessive-data-exposure',
|
|
634
|
+
'rate-limiting',
|
|
635
|
+
'input-validation'
|
|
636
|
+
]
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
// Identifies:
|
|
640
|
+
// - Missing rate limiting on /login
|
|
641
|
+
// - No input sanitization on /search
|
|
642
|
+
// - Exposed internal IDs in responses
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
### Continuous Contract Monitoring
|
|
646
|
+
|
|
647
|
+
**qe-production-intelligence** monitors live API contracts:
|
|
648
|
+
```typescript
|
|
649
|
+
// Agent monitors production API for contract drift
|
|
650
|
+
await agent.monitorAPIContract({
|
|
651
|
+
endpoint: '/orders',
|
|
652
|
+
spec: 'openapi.yaml',
|
|
653
|
+
alertOn: 'breaking-changes',
|
|
654
|
+
sampleRate: 0.01 // Monitor 1% of traffic
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
// Alerts:
|
|
658
|
+
// "⚠️ Production API returning extra field not in spec: 'internalProcessId'"
|
|
659
|
+
// "🔴 Breaking change detected: 'quantity' changed from int to string"
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
## Related Skills
|
|
665
|
+
|
|
666
|
+
**Core Quality Practices:**
|
|
667
|
+
- [agentic-quality-engineering](../agentic-quality-engineering/) - API testing with agent coordination
|
|
668
|
+
- [holistic-testing-pact](../holistic-testing-pact/) - APIs in test quadrants
|
|
669
|
+
|
|
670
|
+
**Testing Approaches:**
|
|
671
|
+
- [test-automation-strategy](../test-automation-strategy/) - API tests in automation pyramid
|
|
672
|
+
- [risk-based-testing](../risk-based-testing/) - Risk-based API test prioritization
|
|
673
|
+
- [performance-testing](../performance-testing/) - API load testing patterns
|
|
674
|
+
- [security-testing](../security-testing/) - API security validation
|
|
675
|
+
|
|
676
|
+
**Development Practices:**
|
|
677
|
+
- [tdd-london-chicago](../tdd-london-chicago/) - London school for API testing (mocking)
|
|
678
|
+
- [code-review-quality](../code-review-quality/) - Review API test quality
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
## Remember
|
|
683
|
+
|
|
684
|
+
API testing is about verifying contracts and behavior, not implementation details. Focus on what matters to API consumers: correct responses, proper error handling, and acceptable performance.
|
|
685
|
+
|
|
686
|
+
**With Agents**: Agents automate contract validation, generate comprehensive API test suites from specifications, and continuously monitor production APIs for contract drift. Use agents to maintain API quality across microservices at scale.
|