agentic-qe 1.4.4 → 1.5.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.
Files changed (390) hide show
  1. package/.claude/agents/qe-api-contract-validator.md +133 -27
  2. package/.claude/agents/qe-api-contract-validator.md.backup +1148 -0
  3. package/.claude/agents/qe-api-contract-validator.md.backup-20251107-134747 +1148 -0
  4. package/.claude/agents/qe-api-contract-validator.md.backup-phase2-20251107-140039 +1123 -0
  5. package/.claude/agents/qe-chaos-engineer.md +142 -23
  6. package/.claude/agents/qe-chaos-engineer.md.backup +808 -0
  7. package/.claude/agents/qe-chaos-engineer.md.backup-20251107-134747 +808 -0
  8. package/.claude/agents/qe-chaos-engineer.md.backup-phase2-20251107-140039 +787 -0
  9. package/.claude/agents/qe-code-complexity.md +111 -23
  10. package/.claude/agents/qe-code-complexity.md.backup +291 -0
  11. package/.claude/agents/qe-code-complexity.md.backup-20251107-134747 +291 -0
  12. package/.claude/agents/qe-code-complexity.md.backup-phase2-20251107-140039 +286 -0
  13. package/.claude/agents/qe-coverage-analyzer.md +306 -30
  14. package/.claude/agents/qe-coverage-analyzer.md.backup +467 -0
  15. package/.claude/agents/qe-coverage-analyzer.md.backup-20251107-134747 +467 -0
  16. package/.claude/agents/qe-coverage-analyzer.md.backup-phase2-20251107-140039 +438 -0
  17. package/.claude/agents/qe-deployment-readiness.md +84 -28
  18. package/.claude/agents/qe-deployment-readiness.md.backup +1166 -0
  19. package/.claude/agents/qe-deployment-readiness.md.backup-20251107-134747 +1166 -0
  20. package/.claude/agents/qe-deployment-readiness.md.backup-phase2-20251107-140039 +1140 -0
  21. package/.claude/agents/qe-flaky-test-hunter.md +277 -35
  22. package/.claude/agents/qe-flaky-test-hunter.md.backup +1195 -0
  23. package/.claude/agents/qe-flaky-test-hunter.md.backup-20251107-134747 +1195 -0
  24. package/.claude/agents/qe-flaky-test-hunter.md.backup-phase2-20251107-140039 +1162 -0
  25. package/.claude/agents/qe-fleet-commander.md +126 -23
  26. package/.claude/agents/qe-fleet-commander.md.backup +718 -0
  27. package/.claude/agents/qe-fleet-commander.md.backup-20251107-134747 +718 -0
  28. package/.claude/agents/qe-fleet-commander.md.backup-phase2-20251107-140039 +697 -0
  29. package/.claude/agents/qe-performance-tester.md +314 -57
  30. package/.claude/agents/qe-performance-tester.md.backup +428 -0
  31. package/.claude/agents/qe-performance-tester.md.backup-20251107-134747 +428 -0
  32. package/.claude/agents/qe-performance-tester.md.backup-phase2-20251107-140039 +372 -0
  33. package/.claude/agents/qe-production-intelligence.md +126 -27
  34. package/.claude/agents/qe-production-intelligence.md.backup +1219 -0
  35. package/.claude/agents/qe-production-intelligence.md.backup-20251107-134747 +1219 -0
  36. package/.claude/agents/qe-production-intelligence.md.backup-phase2-20251107-140039 +1194 -0
  37. package/.claude/agents/qe-quality-analyzer.md +127 -32
  38. package/.claude/agents/qe-quality-analyzer.md.backup +425 -0
  39. package/.claude/agents/qe-quality-analyzer.md.backup-20251107-134747 +425 -0
  40. package/.claude/agents/qe-quality-analyzer.md.backup-phase2-20251107-140039 +394 -0
  41. package/.claude/agents/qe-quality-gate.md +148 -33
  42. package/.claude/agents/qe-quality-gate.md.backup +446 -0
  43. package/.claude/agents/qe-quality-gate.md.backup-20251107-134747 +446 -0
  44. package/.claude/agents/qe-quality-gate.md.backup-phase2-20251107-140039 +415 -0
  45. package/.claude/agents/qe-regression-risk-analyzer.md +78 -27
  46. package/.claude/agents/qe-regression-risk-analyzer.md.backup +1009 -0
  47. package/.claude/agents/qe-regression-risk-analyzer.md.backup-20251107-134747 +1009 -0
  48. package/.claude/agents/qe-regression-risk-analyzer.md.backup-phase2-20251107-140039 +984 -0
  49. package/.claude/agents/qe-requirements-validator.md +131 -27
  50. package/.claude/agents/qe-requirements-validator.md.backup +748 -0
  51. package/.claude/agents/qe-requirements-validator.md.backup-20251107-134747 +748 -0
  52. package/.claude/agents/qe-requirements-validator.md.backup-phase2-20251107-140039 +723 -0
  53. package/.claude/agents/qe-security-scanner.md +137 -62
  54. package/.claude/agents/qe-security-scanner.md.backup +634 -0
  55. package/.claude/agents/qe-security-scanner.md.backup-20251107-134747 +634 -0
  56. package/.claude/agents/qe-security-scanner.md.backup-phase2-20251107-140039 +573 -0
  57. package/.claude/agents/qe-test-data-architect.md +129 -26
  58. package/.claude/agents/qe-test-data-architect.md.backup +1064 -0
  59. package/.claude/agents/qe-test-data-architect.md.backup-20251107-134747 +1064 -0
  60. package/.claude/agents/qe-test-data-architect.md.backup-phase2-20251107-140039 +1040 -0
  61. package/.claude/agents/qe-test-executor.md +165 -21
  62. package/.claude/agents/qe-test-executor.md.backup +389 -0
  63. package/.claude/agents/qe-test-executor.md.backup-20251107-134747 +389 -0
  64. package/.claude/agents/qe-test-executor.md.backup-phase2-20251107-140039 +369 -0
  65. package/.claude/agents/qe-test-generator.md +379 -34
  66. package/.claude/agents/qe-test-generator.md.backup +997 -0
  67. package/.claude/agents/qe-test-generator.md.backup-20251107-134747 +997 -0
  68. package/.claude/agents/qe-visual-tester.md +236 -23
  69. package/.claude/agents/qe-visual-tester.md.backup +777 -0
  70. package/.claude/agents/qe-visual-tester.md.backup-20251107-134747 +777 -0
  71. package/.claude/agents/qe-visual-tester.md.backup-phase2-20251107-140039 +756 -0
  72. package/.claude/agents/subagents/qe-code-reviewer.md +59 -0
  73. package/.claude/agents/subagents/qe-data-generator.md +60 -0
  74. package/.claude/agents/subagents/qe-integration-tester.md +77 -0
  75. package/.claude/agents/subagents/qe-performance-validator.md +55 -0
  76. package/.claude/agents/subagents/qe-security-auditor.md +51 -0
  77. package/.claude/agents/subagents/qe-test-implementer.md +371 -0
  78. package/.claude/agents/subagents/qe-test-refactorer.md +510 -0
  79. package/.claude/agents/subagents/qe-test-writer.md +603 -0
  80. package/.claude/skills/accessibility-testing/SKILL.md +764 -777
  81. package/.claude/skills/agentic-quality-engineering/SKILL.md +0 -6
  82. package/.claude/skills/api-testing-patterns/SKILL.md +0 -12
  83. package/.claude/skills/bug-reporting-excellence/SKILL.md +0 -6
  84. package/.claude/skills/chaos-engineering-resilience/SKILL.md +0 -6
  85. package/.claude/skills/code-review-quality/SKILL.md +0 -6
  86. package/.claude/skills/compatibility-testing/SKILL.md +0 -6
  87. package/.claude/skills/compliance-testing/SKILL.md +0 -6
  88. package/.claude/skills/consultancy-practices/SKILL.md +0 -6
  89. package/.claude/skills/context-driven-testing/SKILL.md +0 -6
  90. package/.claude/skills/contract-testing/SKILL.md +0 -6
  91. package/.claude/skills/database-testing/SKILL.md +0 -6
  92. package/.claude/skills/exploratory-testing-advanced/SKILL.md +0 -6
  93. package/.claude/skills/holistic-testing-pact/SKILL.md +0 -6
  94. package/.claude/skills/localization-testing/SKILL.md +0 -6
  95. package/.claude/skills/mobile-testing/SKILL.md +535 -548
  96. package/.claude/skills/mutation-testing/SKILL.md +0 -6
  97. package/.claude/skills/performance-testing/SKILL.md +0 -6
  98. package/.claude/skills/quality-metrics/SKILL.md +0 -12
  99. package/.claude/skills/refactoring-patterns/SKILL.md +0 -6
  100. package/.claude/skills/regression-testing/SKILL.md +1033 -1045
  101. package/.claude/skills/risk-based-testing/SKILL.md +0 -12
  102. package/.claude/skills/security-testing/SKILL.md +0 -6
  103. package/.claude/skills/shift-left-testing/SKILL.md +529 -535
  104. package/.claude/skills/shift-right-testing/SKILL.md +585 -591
  105. package/.claude/skills/tdd-london-chicago/SKILL.md +0 -6
  106. package/.claude/skills/technical-writing/SKILL.md +0 -6
  107. package/.claude/skills/test-automation-strategy/SKILL.md +0 -6
  108. package/.claude/skills/test-data-management/SKILL.md +1054 -1067
  109. package/.claude/skills/test-design-techniques/SKILL.md +0 -6
  110. package/.claude/skills/test-environment-management/SKILL.md +0 -6
  111. package/.claude/skills/test-reporting-analytics/SKILL.md +0 -6
  112. package/.claude/skills/visual-testing-advanced/SKILL.md +0 -6
  113. package/.claude/skills/xp-practices/SKILL.md +0 -6
  114. package/CHANGELOG.md +397 -5
  115. package/README.md +24 -19
  116. package/dist/cli/commands/init.d.ts +4 -0
  117. package/dist/cli/commands/init.d.ts.map +1 -1
  118. package/dist/cli/commands/init.js +97 -44
  119. package/dist/cli/commands/init.js.map +1 -1
  120. package/dist/mcp/handlers/coordination/index.d.ts +14 -14
  121. package/dist/mcp/handlers/coordination/index.d.ts.map +1 -1
  122. package/dist/mcp/handlers/coordination/index.js +14 -14
  123. package/dist/mcp/handlers/coordination/index.js.map +1 -1
  124. package/dist/mcp/handlers/phase2/Phase2Tools.d.ts.map +1 -1
  125. package/dist/mcp/handlers/phase2/Phase2Tools.js +39 -10
  126. package/dist/mcp/handlers/phase2/Phase2Tools.js.map +1 -1
  127. package/dist/mcp/handlers/phase3/Phase3DomainTools.d.ts +63 -0
  128. package/dist/mcp/handlers/phase3/Phase3DomainTools.d.ts.map +1 -0
  129. package/dist/mcp/handlers/phase3/Phase3DomainTools.js +885 -0
  130. package/dist/mcp/handlers/phase3/Phase3DomainTools.js.map +1 -0
  131. package/dist/mcp/handlers/phase3/index.d.ts +6 -0
  132. package/dist/mcp/handlers/phase3/index.d.ts.map +1 -0
  133. package/dist/mcp/handlers/phase3/index.js +10 -0
  134. package/dist/mcp/handlers/phase3/index.js.map +1 -0
  135. package/dist/mcp/handlers/prediction/index.d.ts +10 -10
  136. package/dist/mcp/handlers/prediction/index.d.ts.map +1 -1
  137. package/dist/mcp/handlers/prediction/index.js +10 -10
  138. package/dist/mcp/handlers/prediction/index.js.map +1 -1
  139. package/dist/mcp/handlers/security/check-authz.d.ts +152 -0
  140. package/dist/mcp/handlers/security/check-authz.d.ts.map +1 -0
  141. package/dist/mcp/handlers/security/check-authz.js +434 -0
  142. package/dist/mcp/handlers/security/check-authz.js.map +1 -0
  143. package/dist/mcp/handlers/security/generate-report.d.ts +156 -0
  144. package/dist/mcp/handlers/security/generate-report.d.ts.map +1 -0
  145. package/dist/mcp/handlers/security/generate-report.js +469 -0
  146. package/dist/mcp/handlers/security/generate-report.js.map +1 -0
  147. package/dist/mcp/handlers/security/index.d.ts +80 -0
  148. package/dist/mcp/handlers/security/index.d.ts.map +1 -0
  149. package/dist/mcp/handlers/security/index.js +91 -0
  150. package/dist/mcp/handlers/security/index.js.map +1 -0
  151. package/dist/mcp/handlers/security/scan-comprehensive.d.ts +66 -0
  152. package/dist/mcp/handlers/security/scan-comprehensive.d.ts.map +1 -0
  153. package/dist/mcp/handlers/security/scan-comprehensive.js +296 -0
  154. package/dist/mcp/handlers/security/scan-comprehensive.js.map +1 -0
  155. package/dist/mcp/handlers/security/scan-dependencies.d.ts +148 -0
  156. package/dist/mcp/handlers/security/scan-dependencies.d.ts.map +1 -0
  157. package/dist/mcp/handlers/security/scan-dependencies.js +354 -0
  158. package/dist/mcp/handlers/security/scan-dependencies.js.map +1 -0
  159. package/dist/mcp/handlers/security/validate-auth.d.ts +128 -0
  160. package/dist/mcp/handlers/security/validate-auth.d.ts.map +1 -0
  161. package/dist/mcp/handlers/security/validate-auth.js +294 -0
  162. package/dist/mcp/handlers/security/validate-auth.js.map +1 -0
  163. package/dist/mcp/handlers/test/generate-integration-tests.d.ts +95 -0
  164. package/dist/mcp/handlers/test/generate-integration-tests.d.ts.map +1 -0
  165. package/dist/mcp/handlers/test/generate-integration-tests.js +286 -0
  166. package/dist/mcp/handlers/test/generate-integration-tests.js.map +1 -0
  167. package/dist/mcp/handlers/test/generate-unit-tests.d.ts +89 -0
  168. package/dist/mcp/handlers/test/generate-unit-tests.d.ts.map +1 -0
  169. package/dist/mcp/handlers/test/generate-unit-tests.js +273 -0
  170. package/dist/mcp/handlers/test/generate-unit-tests.js.map +1 -0
  171. package/dist/mcp/handlers/test/optimize-test-suite.d.ts +97 -0
  172. package/dist/mcp/handlers/test/optimize-test-suite.d.ts.map +1 -0
  173. package/dist/mcp/handlers/test/optimize-test-suite.js +282 -0
  174. package/dist/mcp/handlers/test/optimize-test-suite.js.map +1 -0
  175. package/dist/mcp/server.d.ts.map +1 -1
  176. package/dist/mcp/server.js +211 -0
  177. package/dist/mcp/server.js.map +1 -1
  178. package/dist/mcp/tools/deprecated.d.ts +1390 -0
  179. package/dist/mcp/tools/deprecated.d.ts.map +1 -0
  180. package/dist/mcp/tools/deprecated.js +859 -0
  181. package/dist/mcp/tools/deprecated.js.map +1 -0
  182. package/dist/mcp/tools/qe/api-contract/index.d.ts +138 -0
  183. package/dist/mcp/tools/qe/api-contract/index.d.ts.map +1 -0
  184. package/dist/mcp/tools/qe/api-contract/index.js +572 -0
  185. package/dist/mcp/tools/qe/api-contract/index.js.map +1 -0
  186. package/dist/mcp/tools/qe/code-quality/analyze-complexity.d.ts +110 -0
  187. package/dist/mcp/tools/qe/code-quality/analyze-complexity.d.ts.map +1 -0
  188. package/dist/mcp/tools/qe/code-quality/analyze-complexity.js +381 -0
  189. package/dist/mcp/tools/qe/code-quality/analyze-complexity.js.map +1 -0
  190. package/dist/mcp/tools/qe/code-quality/calculate-quality-metrics.d.ts +115 -0
  191. package/dist/mcp/tools/qe/code-quality/calculate-quality-metrics.d.ts.map +1 -0
  192. package/dist/mcp/tools/qe/code-quality/calculate-quality-metrics.js +461 -0
  193. package/dist/mcp/tools/qe/code-quality/calculate-quality-metrics.js.map +1 -0
  194. package/dist/mcp/tools/qe/code-quality/index.d.ts +12 -0
  195. package/dist/mcp/tools/qe/code-quality/index.d.ts.map +1 -0
  196. package/dist/mcp/tools/qe/code-quality/index.js +30 -0
  197. package/dist/mcp/tools/qe/code-quality/index.js.map +1 -0
  198. package/dist/mcp/tools/qe/coverage/analyze-with-risk-scoring.d.ts +58 -0
  199. package/dist/mcp/tools/qe/coverage/analyze-with-risk-scoring.d.ts.map +1 -0
  200. package/dist/mcp/tools/qe/coverage/analyze-with-risk-scoring.js +172 -0
  201. package/dist/mcp/tools/qe/coverage/analyze-with-risk-scoring.js.map +1 -0
  202. package/dist/mcp/tools/qe/coverage/calculate-trends.d.ts +73 -0
  203. package/dist/mcp/tools/qe/coverage/calculate-trends.d.ts.map +1 -0
  204. package/dist/mcp/tools/qe/coverage/calculate-trends.js +240 -0
  205. package/dist/mcp/tools/qe/coverage/calculate-trends.js.map +1 -0
  206. package/dist/mcp/tools/qe/coverage/detect-gaps-ml.d.ts +38 -0
  207. package/dist/mcp/tools/qe/coverage/detect-gaps-ml.d.ts.map +1 -0
  208. package/dist/mcp/tools/qe/coverage/detect-gaps-ml.js +204 -0
  209. package/dist/mcp/tools/qe/coverage/detect-gaps-ml.js.map +1 -0
  210. package/dist/mcp/tools/qe/coverage/index.d.ts +12 -0
  211. package/dist/mcp/tools/qe/coverage/index.d.ts.map +1 -0
  212. package/dist/mcp/tools/qe/coverage/index.js +23 -0
  213. package/dist/mcp/tools/qe/coverage/index.js.map +1 -0
  214. package/dist/mcp/tools/qe/coverage/recommend-tests.d.ts +46 -0
  215. package/dist/mcp/tools/qe/coverage/recommend-tests.d.ts.map +1 -0
  216. package/dist/mcp/tools/qe/coverage/recommend-tests.js +248 -0
  217. package/dist/mcp/tools/qe/coverage/recommend-tests.js.map +1 -0
  218. package/dist/mcp/tools/qe/flaky-detection/analyze-patterns.d.ts +179 -0
  219. package/dist/mcp/tools/qe/flaky-detection/analyze-patterns.d.ts.map +1 -0
  220. package/dist/mcp/tools/qe/flaky-detection/analyze-patterns.js +554 -0
  221. package/dist/mcp/tools/qe/flaky-detection/analyze-patterns.js.map +1 -0
  222. package/dist/mcp/tools/qe/flaky-detection/detect-statistical.d.ts +172 -0
  223. package/dist/mcp/tools/qe/flaky-detection/detect-statistical.d.ts.map +1 -0
  224. package/dist/mcp/tools/qe/flaky-detection/detect-statistical.js +498 -0
  225. package/dist/mcp/tools/qe/flaky-detection/detect-statistical.js.map +1 -0
  226. package/dist/mcp/tools/qe/flaky-detection/index.d.ts +35 -0
  227. package/dist/mcp/tools/qe/flaky-detection/index.d.ts.map +1 -0
  228. package/dist/mcp/tools/qe/flaky-detection/index.js +66 -0
  229. package/dist/mcp/tools/qe/flaky-detection/index.js.map +1 -0
  230. package/dist/mcp/tools/qe/flaky-detection/stabilize-auto.d.ts +159 -0
  231. package/dist/mcp/tools/qe/flaky-detection/stabilize-auto.d.ts.map +1 -0
  232. package/dist/mcp/tools/qe/flaky-detection/stabilize-auto.js +462 -0
  233. package/dist/mcp/tools/qe/flaky-detection/stabilize-auto.js.map +1 -0
  234. package/dist/mcp/tools/qe/fleet/index.d.ts +422 -0
  235. package/dist/mcp/tools/qe/fleet/index.d.ts.map +1 -0
  236. package/dist/mcp/tools/qe/fleet/index.js +652 -0
  237. package/dist/mcp/tools/qe/fleet/index.js.map +1 -0
  238. package/dist/mcp/tools/qe/performance/analyze-bottlenecks.d.ts +180 -0
  239. package/dist/mcp/tools/qe/performance/analyze-bottlenecks.d.ts.map +1 -0
  240. package/dist/mcp/tools/qe/performance/analyze-bottlenecks.js +347 -0
  241. package/dist/mcp/tools/qe/performance/analyze-bottlenecks.js.map +1 -0
  242. package/dist/mcp/tools/qe/performance/generate-report.d.ts +146 -0
  243. package/dist/mcp/tools/qe/performance/generate-report.d.ts.map +1 -0
  244. package/dist/mcp/tools/qe/performance/generate-report.js +354 -0
  245. package/dist/mcp/tools/qe/performance/generate-report.js.map +1 -0
  246. package/dist/mcp/tools/qe/performance/index.d.ts +13 -0
  247. package/dist/mcp/tools/qe/performance/index.d.ts.map +1 -0
  248. package/dist/mcp/tools/qe/performance/index.js +24 -0
  249. package/dist/mcp/tools/qe/performance/index.js.map +1 -0
  250. package/dist/mcp/tools/qe/performance/monitor-realtime.d.ts +120 -0
  251. package/dist/mcp/tools/qe/performance/monitor-realtime.d.ts.map +1 -0
  252. package/dist/mcp/tools/qe/performance/monitor-realtime.js +215 -0
  253. package/dist/mcp/tools/qe/performance/monitor-realtime.js.map +1 -0
  254. package/dist/mcp/tools/qe/performance/run-benchmark.d.ts +68 -0
  255. package/dist/mcp/tools/qe/performance/run-benchmark.d.ts.map +1 -0
  256. package/dist/mcp/tools/qe/performance/run-benchmark.js +120 -0
  257. package/dist/mcp/tools/qe/performance/run-benchmark.js.map +1 -0
  258. package/dist/mcp/tools/qe/quality-gates/assess-deployment-risk.d.ts +239 -0
  259. package/dist/mcp/tools/qe/quality-gates/assess-deployment-risk.d.ts.map +1 -0
  260. package/dist/mcp/tools/qe/quality-gates/assess-deployment-risk.js +671 -0
  261. package/dist/mcp/tools/qe/quality-gates/assess-deployment-risk.js.map +1 -0
  262. package/dist/mcp/tools/qe/quality-gates/evaluate-quality-gate.d.ts +219 -0
  263. package/dist/mcp/tools/qe/quality-gates/evaluate-quality-gate.d.ts.map +1 -0
  264. package/dist/mcp/tools/qe/quality-gates/evaluate-quality-gate.js +732 -0
  265. package/dist/mcp/tools/qe/quality-gates/evaluate-quality-gate.js.map +1 -0
  266. package/dist/mcp/tools/qe/quality-gates/generate-quality-report.d.ts +447 -0
  267. package/dist/mcp/tools/qe/quality-gates/generate-quality-report.d.ts.map +1 -0
  268. package/dist/mcp/tools/qe/quality-gates/generate-quality-report.js +551 -0
  269. package/dist/mcp/tools/qe/quality-gates/generate-quality-report.js.map +1 -0
  270. package/dist/mcp/tools/qe/quality-gates/index.d.ts +40 -0
  271. package/dist/mcp/tools/qe/quality-gates/index.d.ts.map +1 -0
  272. package/dist/mcp/tools/qe/quality-gates/index.js +56 -0
  273. package/dist/mcp/tools/qe/quality-gates/index.js.map +1 -0
  274. package/dist/mcp/tools/qe/quality-gates/validate-quality-metrics.d.ts +226 -0
  275. package/dist/mcp/tools/qe/quality-gates/validate-quality-metrics.d.ts.map +1 -0
  276. package/dist/mcp/tools/qe/quality-gates/validate-quality-metrics.js +603 -0
  277. package/dist/mcp/tools/qe/quality-gates/validate-quality-metrics.js.map +1 -0
  278. package/dist/mcp/tools/qe/regression/analyze-risk.d.ts +212 -0
  279. package/dist/mcp/tools/qe/regression/analyze-risk.d.ts.map +1 -0
  280. package/dist/mcp/tools/qe/regression/analyze-risk.js +617 -0
  281. package/dist/mcp/tools/qe/regression/analyze-risk.js.map +1 -0
  282. package/dist/mcp/tools/qe/regression/index.d.ts +36 -0
  283. package/dist/mcp/tools/qe/regression/index.d.ts.map +1 -0
  284. package/dist/mcp/tools/qe/regression/index.js +63 -0
  285. package/dist/mcp/tools/qe/regression/index.js.map +1 -0
  286. package/dist/mcp/tools/qe/regression/select-tests.d.ts +241 -0
  287. package/dist/mcp/tools/qe/regression/select-tests.d.ts.map +1 -0
  288. package/dist/mcp/tools/qe/regression/select-tests.js +601 -0
  289. package/dist/mcp/tools/qe/regression/select-tests.js.map +1 -0
  290. package/dist/mcp/tools/qe/requirements/generate-bdd-scenarios.d.ts +134 -0
  291. package/dist/mcp/tools/qe/requirements/generate-bdd-scenarios.d.ts.map +1 -0
  292. package/dist/mcp/tools/qe/requirements/generate-bdd-scenarios.js +737 -0
  293. package/dist/mcp/tools/qe/requirements/generate-bdd-scenarios.js.map +1 -0
  294. package/dist/mcp/tools/qe/requirements/index.d.ts +40 -0
  295. package/dist/mcp/tools/qe/requirements/index.d.ts.map +1 -0
  296. package/dist/mcp/tools/qe/requirements/index.js +84 -0
  297. package/dist/mcp/tools/qe/requirements/index.js.map +1 -0
  298. package/dist/mcp/tools/qe/requirements/validate-requirements.d.ts +196 -0
  299. package/dist/mcp/tools/qe/requirements/validate-requirements.d.ts.map +1 -0
  300. package/dist/mcp/tools/qe/requirements/validate-requirements.js +740 -0
  301. package/dist/mcp/tools/qe/requirements/validate-requirements.js.map +1 -0
  302. package/dist/mcp/tools/qe/security/detect-vulnerabilities.d.ts +300 -0
  303. package/dist/mcp/tools/qe/security/detect-vulnerabilities.d.ts.map +1 -0
  304. package/dist/mcp/tools/qe/security/detect-vulnerabilities.js +492 -0
  305. package/dist/mcp/tools/qe/security/detect-vulnerabilities.js.map +1 -0
  306. package/dist/mcp/tools/qe/security/index.d.ts +34 -0
  307. package/dist/mcp/tools/qe/security/index.d.ts.map +1 -0
  308. package/dist/mcp/tools/qe/security/index.js +44 -0
  309. package/dist/mcp/tools/qe/security/index.js.map +1 -0
  310. package/dist/mcp/tools/qe/security/scan-comprehensive.d.ts +240 -0
  311. package/dist/mcp/tools/qe/security/scan-comprehensive.d.ts.map +1 -0
  312. package/dist/mcp/tools/qe/security/scan-comprehensive.js +535 -0
  313. package/dist/mcp/tools/qe/security/scan-comprehensive.js.map +1 -0
  314. package/dist/mcp/tools/qe/security/validate-compliance.d.ts +299 -0
  315. package/dist/mcp/tools/qe/security/validate-compliance.d.ts.map +1 -0
  316. package/dist/mcp/tools/qe/security/validate-compliance.js +517 -0
  317. package/dist/mcp/tools/qe/security/validate-compliance.js.map +1 -0
  318. package/dist/mcp/tools/qe/shared/types.d.ts +840 -0
  319. package/dist/mcp/tools/qe/shared/types.d.ts.map +1 -0
  320. package/dist/mcp/tools/qe/shared/types.js +13 -0
  321. package/dist/mcp/tools/qe/shared/types.js.map +1 -0
  322. package/dist/mcp/tools/qe/test-data/analyze-schema.d.ts +264 -0
  323. package/dist/mcp/tools/qe/test-data/analyze-schema.d.ts.map +1 -0
  324. package/dist/mcp/tools/qe/test-data/analyze-schema.js +553 -0
  325. package/dist/mcp/tools/qe/test-data/analyze-schema.js.map +1 -0
  326. package/dist/mcp/tools/qe/test-data/generate-test-data.d.ts +167 -0
  327. package/dist/mcp/tools/qe/test-data/generate-test-data.d.ts.map +1 -0
  328. package/dist/mcp/tools/qe/test-data/generate-test-data.js +336 -0
  329. package/dist/mcp/tools/qe/test-data/generate-test-data.js.map +1 -0
  330. package/dist/mcp/tools/qe/test-data/index.d.ts +44 -0
  331. package/dist/mcp/tools/qe/test-data/index.d.ts.map +1 -0
  332. package/dist/mcp/tools/qe/test-data/index.js +90 -0
  333. package/dist/mcp/tools/qe/test-data/index.js.map +1 -0
  334. package/dist/mcp/tools/qe/test-data/mask-sensitive-data.d.ts +165 -0
  335. package/dist/mcp/tools/qe/test-data/mask-sensitive-data.d.ts.map +1 -0
  336. package/dist/mcp/tools/qe/test-data/mask-sensitive-data.js +342 -0
  337. package/dist/mcp/tools/qe/test-data/mask-sensitive-data.js.map +1 -0
  338. package/dist/mcp/tools/qe/test-generation/analyze-test-quality.d.ts +144 -0
  339. package/dist/mcp/tools/qe/test-generation/analyze-test-quality.d.ts.map +1 -0
  340. package/dist/mcp/tools/qe/test-generation/analyze-test-quality.js +432 -0
  341. package/dist/mcp/tools/qe/test-generation/analyze-test-quality.js.map +1 -0
  342. package/dist/mcp/tools/qe/test-generation/generate-integration-tests.d.ts +98 -0
  343. package/dist/mcp/tools/qe/test-generation/generate-integration-tests.d.ts.map +1 -0
  344. package/dist/mcp/tools/qe/test-generation/generate-integration-tests.js +459 -0
  345. package/dist/mcp/tools/qe/test-generation/generate-integration-tests.js.map +1 -0
  346. package/dist/mcp/tools/qe/test-generation/generate-unit-tests.d.ts +83 -0
  347. package/dist/mcp/tools/qe/test-generation/generate-unit-tests.d.ts.map +1 -0
  348. package/dist/mcp/tools/qe/test-generation/generate-unit-tests.js +483 -0
  349. package/dist/mcp/tools/qe/test-generation/generate-unit-tests.js.map +1 -0
  350. package/dist/mcp/tools/qe/test-generation/index.d.ts +56 -0
  351. package/dist/mcp/tools/qe/test-generation/index.d.ts.map +1 -0
  352. package/dist/mcp/tools/qe/test-generation/index.js +97 -0
  353. package/dist/mcp/tools/qe/test-generation/index.js.map +1 -0
  354. package/dist/mcp/tools/qe/test-generation/optimize-test-suite.d.ts +124 -0
  355. package/dist/mcp/tools/qe/test-generation/optimize-test-suite.d.ts.map +1 -0
  356. package/dist/mcp/tools/qe/test-generation/optimize-test-suite.js +362 -0
  357. package/dist/mcp/tools/qe/test-generation/optimize-test-suite.js.map +1 -0
  358. package/dist/mcp/tools/qe/visual/compare-screenshots.d.ts +119 -0
  359. package/dist/mcp/tools/qe/visual/compare-screenshots.d.ts.map +1 -0
  360. package/dist/mcp/tools/qe/visual/compare-screenshots.js +280 -0
  361. package/dist/mcp/tools/qe/visual/compare-screenshots.js.map +1 -0
  362. package/dist/mcp/tools/qe/visual/detect-regression.d.ts +138 -0
  363. package/dist/mcp/tools/qe/visual/detect-regression.d.ts.map +1 -0
  364. package/dist/mcp/tools/qe/visual/detect-regression.js +271 -0
  365. package/dist/mcp/tools/qe/visual/detect-regression.js.map +1 -0
  366. package/dist/mcp/tools/qe/visual/index.d.ts +16 -0
  367. package/dist/mcp/tools/qe/visual/index.d.ts.map +1 -0
  368. package/dist/mcp/tools/qe/visual/index.js +22 -0
  369. package/dist/mcp/tools/qe/visual/index.js.map +1 -0
  370. package/dist/mcp/tools/qe/visual/validate-accessibility.d.ts +276 -0
  371. package/dist/mcp/tools/qe/visual/validate-accessibility.d.ts.map +1 -0
  372. package/dist/mcp/tools/qe/visual/validate-accessibility.js +413 -0
  373. package/dist/mcp/tools/qe/visual/validate-accessibility.js.map +1 -0
  374. package/dist/mcp/tools.d.ts +44 -0
  375. package/dist/mcp/tools.d.ts.map +1 -1
  376. package/dist/mcp/tools.js +1980 -1
  377. package/dist/mcp/tools.js.map +1 -1
  378. package/package.json +2 -2
  379. package/dist/learning/__mocks__/LearningEngine.d.ts +0 -39
  380. package/dist/learning/__mocks__/LearningEngine.d.ts.map +0 -1
  381. package/dist/learning/__mocks__/LearningEngine.js +0 -116
  382. package/dist/learning/__mocks__/LearningEngine.js.map +0 -1
  383. package/dist/utils/__mocks__/Database.d.ts +0 -85
  384. package/dist/utils/__mocks__/Database.d.ts.map +0 -1
  385. package/dist/utils/__mocks__/Database.js +0 -125
  386. package/dist/utils/__mocks__/Database.js.map +0 -1
  387. package/dist/utils/__mocks__/Logger.d.ts +0 -26
  388. package/dist/utils/__mocks__/Logger.d.ts.map +0 -1
  389. package/dist/utils/__mocks__/Logger.js +0 -44
  390. package/dist/utils/__mocks__/Logger.js.map +0 -1
@@ -1,535 +1,529 @@
1
- ---
2
- name: shift-left-testing
3
- description: Move testing activities earlier (left) in software development lifecycle - unit tests, TDD, BDD, design for testability, and CI/CD integration. Use when reducing bug costs, implementing DevOps practices, or enabling continuous deployment.
4
- version: 1.0.0
5
- category: testing-methodologies
6
- tags: [shift-left, tdd, bdd, cicd, devops, early-testing, design-for-testability]
7
- difficulty: intermediate
8
- estimated_time: 60 minutes
9
- author: agentic-qe
10
- ---
11
-
12
- # Shift-Left Testing
13
-
14
- ## Core Principle
15
-
16
- **Finding bugs earlier reduces cost by 10x-100x.**
17
-
18
- Shift-left testing moves testing activities earlier (left on timeline) in software development lifecycle. The earlier you test, the cheaper bugs are to fix and the faster you can deploy.
19
-
20
- ## What is Shift-Left Testing?
21
-
22
- **Shift-Left:** Moving testing activities earlier (left on timeline) in software development lifecycle.
23
-
24
- **Traditional (Shift-Right):**
25
- ```
26
- Requirements → Design → Code → Test → Deploy
27
-
28
- Testing happens here (late, expensive)
29
- ```
30
-
31
- **Shift-Left:**
32
- ```
33
- Requirements Design Code Deploy
34
- ↓ ↓ ↓
35
- Test Test Test (continuous, cheap)
36
- ```
37
-
38
- **Benefits:**
39
- - 10x-100x cost reduction (bugs found early)
40
- - Faster feedback (minutes vs days)
41
- - Better quality (built-in vs bolted-on)
42
- - Confident deployments (continuous validation)
43
-
44
- ## Shift-Left Strategies
45
-
46
- ### Level 1: Traditional Testing
47
-
48
- - Testing after development complete
49
- - Separate QA phase
50
- - Manual testing dominant
51
- - Waterfall approach
52
-
53
- **Cost of Bug:** $1,000-10,000
54
-
55
- ---
56
-
57
- ### Level 2: Shift-Left (Unit Tests)
58
-
59
- - Developers write unit tests
60
- - TDD practices
61
- - Automated unit tests in CI
62
- - Test coverage metrics
63
-
64
- **Cost of Bug:** $100-1,000 (10x cheaper)
65
-
66
- ```javascript
67
- // Developer writes test BEFORE code (TDD)
68
- test('calculateTotal sums line items', () => {
69
- const items = [{ price: 10 }, { price: 20 }];
70
- expect(calculateTotal(items)).toBe(30);
71
- });
72
-
73
- // Then implements code
74
- function calculateTotal(items) {
75
- return items.reduce((sum, item) => sum + item.price, 0);
76
- }
77
- ```
78
-
79
- **TDD Cycle (Red-Green-Refactor):**
80
- 1. **Red**: Write failing test
81
- 2. **Green**: Write minimal code to pass
82
- 3. **Refactor**: Improve code quality
83
-
84
- ---
85
-
86
- ### Level 3: Shift-Further-Left (Requirements)
87
-
88
- - Testable acceptance criteria
89
- - BDD with Gherkin scenarios
90
- - Executable specifications
91
- - Test cases from requirements
92
-
93
- **Cost of Bug:** $10-100 (100x cheaper)
94
-
95
- ```gherkin
96
- # Specification IS test
97
- Feature: Shopping Cart
98
-
99
- Scenario: Calculate total with tax
100
- Given I have items worth $100
101
- When I apply 10% tax
102
- Then the total should be $110
103
- ```
104
-
105
- **BDD Benefits:**
106
- - Business stakeholders write tests
107
- - Living documentation
108
- - Automated acceptance testing
109
- - Shared understanding
110
-
111
- **Tools:** Cucumber, SpecFlow, Behave
112
-
113
- ---
114
-
115
- ### Level 4: Shift-All-The-Way-Left (Design)
116
-
117
- - Testability in architecture
118
- - Design for testability
119
- - API design reviewed for testing
120
- - Security/performance considered early
121
-
122
- **Cost of Bug:** $1-10 (1000x cheaper)
123
-
124
- ```typescript
125
- // Design decision: Dependency injection for testability
126
- class OrderService {
127
- constructor(
128
- private paymentGateway: PaymentGateway, // Injectable
129
- private emailService: EmailService // Mockable
130
- ) {}
131
-
132
- // Easy to test with mocks
133
- async placeOrder(order: Order) {
134
- await this.paymentGateway.charge(order.total);
135
- await this.emailService.sendConfirmation(order);
136
- }
137
- }
138
-
139
- // Test with mocks (no real payment gateway needed)
140
- test('places order successfully', async () => {
141
- const mockPayment = { charge: jest.fn() };
142
- const mockEmail = { sendConfirmation: jest.fn() };
143
-
144
- const service = new OrderService(mockPayment, mockEmail);
145
- await service.placeOrder({ total: 100 });
146
-
147
- expect(mockPayment.charge).toHaveBeenCalledWith(100);
148
- expect(mockEmail.sendConfirmation).toHaveBeenCalled();
149
- });
150
- ```
151
-
152
- **Design Patterns for Testability:**
153
- - Dependency Injection
154
- - Interface-based design
155
- - Single Responsibility Principle
156
- - Avoid global state
157
- - Pure functions (no side effects)
158
-
159
- ---
160
-
161
- ## Continuous Testing in CI/CD
162
-
163
- ### CI/CD Pipeline with Shift-Left Testing
164
-
165
- **Goal:** Test at every stage, fail fast, high confidence
166
-
167
- ```yaml
168
- # .github/workflows/ci.yml
169
- name: Shift-Left Testing Pipeline
170
-
171
- on: [push, pull_request]
172
-
173
- jobs:
174
- # Stage 1: Fast Feedback (< 5 minutes)
175
- fast-feedback:
176
- runs-on: ubuntu-latest
177
- timeout-minutes: 5
178
- steps:
179
- - uses: actions/checkout@v3
180
-
181
- # Static Analysis (30 seconds)
182
- - name: Lint
183
- run: npm run lint
184
-
185
- - name: Type Check
186
- run: npm run type-check
187
-
188
- # Unit Tests (2 minutes)
189
- - name: Unit Tests
190
- run: npm run test:unit
191
-
192
- - name: Coverage Check
193
- run: npm run coverage -- --threshold 80
194
-
195
- # Stage 2: Integration Tests (< 10 minutes)
196
- integration-tests:
197
- needs: fast-feedback
198
- runs-on: ubuntu-latest
199
- timeout-minutes: 10
200
- steps:
201
- - uses: actions/checkout@v3
202
-
203
- # Integration Tests (5 minutes)
204
- - name: Integration Tests
205
- run: npm run test:integration
206
-
207
- # Security Scanning (3 minutes)
208
- - name: Security Scan
209
- run: npm audit && npm run security:scan
210
-
211
- # Stage 3: E2E Tests (< 15 minutes)
212
- e2e-tests:
213
- needs: integration-tests
214
- runs-on: ubuntu-latest
215
- timeout-minutes: 15
216
- steps:
217
- - uses: actions/checkout@v3
218
-
219
- # E2E Tests (10 minutes)
220
- - name: E2E Tests with Playwright
221
- run: npm run test:e2e
222
-
223
- # Performance Tests (5 minutes)
224
- - name: Performance Tests
225
- run: npm run test:performance
226
-
227
- # Stage 4: Deploy to Staging
228
- deploy-staging:
229
- needs: e2e-tests
230
- if: github.ref == 'refs/heads/main'
231
- steps:
232
- - name: Deploy to Staging
233
- run: ./deploy.sh staging
234
-
235
- # Smoke Tests on Staging
236
- - name: Smoke Tests
237
- run: npm run test:smoke -- --env=staging
238
- ```
239
-
240
- **Pipeline Best Practices:**
241
- 1. **Fail Fast**: Run fastest tests first (lint, unit)
242
- 2. **Parallel Execution**: Run independent tests concurrently
243
- 3. **Clear Feedback**: Immediate notification on failures
244
- 4. **Incremental Testing**: Only run affected tests when possible
245
- 5. **Quality Gates**: Block merges on test failures
246
-
247
- ---
248
-
249
- ## Test Pyramid (Shift-Left Strategy)
250
-
251
- ```
252
- /\
253
- /E2E\ Few (slow, expensive, brittle)
254
- /------\
255
- / Int. \ Some (moderate speed/cost)
256
- /----------\
257
- / Unit \ Many (fast, cheap, reliable)
258
- /--------------\
259
- ```
260
-
261
- **Unit Tests (Base):**
262
- - 70-80% of tests
263
- - Milliseconds execution
264
- - Test individual functions/classes
265
- - High coverage, low cost
266
-
267
- **Integration Tests (Middle):**
268
- - 15-20% of tests
269
- - Seconds execution
270
- - Test component interactions
271
- - Database, API, services
272
-
273
- **E2E Tests (Top):**
274
- - 5-10% of tests
275
- - Minutes execution
276
- - Test critical user journeys
277
- - Full stack, realistic scenarios
278
-
279
- **Shift-Left Impact:**
280
- Most testing happens at UNIT level (early, cheap, fast).
281
-
282
- ---
283
-
284
- ## Shift-Left Practices
285
-
286
- ### 1. Test-Driven Development (TDD)
287
-
288
- **Process:**
289
- ```javascript
290
- // 1. RED: Write failing test
291
- test('validates email format', () => {
292
- expect(isValidEmail('invalid')).toBe(false);
293
- expect(isValidEmail('user@example.com')).toBe(true);
294
- });
295
-
296
- // 2. GREEN: Minimal implementation
297
- function isValidEmail(email) {
298
- return email.includes('@'); // Simple, passes test
299
- }
300
-
301
- // 3. REFACTOR: Improve implementation
302
- function isValidEmail(email) {
303
- const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
304
- return regex.test(email);
305
- }
306
- ```
307
-
308
- **Benefits:**
309
- - Better design (testable by default)
310
- - Complete test coverage
311
- - Confident refactoring
312
- - Living documentation
313
-
314
- ---
315
-
316
- ### 2. Behavior-Driven Development (BDD)
317
-
318
- **Process:**
319
- ```gherkin
320
- # Business writes this (executable spec)
321
- Feature: User Registration
322
-
323
- Scenario: New user signs up successfully
324
- Given I am on the registration page
325
- When I enter valid email "user@example.com"
326
- And I enter password "SecurePass123"
327
- And I click "Sign Up"
328
- Then I should see "Welcome"
329
- And I should receive a confirmation email
330
- ```
331
-
332
- **Implementation:**
333
- ```typescript
334
- // Developer implements step definitions
335
- Given('I am on the registration page', async () => {
336
- await page.goto('/register');
337
- });
338
-
339
- When('I enter valid email {string}', async (email: string) => {
340
- await page.fill('[data-test=email]', email);
341
- });
342
-
343
- // ... more step definitions
344
- ```
345
-
346
- **Benefits:**
347
- - Shared language (business + dev)
348
- - Testable requirements
349
- - Automated acceptance tests
350
- - Reduced misunderstandings
351
-
352
- ---
353
-
354
- ### 3. Design for Testability
355
-
356
- **Principles:**
357
-
358
- **a) Dependency Injection**
359
- ```typescript
360
- // ❌ Hard to test (tight coupling)
361
- class UserService {
362
- async createUser(data) {
363
- const db = new Database(); // Hard-coded dependency
364
- return db.insert('users', data);
365
- }
366
- }
367
-
368
- // ✅ Easy to test (loose coupling)
369
- class UserService {
370
- constructor(private db: Database) {}
371
-
372
- async createUser(data) {
373
- return this.db.insert('users', data);
374
- }
375
- }
376
-
377
- // Test with mock
378
- const mockDb = { insert: jest.fn() };
379
- const service = new UserService(mockDb);
380
- ```
381
-
382
- **b) Pure Functions**
383
- ```typescript
384
- // ❌ Hard to test (side effects, global state)
385
- let total = 0;
386
- function addToTotal(amount) {
387
- total += amount; // Modifies global state
388
- return total;
389
- }
390
-
391
- // ✅ Easy to test (pure, no side effects)
392
- function calculateTotal(current, amount) {
393
- return current + amount;
394
- }
395
-
396
- test('adds amounts correctly', () => {
397
- expect(calculateTotal(100, 50)).toBe(150);
398
- expect(calculateTotal(0, 10)).toBe(10);
399
- });
400
- ```
401
-
402
- **c) Single Responsibility**
403
- ```typescript
404
- // ❌ Hard to test (multiple responsibilities)
405
- class OrderProcessor {
406
- processOrder(order) {
407
- this.validateOrder(order);
408
- this.chargePayment(order);
409
- this.sendEmail(order);
410
- this.updateInventory(order);
411
- // Too many responsibilities!
412
- }
413
- }
414
-
415
- // Easy to test (single responsibility)
416
- class OrderValidator {
417
- validate(order) { /* ... */ }
418
- }
419
-
420
- class PaymentService {
421
- charge(order) { /* ... */ }
422
- }
423
-
424
- class EmailService {
425
- sendConfirmation(order) { /* ... */ }
426
- }
427
-
428
- // Each class has one reason to change, one thing to test
429
- ```
430
-
431
- ---
432
-
433
- ## Shift-Left Metrics
434
-
435
- **Track Effectiveness:**
436
-
437
- **1. Defect Detection Percentage (DDP)**
438
- ```
439
- DDP = (Defects found in phase / Total defects) × 100
440
-
441
- Target: 80%+ defects found before production
442
- ```
443
-
444
- **2. Test Coverage**
445
- ```
446
- Coverage = (Lines covered / Total lines) × 100
447
-
448
- Target: 80%+ for unit tests
449
- ```
450
-
451
- **3. Time to Feedback**
452
- ```
453
- Feedback Time = Time from commit to test results
454
-
455
- Target: < 10 minutes for unit tests
456
- < 30 minutes for integration tests
457
- < 60 minutes for E2E tests
458
- ```
459
-
460
- **4. Cost of Defects**
461
- ```
462
- Track cost by phase discovered:
463
- - Requirements: $1-10
464
- - Development: $100-1,000
465
- - QA: $1,000-10,000
466
- - Production: $10,000-100,000+
467
- ```
468
-
469
- ---
470
-
471
- ## Tools for Shift-Left Testing
472
-
473
- **Unit Testing:**
474
- - Jest, Mocha, Vitest (JavaScript)
475
- - JUnit, TestNG (Java)
476
- - pytest (Python)
477
- - RSpec (Ruby)
478
-
479
- **BDD Frameworks:**
480
- - Cucumber, SpecFlow (Gherkin)
481
- - Behave (Python)
482
- - Jasmine (JavaScript)
483
-
484
- **CI/CD Platforms:**
485
- - GitHub Actions
486
- - GitLab CI
487
- - Jenkins
488
- - CircleCI
489
- - Travis CI
490
-
491
- **Code Quality:**
492
- - ESLint, SonarQube
493
- - Code coverage (Jest, Istanbul, c8)
494
- - Static analysis (TypeScript, Flow)
495
-
496
- ---
497
-
498
- ## Related Skills
499
-
500
- **Core Testing:**
501
- - [test-automation-strategy](../test-automation-strategy/)
502
- - [tdd-london-chicago](../tdd-london-chicago/)
503
- - [regression-testing](../regression-testing/)
504
-
505
- **DevOps:**
506
- - [shift-right-testing](../shift-right-testing/) - Testing IN production
507
- - [test-design-techniques](../test-design-techniques/)
508
- - [mutation-testing](../mutation-testing/)
509
-
510
- **Complementary:**
511
- - [shift-right-testing](../shift-right-testing/) - Production validation (the other half)
512
-
513
- ---
514
-
515
- ## Remember
516
-
517
- **The earlier you find bugs, the cheaper they are to fix.**
518
-
519
- **Cost by Phase:**
520
- - Design/Requirements: $1-10
521
- - Development (unit tests): $100-1,000
522
- - QA/Integration: $1,000-10,000
523
- - Production: $10,000-100,000+
524
-
525
- **Shift-Left = 10x-100x cost reduction**
526
-
527
- **Best Practices:**
528
- 1. Write tests BEFORE code (TDD)
529
- 2. Make requirements testable (BDD)
530
- 3. Design for testability (DI, pure functions)
531
- 4. Automate everything (CI/CD)
532
- 5. Fail fast (run fastest tests first)
533
- 6. Test pyramid (many unit, few E2E)
534
-
535
- **With Agents:** `qe-test-generator` automatically generates shift-left tests (unit, integration) during development. `qe-regression-risk-analyzer` selects which tests to run based on code changes. Together, they enable true shift-left automation with minimal developer effort.
1
+ ---
2
+ name: shift-left-testing
3
+ description: Move testing activities earlier (left) in software development lifecycle - unit tests, TDD, BDD, design for testability, and CI/CD integration. Use when reducing bug costs, implementing DevOps practices, or enabling continuous deployment.
4
+ ---
5
+
6
+ # Shift-Left Testing
7
+
8
+ ## Core Principle
9
+
10
+ **Finding bugs earlier reduces cost by 10x-100x.**
11
+
12
+ Shift-left testing moves testing activities earlier (left on timeline) in software development lifecycle. The earlier you test, the cheaper bugs are to fix and the faster you can deploy.
13
+
14
+ ## What is Shift-Left Testing?
15
+
16
+ **Shift-Left:** Moving testing activities earlier (left on timeline) in software development lifecycle.
17
+
18
+ **Traditional (Shift-Right):**
19
+ ```
20
+ Requirements Design Code → Test → Deploy
21
+
22
+ Testing happens here (late, expensive)
23
+ ```
24
+
25
+ **Shift-Left:**
26
+ ```
27
+ Requirements → Design → Code → Deploy
28
+ ↓ ↓ ↓
29
+ Test Test Test (continuous, cheap)
30
+ ```
31
+
32
+ **Benefits:**
33
+ - 10x-100x cost reduction (bugs found early)
34
+ - Faster feedback (minutes vs days)
35
+ - Better quality (built-in vs bolted-on)
36
+ - Confident deployments (continuous validation)
37
+
38
+ ## Shift-Left Strategies
39
+
40
+ ### Level 1: Traditional Testing
41
+
42
+ - Testing after development complete
43
+ - Separate QA phase
44
+ - Manual testing dominant
45
+ - Waterfall approach
46
+
47
+ **Cost of Bug:** $1,000-10,000
48
+
49
+ ---
50
+
51
+ ### Level 2: Shift-Left (Unit Tests)
52
+
53
+ - Developers write unit tests
54
+ - TDD practices
55
+ - Automated unit tests in CI
56
+ - Test coverage metrics
57
+
58
+ **Cost of Bug:** $100-1,000 (10x cheaper)
59
+
60
+ ```javascript
61
+ // Developer writes test BEFORE code (TDD)
62
+ test('calculateTotal sums line items', () => {
63
+ const items = [{ price: 10 }, { price: 20 }];
64
+ expect(calculateTotal(items)).toBe(30);
65
+ });
66
+
67
+ // Then implements code
68
+ function calculateTotal(items) {
69
+ return items.reduce((sum, item) => sum + item.price, 0);
70
+ }
71
+ ```
72
+
73
+ **TDD Cycle (Red-Green-Refactor):**
74
+ 1. **Red**: Write failing test
75
+ 2. **Green**: Write minimal code to pass
76
+ 3. **Refactor**: Improve code quality
77
+
78
+ ---
79
+
80
+ ### Level 3: Shift-Further-Left (Requirements)
81
+
82
+ - Testable acceptance criteria
83
+ - BDD with Gherkin scenarios
84
+ - Executable specifications
85
+ - Test cases from requirements
86
+
87
+ **Cost of Bug:** $10-100 (100x cheaper)
88
+
89
+ ```gherkin
90
+ # Specification IS test
91
+ Feature: Shopping Cart
92
+
93
+ Scenario: Calculate total with tax
94
+ Given I have items worth $100
95
+ When I apply 10% tax
96
+ Then the total should be $110
97
+ ```
98
+
99
+ **BDD Benefits:**
100
+ - Business stakeholders write tests
101
+ - Living documentation
102
+ - Automated acceptance testing
103
+ - Shared understanding
104
+
105
+ **Tools:** Cucumber, SpecFlow, Behave
106
+
107
+ ---
108
+
109
+ ### Level 4: Shift-All-The-Way-Left (Design)
110
+
111
+ - Testability in architecture
112
+ - Design for testability
113
+ - API design reviewed for testing
114
+ - Security/performance considered early
115
+
116
+ **Cost of Bug:** $1-10 (1000x cheaper)
117
+
118
+ ```typescript
119
+ // Design decision: Dependency injection for testability
120
+ class OrderService {
121
+ constructor(
122
+ private paymentGateway: PaymentGateway, // Injectable
123
+ private emailService: EmailService // Mockable
124
+ ) {}
125
+
126
+ // Easy to test with mocks
127
+ async placeOrder(order: Order) {
128
+ await this.paymentGateway.charge(order.total);
129
+ await this.emailService.sendConfirmation(order);
130
+ }
131
+ }
132
+
133
+ // Test with mocks (no real payment gateway needed)
134
+ test('places order successfully', async () => {
135
+ const mockPayment = { charge: jest.fn() };
136
+ const mockEmail = { sendConfirmation: jest.fn() };
137
+
138
+ const service = new OrderService(mockPayment, mockEmail);
139
+ await service.placeOrder({ total: 100 });
140
+
141
+ expect(mockPayment.charge).toHaveBeenCalledWith(100);
142
+ expect(mockEmail.sendConfirmation).toHaveBeenCalled();
143
+ });
144
+ ```
145
+
146
+ **Design Patterns for Testability:**
147
+ - Dependency Injection
148
+ - Interface-based design
149
+ - Single Responsibility Principle
150
+ - Avoid global state
151
+ - Pure functions (no side effects)
152
+
153
+ ---
154
+
155
+ ## Continuous Testing in CI/CD
156
+
157
+ ### CI/CD Pipeline with Shift-Left Testing
158
+
159
+ **Goal:** Test at every stage, fail fast, high confidence
160
+
161
+ ```yaml
162
+ # .github/workflows/ci.yml
163
+ name: Shift-Left Testing Pipeline
164
+
165
+ on: [push, pull_request]
166
+
167
+ jobs:
168
+ # Stage 1: Fast Feedback (< 5 minutes)
169
+ fast-feedback:
170
+ runs-on: ubuntu-latest
171
+ timeout-minutes: 5
172
+ steps:
173
+ - uses: actions/checkout@v3
174
+
175
+ # Static Analysis (30 seconds)
176
+ - name: Lint
177
+ run: npm run lint
178
+
179
+ - name: Type Check
180
+ run: npm run type-check
181
+
182
+ # Unit Tests (2 minutes)
183
+ - name: Unit Tests
184
+ run: npm run test:unit
185
+
186
+ - name: Coverage Check
187
+ run: npm run coverage -- --threshold 80
188
+
189
+ # Stage 2: Integration Tests (< 10 minutes)
190
+ integration-tests:
191
+ needs: fast-feedback
192
+ runs-on: ubuntu-latest
193
+ timeout-minutes: 10
194
+ steps:
195
+ - uses: actions/checkout@v3
196
+
197
+ # Integration Tests (5 minutes)
198
+ - name: Integration Tests
199
+ run: npm run test:integration
200
+
201
+ # Security Scanning (3 minutes)
202
+ - name: Security Scan
203
+ run: npm audit && npm run security:scan
204
+
205
+ # Stage 3: E2E Tests (< 15 minutes)
206
+ e2e-tests:
207
+ needs: integration-tests
208
+ runs-on: ubuntu-latest
209
+ timeout-minutes: 15
210
+ steps:
211
+ - uses: actions/checkout@v3
212
+
213
+ # E2E Tests (10 minutes)
214
+ - name: E2E Tests with Playwright
215
+ run: npm run test:e2e
216
+
217
+ # Performance Tests (5 minutes)
218
+ - name: Performance Tests
219
+ run: npm run test:performance
220
+
221
+ # Stage 4: Deploy to Staging
222
+ deploy-staging:
223
+ needs: e2e-tests
224
+ if: github.ref == 'refs/heads/main'
225
+ steps:
226
+ - name: Deploy to Staging
227
+ run: ./deploy.sh staging
228
+
229
+ # Smoke Tests on Staging
230
+ - name: Smoke Tests
231
+ run: npm run test:smoke -- --env=staging
232
+ ```
233
+
234
+ **Pipeline Best Practices:**
235
+ 1. **Fail Fast**: Run fastest tests first (lint, unit)
236
+ 2. **Parallel Execution**: Run independent tests concurrently
237
+ 3. **Clear Feedback**: Immediate notification on failures
238
+ 4. **Incremental Testing**: Only run affected tests when possible
239
+ 5. **Quality Gates**: Block merges on test failures
240
+
241
+ ---
242
+
243
+ ## Test Pyramid (Shift-Left Strategy)
244
+
245
+ ```
246
+ /\
247
+ /E2E\ Few (slow, expensive, brittle)
248
+ /------\
249
+ / Int. \ Some (moderate speed/cost)
250
+ /----------\
251
+ / Unit \ Many (fast, cheap, reliable)
252
+ /--------------\
253
+ ```
254
+
255
+ **Unit Tests (Base):**
256
+ - 70-80% of tests
257
+ - Milliseconds execution
258
+ - Test individual functions/classes
259
+ - High coverage, low cost
260
+
261
+ **Integration Tests (Middle):**
262
+ - 15-20% of tests
263
+ - Seconds execution
264
+ - Test component interactions
265
+ - Database, API, services
266
+
267
+ **E2E Tests (Top):**
268
+ - 5-10% of tests
269
+ - Minutes execution
270
+ - Test critical user journeys
271
+ - Full stack, realistic scenarios
272
+
273
+ **Shift-Left Impact:**
274
+ Most testing happens at UNIT level (early, cheap, fast).
275
+
276
+ ---
277
+
278
+ ## Shift-Left Practices
279
+
280
+ ### 1. Test-Driven Development (TDD)
281
+
282
+ **Process:**
283
+ ```javascript
284
+ // 1. RED: Write failing test
285
+ test('validates email format', () => {
286
+ expect(isValidEmail('invalid')).toBe(false);
287
+ expect(isValidEmail('user@example.com')).toBe(true);
288
+ });
289
+
290
+ // 2. GREEN: Minimal implementation
291
+ function isValidEmail(email) {
292
+ return email.includes('@'); // Simple, passes test
293
+ }
294
+
295
+ // 3. REFACTOR: Improve implementation
296
+ function isValidEmail(email) {
297
+ const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
298
+ return regex.test(email);
299
+ }
300
+ ```
301
+
302
+ **Benefits:**
303
+ - Better design (testable by default)
304
+ - Complete test coverage
305
+ - Confident refactoring
306
+ - Living documentation
307
+
308
+ ---
309
+
310
+ ### 2. Behavior-Driven Development (BDD)
311
+
312
+ **Process:**
313
+ ```gherkin
314
+ # Business writes this (executable spec)
315
+ Feature: User Registration
316
+
317
+ Scenario: New user signs up successfully
318
+ Given I am on the registration page
319
+ When I enter valid email "user@example.com"
320
+ And I enter password "SecurePass123"
321
+ And I click "Sign Up"
322
+ Then I should see "Welcome"
323
+ And I should receive a confirmation email
324
+ ```
325
+
326
+ **Implementation:**
327
+ ```typescript
328
+ // Developer implements step definitions
329
+ Given('I am on the registration page', async () => {
330
+ await page.goto('/register');
331
+ });
332
+
333
+ When('I enter valid email {string}', async (email: string) => {
334
+ await page.fill('[data-test=email]', email);
335
+ });
336
+
337
+ // ... more step definitions
338
+ ```
339
+
340
+ **Benefits:**
341
+ - Shared language (business + dev)
342
+ - Testable requirements
343
+ - Automated acceptance tests
344
+ - Reduced misunderstandings
345
+
346
+ ---
347
+
348
+ ### 3. Design for Testability
349
+
350
+ **Principles:**
351
+
352
+ **a) Dependency Injection**
353
+ ```typescript
354
+ // Hard to test (tight coupling)
355
+ class UserService {
356
+ async createUser(data) {
357
+ const db = new Database(); // Hard-coded dependency
358
+ return db.insert('users', data);
359
+ }
360
+ }
361
+
362
+ // ✅ Easy to test (loose coupling)
363
+ class UserService {
364
+ constructor(private db: Database) {}
365
+
366
+ async createUser(data) {
367
+ return this.db.insert('users', data);
368
+ }
369
+ }
370
+
371
+ // Test with mock
372
+ const mockDb = { insert: jest.fn() };
373
+ const service = new UserService(mockDb);
374
+ ```
375
+
376
+ **b) Pure Functions**
377
+ ```typescript
378
+ // Hard to test (side effects, global state)
379
+ let total = 0;
380
+ function addToTotal(amount) {
381
+ total += amount; // Modifies global state
382
+ return total;
383
+ }
384
+
385
+ // Easy to test (pure, no side effects)
386
+ function calculateTotal(current, amount) {
387
+ return current + amount;
388
+ }
389
+
390
+ test('adds amounts correctly', () => {
391
+ expect(calculateTotal(100, 50)).toBe(150);
392
+ expect(calculateTotal(0, 10)).toBe(10);
393
+ });
394
+ ```
395
+
396
+ **c) Single Responsibility**
397
+ ```typescript
398
+ // ❌ Hard to test (multiple responsibilities)
399
+ class OrderProcessor {
400
+ processOrder(order) {
401
+ this.validateOrder(order);
402
+ this.chargePayment(order);
403
+ this.sendEmail(order);
404
+ this.updateInventory(order);
405
+ // Too many responsibilities!
406
+ }
407
+ }
408
+
409
+ // ✅ Easy to test (single responsibility)
410
+ class OrderValidator {
411
+ validate(order) { /* ... */ }
412
+ }
413
+
414
+ class PaymentService {
415
+ charge(order) { /* ... */ }
416
+ }
417
+
418
+ class EmailService {
419
+ sendConfirmation(order) { /* ... */ }
420
+ }
421
+
422
+ // Each class has one reason to change, one thing to test
423
+ ```
424
+
425
+ ---
426
+
427
+ ## Shift-Left Metrics
428
+
429
+ **Track Effectiveness:**
430
+
431
+ **1. Defect Detection Percentage (DDP)**
432
+ ```
433
+ DDP = (Defects found in phase / Total defects) × 100
434
+
435
+ Target: 80%+ defects found before production
436
+ ```
437
+
438
+ **2. Test Coverage**
439
+ ```
440
+ Coverage = (Lines covered / Total lines) × 100
441
+
442
+ Target: 80%+ for unit tests
443
+ ```
444
+
445
+ **3. Time to Feedback**
446
+ ```
447
+ Feedback Time = Time from commit to test results
448
+
449
+ Target: < 10 minutes for unit tests
450
+ < 30 minutes for integration tests
451
+ < 60 minutes for E2E tests
452
+ ```
453
+
454
+ **4. Cost of Defects**
455
+ ```
456
+ Track cost by phase discovered:
457
+ - Requirements: $1-10
458
+ - Development: $100-1,000
459
+ - QA: $1,000-10,000
460
+ - Production: $10,000-100,000+
461
+ ```
462
+
463
+ ---
464
+
465
+ ## Tools for Shift-Left Testing
466
+
467
+ **Unit Testing:**
468
+ - Jest, Mocha, Vitest (JavaScript)
469
+ - JUnit, TestNG (Java)
470
+ - pytest (Python)
471
+ - RSpec (Ruby)
472
+
473
+ **BDD Frameworks:**
474
+ - Cucumber, SpecFlow (Gherkin)
475
+ - Behave (Python)
476
+ - Jasmine (JavaScript)
477
+
478
+ **CI/CD Platforms:**
479
+ - GitHub Actions
480
+ - GitLab CI
481
+ - Jenkins
482
+ - CircleCI
483
+ - Travis CI
484
+
485
+ **Code Quality:**
486
+ - ESLint, SonarQube
487
+ - Code coverage (Jest, Istanbul, c8)
488
+ - Static analysis (TypeScript, Flow)
489
+
490
+ ---
491
+
492
+ ## Related Skills
493
+
494
+ **Core Testing:**
495
+ - [test-automation-strategy](../test-automation-strategy/)
496
+ - [tdd-london-chicago](../tdd-london-chicago/)
497
+ - [regression-testing](../regression-testing/)
498
+
499
+ **DevOps:**
500
+ - [shift-right-testing](../shift-right-testing/) - Testing IN production
501
+ - [test-design-techniques](../test-design-techniques/)
502
+ - [mutation-testing](../mutation-testing/)
503
+
504
+ **Complementary:**
505
+ - [shift-right-testing](../shift-right-testing/) - Production validation (the other half)
506
+
507
+ ---
508
+
509
+ ## Remember
510
+
511
+ **The earlier you find bugs, the cheaper they are to fix.**
512
+
513
+ **Cost by Phase:**
514
+ - Design/Requirements: $1-10
515
+ - Development (unit tests): $100-1,000
516
+ - QA/Integration: $1,000-10,000
517
+ - Production: $10,000-100,000+
518
+
519
+ **Shift-Left = 10x-100x cost reduction**
520
+
521
+ **Best Practices:**
522
+ 1. Write tests BEFORE code (TDD)
523
+ 2. Make requirements testable (BDD)
524
+ 3. Design for testability (DI, pure functions)
525
+ 4. Automate everything (CI/CD)
526
+ 5. Fail fast (run fastest tests first)
527
+ 6. Test pyramid (many unit, few E2E)
528
+
529
+ **With Agents:** `qe-test-generator` automatically generates shift-left tests (unit, integration) during development. `qe-regression-risk-analyzer` selects which tests to run based on code changes. Together, they enable true shift-left automation with minimal developer effort.